loading…
Search for a command to run...
loading…
Enables AI models to interact with Drupal 10+ sites via JSON:API for querying, searching, and retrieving content. It supports listing content types, searching b
Enables AI models to interact with Drupal 10+ sites via JSON:API for querying, searching, and retrieving content. It supports listing content types, searching by title across all types, and fetching detailed node information including relationships.
A Model Context Protocol (MCP) server that enables Claude to interact with Drupal 10+ sites via JSON:API. This server allows Claude to query, search, and retrieve content from your Drupal installation.
# Clone or create the project directory
mkdir drupal-mcp-server
cd drupal-mcp-server
# Initialize and install dependencies
npm init -y
npm install @modelcontextprotocol/sdk axios
npm install -D typescript @types/node
drupal-mcp-server/
├── src/
│ ├── index.ts # Main MCP server
│ ├── drupal-client.ts # Drupal API client
│ └── types.ts # TypeScript type definitions
├── dist/ # Compiled JavaScript (generated)
├── package.json
└── tsconfig.json
# Compile TypeScript
npm run build
# Watch mode (optional)
npm run watch
The compiled JavaScript files will be output to the dist/ directory.
Edit your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"drupal": {
"command": "node",
"args": ["/absolute/path/to/drupal-mcp-server/dist/index.js"],
"env": {
"DRUPAL_BASE_URL": "https://your-drupal-site.com",
"DRUPAL_USERNAME": "your-username",
"DRUPAL_PASSWORD": "your-password"
}
}
}
}
Note: Replace /absolute/path/to/drupal-mcp-server with the actual path on your system. Use pwd in the project directory to get the full path.
Add to your VS Code settings.json:
{
"cline.mcpServers": {
"drupal": {
"command": "node",
"args": ["/absolute/path/to/drupal-mcp-server/dist/index.js"],
"env": {
"DRUPAL_BASE_URL": "https://your-drupal-site.com",
"DRUPAL_USERNAME": "your-username",
"DRUPAL_PASSWORD": "your-password"
}
}
}
}
DRUPAL_BASE_URL (required): Your Drupal site URLDRUPAL_USERNAME (optional): Basic auth usernameDRUPAL_PASSWORD (optional): Basic auth passwordDRUPAL_ACCESS_TOKEN (optional): OAuth access token (alternative to username/password)Test the server directly from the command line:
cd /path/to/drupal-mcp-server
DRUPAL_BASE_URL="https://your-site.com" \
DRUPAL_USERNAME="admin" \
DRUPAL_PASSWORD="password" \
node dist/index.js
You should see:
Drupal MCP Server running
Connected to: https://your-site.com
Press Ctrl+C to stop.
Verify your Drupal site is accessible:
curl -I https://your-site.com/jsonapi
Should return a 200 OK status.
What tools do you have available?
List content types:
List all available content types on my Drupal site
Query content:
Show me 5 published articles
Search content:
Search for content with "tutorial" in the title
Get node details:
Get the full details of node [UUID]
Complex query:
1. List all content types
2. Find 3 articles
3. Show me the complete details of the first article
query_contentSearch and filter Drupal content by type.
Parameters:
contentType (required): Machine name of the content type (e.g., "article", "page")limit (optional): Maximum results to return (default: 10)title (optional): Filter by title (partial match)status (optional): Filter by publication status (true/false)get_nodeRetrieve complete details of a specific node.
Parameters:
nodeId (required): UUID or numeric ID of the nodeinclude (optional): Array of related entities to include (e.g., ["field_image", "uid"])list_content_typesList all available content types on the site.
Parameters: None
search_contentSearch across all content types by title.
Parameters:
searchTerm (required): Text to search for in titleslimit (optional): Maximum results (default: 10)# macOS
tail -f ~/Library/Logs/Claude/mcp*.log
If using self-signed certificates, the server automatically disables certificate verification for local development.
Ensure your Drupal user has permission to access JSON:API endpoints. The "View published content" permission is usually sufficient for read operations.
JSON:API is enabled by default in Drupal 10+. If you get 404 errors, verify it's enabled at:
/admin/modules → Search for "JSON:API"
TOOLS array in src/index.tsCallToolRequestSchema switch statementDrupalClient class as needednpm run buildPotential enhancements:
MIT
Contributions are welcome! Please feel free to submit issues or pull requests.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"drupal-mcp-server": {
"command": "npx",
"args": []
}
}
}