Skip to content

Quick start

All clients use the same URL:

https://moodle.example.edu/local/mcp/server.php

Cursor (or any client with OAuth discovery)

Add the server to the project or user MCP config:

{
  "mcpServers": {
    "moodle": {
      "url": "https://moodle.example.edu/local/mcp/server.php"
    }
  }
}

The client gets a 401 whose WWW-Authenticate header carries a resource_metadata URL. From there it reads the authorisation server metadata and opens the Moodle consent page. You sign in with your normal Moodle account and approve read, write or admin.

With a pre-issued token

If you issued a token with the CLI, send it as a bearer header:

{
  "mcpServers": {
    "moodle": {
      "url": "https://moodle.example.edu/local/mcp/server.php",
      "headers": {
        "Authorization": "Bearer YOUR_ACCESS_TOKEN"
      }
    }
  }
}

MCP Inspector (CLI)

List the tools:

npx @modelcontextprotocol/inspector --cli \
  https://moodle.example.edu/local/mcp/server.php \
  --transport http \
  --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --method tools/list

Call site_info using the current protocol revision:

npx @modelcontextprotocol/inspector --cli \
  https://moodle.example.edu/local/mcp/server.php \
  --transport http --protocol-era modern \
  --header "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  --method tools/call --tool-name site_info

Protocol versions

  • Session-based: initialize, notifications/initialized, ping, tools/list, tools/call, optional Mcp-Session-Id header, DELETE to end a session. Versions 2025-03-26, 2025-06-18 and 2025-11-25.
  • Stateless revision 2026-07-28: server/discover, tools/list, tools/call, per-request _meta, and the MCP-Protocol-Version, Mcp-Method and Mcp-Name headers.

Tip

Write tools do not appear in tools/list until an administrator enables write mode.