PHPackages                             drupal/jsonrpc\_mcp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. drupal/jsonrpc\_mcp

ActiveDrupal-module[Utility &amp; Helpers](/categories/utility)

drupal/jsonrpc\_mcp
===================

Exposes Drupal JSON-RPC method plugins as MCP (Model Context Protocol) tools, enabling integration with AI assistants like Claude Desktop

v1.5.4(6mo ago)149GPL-2.0-or-laterPHPPHP &gt;=8.1CI passing

Since Oct 1Pushed 6mo agoCompare

[ Source](https://github.com/e0ipso/jsonrpc_mcp)[ Packagist](https://packagist.org/packages/drupal/jsonrpc_mcp)[ RSS](/packages/drupal-jsonrpc-mcp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (33)Used By (0)

JSON-RPC MCP Bridge
===================

[](#json-rpc-mcp-bridge)

A Drupal module that exposes JSON-RPC method plugins as MCP ([Model Context Protocol](https://modelcontextprotocol.io/specification/2025-06-18/server/tools)) tools, enabling seamless integration between Drupal and MCP-compatible AI assistants like Claude Desktop.

Overview
--------

[](#overview)

The [Model Context Protocol (MCP) specification (2025-06-18)](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) is an open standard introduced by Anthropic that enables AI systems to discover and interact with external tools and data sources. This module bridges Drupal's JSON-RPC infrastructure with MCP, allowing Drupal sites to be discovered and used as MCP servers.

### Key Features

[](#key-features)

- 🔌 **Automatic Tool Discovery**: Expose existing JSON-RPC methods as MCP tools using a simple PHP attribute
- 🔐 **Security Built-in**: Inherits access control from JSON-RPC method permissions
- 📊 **JSON Schema Validation**: Automatic conversion of JSON-RPC schemas to MCP inputSchema/outputSchema

Requirements
------------

[](#requirements)

- Drupal 10.2+ or 11.x
- PHP 8.1+
- [JSON-RPC](https://www.drupal.org/project/jsonrpc) module (version 3 or higher)

How It Works
------------

[](#how-it-works)

### Architecture

[](#architecture)

 ```
  graph TB
      A["JSON-RPC Plugin Definition"] --> B["#JsonRpcMethod + #McpTool attributes"]
      B --> C["Discovery Servicereads attributes"]
      C --> D["MCP Tool Normalizerconverts to MCP schema"]
      D --> E["/mcp/tools/list endpointreturns MCP-compliant JSON"]
      E --> F["MCP ClientClaude Desktop, etc."]

      style A fill:#e1f5ff
      style F fill:#ffe1f5
      style E fill:#e8f5e1
```

      Loading The module uses PHP 8 attributes to mark JSON-RPC methods for MCP exposure. When an MCP client queries the discovery endpoint, the module:

1. Discovers all JSON-RPC methods marked with `#[McpTool]`
2. Converts JSON-RPC metadata to MCP tool schema format
3. Returns MCP-compliant tool definitions with proper JSON Schema

### Metadata Mapping

[](#metadata-mapping)

The module automatically maps JSON-RPC method metadata to MCP tool schema:

JSON-RPC FieldMCP FieldDescription`id``name`Unique tool identifier`usage``description`Human-readable description`params``inputSchema`JSON Schema for parameters`output``outputSchema`JSON Schema for return value(via `#[McpTool]`)`title`Display name for the tool(via `#[McpTool]`)`annotations`MCP-specific metadataUsage
-----

[](#usage)

### Marking Methods for MCP Exposure

[](#marking-methods-for-mcp-exposure)

Add the `#[McpTool]` attribute to any JSON-RPC method class:

```
