Get the FREE Ultimate OpenClaw Setup Guide →

moodle-webservice_mcp

A Moodle web service plugin that implements the MCP for seamless integration with AI assistants

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio onbirdev-moodle-webservice_mcp docker run -i moodle:latest \
  --env MOODLE_TOKEN="YOUR_MOODLE_TOKEN_IF_NEEDED" \
  --env MOODLE_SITE_URL="https://your-moodle-site.com" \
  --env MOODLE_MCP_ENDPOINT="/webservice/mcp/server.php" \
  --env MOODLE_WEB_SERVICE_ENABLED="true"

How to use

This MCP server is implemented as a Moodle plugin that exposes Moodle's web service external functions through the Model Context Protocol (MCP) using JSON-RPC 2.0. Once installed and enabled in your Moodle instance, it dynamically discovers Moodle external functions that are available to the configured external service and presents them as MCP tools with JSON schemas for inputs and outputs. Clients can initialize a session, list the available tools, and call a specific tool by name with the proper arguments. Authentication is token-based, either via a wstoken query parameter or a Bearer token in the Authorization header, ensuring that only authorized services can access the exposed tools.

How to install

Prerequisites:

  • A Moodle instance (4.2+) with web services enabled
  • PHP 8.0+ and Moodle's web services configured
  • Access to install Moodle plugins (Site administration)

Installation steps:

  1. Install the Moodle MCP Web Service plugin
  • Via Moodle Admin UI: Site administration → Plugins → Install plugins
  • Search for and install the MCP Web Service plugin
  1. Manual installation (if you prefer cloning)
  1. Enable MCP protocol and web services
  • Enable web services: Site administration → Advanced features → Enable web services
  • Enable Model Context Protocol (MCP): Site administration → Plugins → Web services → Manage protocols → Enable MCP
  1. Create an External Service and Token (for authentication)
  • External service: Site administration → Server → Web services → External services → Add
    • Name: e.g., "MCP Service"
    • Short name: e.g., "mcp_service"
    • Enabled: Yes; Authorized users only: Yes
  • Add external functions your service should expose
  • Tokens: Site administration → Server → Web services → Manage tokens → Add
    • User: select user for authentication
    • Service: the MCP service you created
    • Save and copy the token
  1. Access MCP endpoint

Additional notes

Tips and considerations:

  • Ensure the user has the webservice/mcp:use capability to access MCP functions.
  • Tokens should be kept secret; rotate tokens if compromised.
  • The MCP server discovers Moodle external functions dynamically. If a function is not visible to the configured service, it will not appear in tools/list.
  • Monitor usage through Moodle logs (Site administration → Reports → Logs) for auditing tool calls.
  • The included client examples in the README demonstrate typical JSON-RPC 2.0 interaction: initialize, list tools, and call a specific tool.
  • If you deploy behind a reverse proxy or load balancer, ensure proper routing to the Moodle instance and correct SSL termination.

Related MCP Servers

Sponsor this space

Reach thousands of developers