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

  1. Go to Site administration → Advanced features
  2. Enable Enable web services
  3. Save changes

2. Enable MCP Protocol

  1. Go to Site administration → Plugins → Web services → Manage protocols
  2. Enable Model Context Protocol (MCP)

3. Create an External Service

  1. Go to Site administration → Server → Web services → External services
  2. Click Add to create a new service
  3. Configure the service:
    • Name: e.g., "MCP Service"
    • Short name: e.g., "mcp_service"
    • Enabled: Yes
    • Authorized users only: Yes (recommended)
  4. Add the external functions your service should expose

4. Create a Token

  1. Go to Site administration → Server → Web services → Manage tokens
  2. Click Add to create a new token
  3. Select:
    • User: The user this token will authenticate as
    • Service: The service you created above
  4. 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.com with your Moodle domain
  • YOUR_TOKEN with the token you generated

💖 Support the development of this plugin

 

Keep it updated and free for everyone!

☕ Buy Me a Coffee (Ko-fi) | 💸 Support via PayPal

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4
Screenshot #5
Screenshot #6
Screenshot #7
Screenshot #8

Contributors

MohammadReza PourMohammad (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

نمایش نظرات
Please login to post comments