MCP HubMCP Hub
Omedia

mcp-server-drupal

by: Omedia

TS based companion MCP server for the Drupal MCP module that works with the STDIO transport.

34created 09/12/2024
Visit
TypeScript
Drupal

📌Overview

Purpose: The MCP Server for Drupal aims to facilitate communication between Drupal and Model Context Protocol (MCP) applications via a typescript-based server.

Overview: This server acts as a companion to the Drupal MCP module, allowing integration and data exchange through the STDIO transport. It is designed for use with the Drupal platform and is currently in active development, which means users should proceed with caution.

Key Features:

  • STDIO Transport Support: Enables communication via standard input and output, making it versatile for different applications and services.

  • Authentication Options: Provides flexible authentication mechanisms either through a token or basic username/password combination, ensuring secure access to the Drupal site.


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. The server is not required if you use SSE transport.

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, add the server config in the claude_desktop_config.json file located at:

    • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json

Example configuration:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "__BINARY_PATH__",
      "args": ["--drupal-url", "__DRUPAL_BASE_URL__"],
      "env": {}
    }
  }
}
  • --drupal-url is a required argument.

  • Replace __BINARY_PATH__ with the binary path.

  • Replace __DRUPAL_BASE_URL__ with your Drupal site base URL.

  • Check server and SDK version:

mcp-server-drupal --version
  • Check available commands:
mcp-server-drupal --help

Docker

The server is available as a docker image on GHCR.

Example configuration:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/omedia/mcp-server-drupal",
        "--drupal-url=__DRUPAL_BASE_URL__"
      ],
      "env": {}
    }
  }
}

Specific image versions are also available:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DRUPAL_AUTH_TOKEN",
        "ghcr.io/omedia/mcp-server-drupal:1.0.0-alpha5",
        "--drupal-url=__DRUPAL_BASE_URL__"
      ],
      "env": {
        "DRUPAL_AUTH_TOKEN": "THEPASSWORD"
      }
    }
  }
}

Development Phase

When using the server with ddev, lando, or simple docker compose, run the server in the same network as the Drupal site using --network or -n flags. Alternatively, you can use host.docker.internal.

Alternative Usage

The server is also available as a Deno module on JSR and can be used via npx:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "npx",
      "args": [
        "-y",
        "deno",
        "run",
        "-A",
        "jsr:@omedia/mcp-server-drupal@<VERSION>",
        "--drupal-url",
        "__DRUPAL_BASE_URL__"
      ],
      "env": {}
    }
  }
}

Authentication

The server supports authentication via environment variables using either an auth token or username and password.

Supported environment variables:

  • DRUPAL_AUTH_TOKEN: Authentication token.
  • DRUPAL_AUTH_USER: Username.
  • DRUPAL_AUTH_PASSWORD: Password.

Note: Enable authentication on the Drupal MCP module settings page.

Note: If both token and username/password are set, the token takes precedence.

Example with token:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "__BINARY_PATH__",
      "args": ["--drupal-url", "__DRUPAL_BASE_URL__"],
      "env": {
        "DRUPAL_AUTH_TOKEN": "<AUTH_TOKEN>"
      }
    }
  }
}

Example with username and password:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "__BINARY_PATH__",
      "args": ["--drupal-url", "__DRUPAL_BASE_URL__"],
      "env": {
        "DRUPAL_AUTH_USER": "<BASIC_AUTH_USERNAME>",
        "DRUPAL_AUTH_PASSWORD": "<BASIC_AUTH_PASSWORD>"
      }
    }
  }
}

Docker Authentication

When using Docker, pass authentication variables in the environment:

{
  "mcpServers": {
    "mcp-server-drupal": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DRUPAL_AUTH_TOKEN",
        "ghcr.io/omedia/mcp-server-drupal",
        "--drupal-url=__DRUPAL_BASE_URL__"
      ],
      "env": {
        "DRUPAL_AUTH_TOKEN": "<AUTH_TOKEN>"
      }
    }
  }
}

MCP Details

  • All instruments are defined by the Drupal API during initialization.

Note:
The server exposes:

  • Resources (templates, reads)
  • Tools (calls)
    No prompts are exposed currently.

Development

This project is built with Deno.

Note: Use Deno version 2.0.0 or above.

Install dependencies:

deno install

For development with auto-rebuild:

bun task dev

Build the server:

deno task build --output build/mcp-server-drupal

Tip: For specific platform builds, use the --target flag.

Debugging

MCP servers communicate over stdio, making debugging challenging. It is recommended to use the MCP Inspector available as a Deno task:

deno task inspector --drupal-url [DRUPAL_BASE_URL]

Verifying the Binaries

drupal_mcp_server binaries are signed using identity-based signing by Cosign. Verify using:

cosign verify-blob ${YOUR_BINARY_NAME} \
--bundle signatures/${YOUR_BINARY_NAME}.bundle \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp https://github.com/Omedia/mcp-server-drupal/.github/workflows/release.yml@refs/tags/v \
--certificate-github-workflow-repository Omedia/mcp-server-drupal