login · check · first call
Quick start
The quick start with upb-moodle is four steps: get the token, check the install, configure the client and ask the first question. It takes one browser login plus one command.
The steps
Get the token
upb-moodle loginopens a dedicated browser profile onlaunch.php, the Moodle Mobile login page. You sign in with UPB Login: user, password and one-time code. The package does not touch the fields and does not store the password.upb-moodle loginCheck the token
The command performs a real call and answers with
logged_inand your name. It does not print the token.upb-moodle auth-status upb-moodle whoamiConfigure the client
upb-moodle installadds the plugin or the MCP server to every CLI it finds. For one client:upb-moodle install claude. For one folder: add--scope project.upb-moodle install upb-moodle doctorAsk the first question
Restart the client, then ask in plain language. In Claude Code,
/mcpshows the connected server. The agent picks thedeadlinestool for the question below.Ce termene am în următoarele 7 zile?
The authentication flow
Diagram: upb-moodle login opens a dedicated browser profile; you sign in through UPB Login (Keycloak, with a one-time code); Moodle redirects to moodlemobile://token=…; the token is verified with a real call and saved in Credential Manager or Secret Service.
A real check
{
"fullname": "Student Test",
"userid": 1,
"username": "student.test",
"site": "Moodle Test",
"moodle_release": "4.1 (fake)",
"available_functions": 24
}upb-moodle whoami, against the fake Moodle server used by the tests. The data is synthetic.The first useful commands
From a terminal, without an agent: upb-moodle courses --faculty ETTI --year 2 --sem 1 lists the courses, upb-moodle assignments shows the assignments, upb-moodle deadlines --days 14 shows the deadlines, and upb-moodle grades shows the grades. All of them write JSON on stdout.
For materials: upb-moodle download --year 2 --sem 1 --out D:\Materiale. The default folder is ~/UPB-Moodle, and --out takes priority. The download writes files, pages, assignments, forums, quizzes, grades and the raw data.
What you see in the agent
Read tools run directly: courses, assignments, forums, grades, quizzes, notifications, deadlines. For a write, the agent shows you the exact content and asks for approval; only then does it send confirm=true. If you did not approve, the server refuses and does not touch the account.
If a client does not see the server, restart it. Claude Code loads the plugin at startup, and opencode reads opencode.json at startup. upb-moodle doctor shows what is connected and what is missing.
What happens behind the scenes
Every call starts from the same configuration: the token from Credential Manager or Secret Service, the URL from config.json or from UPB_MOODLE_URL. If the token is missing, the tool tells you to run moodle_login. The token is never written into the project folder. With --token-stdin, the token comes from a pipe and does not appear in the shell history.
CLI commands and MCP tools reach the same functions: client.py talks to Moodle over REST, activities.py does the reads, actions.py does the writes with confirmation, and materials.py and quiz.py cover downloading and quizzes. That is why a terminal command and a question in the agent give the same result.