moodle mcp <subcommand> runs and manages moodle-cli’s MCP (Model Context Protocol) server — the interface an AI agent uses to read your Moodle data. This page covers what each subcommand does on your machine. For connecting a specific client app (Claude Code, Claude Desktop, Codex, VS Code, Cursor, and others) once a server is running, see MCP servers, How it works and the client pages under Connect a client.
Local: mcp serve
submit, which uploads local files into an assignment. It only appears locally because the remote server has no filesystem to read files from. Calling it without explicitly asking for an upload only gets the plan, never an upload, matching the CLI’s own plan-first behavior described in Submit.
See the full list of tools it exposes, with their parameters and read/write status, at Moodle MCP tool catalog.
Managed deployment: mcp deploy
deploy runs through these steps, in order:
- Validating your Moodle session
- Checking Cloudflare access
- Preparing a Worker release
- Uploading private credentials
- Deploying the new version
- Uploading your Moodle session
- Running MCP and Moodle checks
- Installing renewal and connecting your local client
Managing the deployment tool
deploy needs a small companion tool to manage the Worker on your Cloudflare account. moodle-cli uses one already on your system if it’s a compatible version; otherwise it downloads the right version once, with your confirmation, into ~/.config/moodle-cli/tools/wrangler@<version> and reuses it from there on every later deploy.
mcp status
--verbose includes sanitized deployment diagnostics; --logs includes sanitized recent Worker logs.
mcp login
mcp deploy. Run this after your Moodle session expires and the deployed copy has gone stale — mcp session push and the renewal job (below) are the other two ways a deployed session gets refreshed.
mcp connect
codex, claude-desktop (also matched by plain claude), claude-code, vscode (also matched by vs-code), and cursor. Passed with no argument, connect targets whichever supported clients it detects installed.
--mode is bridge (the default) or remote:
bridgewrites a command invocation (moodle mcp bridge --profile ...) into the client’s config. No token is ever written to disk in the client’s own file — the bridge process reads the access token from your OS credential manager at connect time and attaches it to each request itself.remotewrites the deployed server’s address and the access token directly into the client’s config, for clients that connect to a remote MCP server directly.
--show-token reveals the access token once, after you confirm — useful for a client connect doesn’t have a built-in setup for; see Other clients.
mcp bridge
mcp connect --mode bridge wires into a client’s config. It reads MCP requests from the local client, forwards them to the managed remote server with the access token attached, and streams the response back — the client process never sees or stores the token itself.
mcp pair
mcp clients and mcp revoke
clients lists pending and approved OAuth clients on your deployed server. revoke removes one client by id, or every client, token, pending authorization and pairing window at once with --all.
mcp session push and mcp renewal run
session push uploads a Moodle cookie from stdin directly, an advanced path for scripting a session refresh without a browser. renewal run is what the installed background renewal job (set up during mcp deploy’s last step) actually runs: it checks the deployed session’s freshness and renews it if needed.
mcp remove
--yes, it asks you to type the Worker’s name to confirm — required, since deleting the Worker can’t be undone; --yes skips the prompt.
For removing everything moodle-cli has installed locally, including background jobs and configuration, see Uninstall.