MCP Server for Drupal
This is a typescript based companion
Model Context Protocol(MCP)
server for the Drupal MCP module that
works with the STDIO
transport. In order to use SSE
transport this server is
not required.
[!IMPORTANT] Both the Drupal module and this server are in active development. Use them at your own risk.
Installation and Usage
-
Download the binary for your system from the releases page
-
To use it with Claude Desktop you need to add the server config in the
claude_desktop_config.json
file. The file is located at the following path:- On MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- On Windows:
%APPDATA%/Claude/claude_desktop_config.json
1{ 2 "mcpServers": { 3 "mcp-server-drupal": { 4 "command": "__BINARY_PATH__", 5 "args": ["--drupal-url", "__DRUPAL_BASE_URL__"], 6 "env": {} 7 } 8 } 9}
--drupal-url
is a required argument- Replace
__BINARY_PATH__
with the path to the downloaded binary - Replace
__DRUPAL_BASE_URL__
with the base URL of your Drupal site
- On MacOS:
-
To check the server and sdk version run the following command:
1mcp-server-drupal --version
- To check the available commands run the following command:
1mcp-server-drupal --help
Alternative usage
The server is also available as a deno module on JSR so you can use via npx
1 2{ 3 "mcpServers": { 4 "mcp-server-drupal": { 5 "command": "npx", 6 "args": [ 7 "-y", 8 "deno", 9 "run", 10 "-A", 11 "jsr:@omedia/mcp-server-drupal@<VERSION>", 12 "--drupal-url", 13 "__DRUPAL_BASE_URL__" 14 ], 15 "env": {} 16 } 17 } 18}
Authentication
The server supports both authentication via environment variables. You can use either a auth token or a basic auth with username and password combination . The following environment variables are supported:
DRUPAL_AUTH_TOKEN
: The authentication token.DRUPAL_AUTH_USER
: The username for authentication.DRUPAL_AUTH_PASSWORD
: The password for authentication.
[!NOTE] Make sure to turn the authentication on the Drupal MCP module settings page.
[!NOTE] If both
DRUPAL_AUTH_TOKEN
andDRUPAL_AUTH_USER
/DRUPAL_AUTH_PASSWORD
are set, the token will be used over the username and password.
Example usage with token:
1{ 2 "mcpServers": { 3 "mcp-server-drupal": { 4 "command": "__BINARY_PATH__", 5 "args": ["--drupal-url", "__DRUPAL_BASE_URL__"], 6 "env": { 7 "DRUPAL_AUTH_TOKEN": "<AUTH_TOKEN>" 8 } 9 } 10 } 11}
Example usage with username and password:
1{ 2 "mcpServers": { 3 "mcp-server-drupal": { 4 "command": "__BINARY_PATH__", 5 "args": ["--drupal-url", "__DRUPAL_BASE_URL__"], 6 "env": { 7 "DRUPAL_AUTH_USER": "<BASIC_AUTH_USERNAME>", 8 "DRUPAL_AUTH_PASSWORD": "<BASIC_AUTH_PASSWORD>" 9 } 10 } 11 } 12}
MCP
- All instruments are defined by the Drupal API during the initialization phase
[!NOTE] The server now exposes the following
- Resources (templates, reads)
- Tools (calls)
No prompts are exposed by the server for now
Development
This project is built with Deno.
[!NOTE] Use deno version
2.0.0
or above
Install dependencies:
1deno install
For development with auto-rebuild:
1bun task dev
Build the server:
1deno task build --output build/mcp-server-drupal
[!TIP] To build for the specific platform use the
--target
flag and check the docs
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a deno task:
1deno task inspector --drupal-url [DRUPAL_BASE_URL]
Verifying the binaries
drupal_mcp_server
binaries are signed by cosign using identity-based signing. You can verify your binary by downloading the signatures.tar.gz
file from the release page, extracting the signature and running the following command:
1cosign verify-blob ${YOUR_BINARY_NAME} \ 2--bundle signatures/${YOUR_BINARY_NAME}.bundle \ 3--certificate-oidc-issuer https://token.actions.githubusercontent.com \ 4--certificate-identity-regexp https://github.com/Omedia/mcp-server-drupal/.github/workflows/release.yml@refs/tags/v \ 5--certificate-github-workflow-repository Omedia/mcp-server-drupal