Moodle Plugins directory: Model Context Protocol | Moodle.org
Model Context Protocol
Web service protocols ::: webservice_mcp
Maintained by
MohammadReza PourMohammad
A Moodle web service plugin that implements the Model Context Protocol (MCP) for seamless integration with AI assistants and external systems.
Latest release:
12 downloads
4 fans
Current versions available: 1
A Moodle web service plugin that implements the Model Context Protocol (MCP) for seamless integration with AI assistants and external systems. This plugin exposes Moodle's external functions as MCP tools using JSON-RPC 2.0, making them discoverable and callable by MCP-compatible clients.
Features
- MCP Protocol Implementation: Full support for Model Context Protocol using JSON-RPC 2.0
- Dynamic Tool Discovery: Automatically exposes Moodle external functions as MCP tools
- JSON Schema Generation: Converts Moodle parameter descriptions to JSON Schema for better tool documentation
- Token-based Authentication: Secure access using Moodle's external service tokens
- Service-aware: Only exposes functions available to the authenticated service
- Well-tested: Comprehensive PHPUnit test coverage
- Easy Integration: Built-in client class for quick integration with other systems
Configuration
1. Enable Web Services
- Go to Site administration → Advanced features
- Enable Enable web services
- Save changes
2. Enable MCP Protocol
- Go to Site administration → Plugins → Web services → Manage protocols
- Enable Model Context Protocol (MCP)
3. Create an External Service
- Go to Site administration → Server → Web services → External services
- Click Add to create a new service
- Configure the service:
- Name: e.g., "MCP Service"
- Short name: e.g., "mcp_service"
- Enabled: Yes
- Authorized users only: Yes (recommended)
- Add the external functions your service should expose
4. Create a Token
- Go to Site administration → Server → Web services → Manage tokens
- Click Add to create a new token
- Select:
- User: The user this token will authenticate as
- Service: The service you created above
- Save and copy the generated token
5. Assign Capability
Ensure users have the webservice/mcp:use capability to access the MCP web service.
Usage
Endpoint URL
The MCP server endpoint can be accessed in two ways.
1. Using query parameter (wstoken):
2. Using Authorization header (Bearer token):
Add the token to the request header:
Authorization: Bearer YOUR_TOKEN
Replace:
your-moodle-site.comwith your Moodle domainYOUR_TOKENwith the token you generated
💖 Support the development of this plugin
Keep it updated and free for everyone!
Contributors
MohammadReza PourMohammad (Lead maintainer)
Please login to view contributors details and/or to contact them
Comments