Drupal MCP Server
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.
README
Drupal MCP Server
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.
Features
- Query Content: Search and filter nodes by content type with flexible options
- Get Node Details: Retrieve complete node information including relationships
- List Content Types: Discover all available content types on your site
- Search Across Types: Search for content across all content types by title
Prerequisites
- Node.js 18+ and npm
- TypeScript 5+
- A Drupal 10+ site with JSON:API enabled (enabled by default)
- Valid Drupal credentials (username/password or OAuth token)
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
Project Structure
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
Building
# Compile TypeScript
npm run build
# Watch mode (optional)
npm run watch
The compiled JavaScript files will be output to the dist/ directory.
Configuration
For Claude Desktop
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.
For Cline (VS Code)
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"
}
}
}
}
Environment Variables
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)
Testing
Manual Server Test
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.
Test Connection to Drupal
Verify your Drupal site is accessible:
curl -I https://your-site.com/jsonapi
Should return a 200 OK status.
Testing in Claude Desktop
- Restart Claude Desktop after updating the configuration
- Look for the 🔌 icon at the bottom of the interface
- Click it to see connected MCP servers
- Start a new conversation and try:
What tools do you have available?
Example Queries
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
Available Tools
query_content
Search 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_node
Retrieve 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_types
List all available content types on the site.
Parameters: None
search_content
Search across all content types by title.
Parameters:
searchTerm(required): Text to search for in titleslimit(optional): Maximum results (default: 10)
Troubleshooting
"Server disconnected" error
- Check that the server starts manually
- Verify the path in the configuration is absolute
- Check Claude Desktop logs:
# macOS tail -f ~/Library/Logs/Claude/mcp*.log
SSL Certificate errors (DDEV/local development)
If using self-signed certificates, the server automatically disables certificate verification for local development.
Permission errors
Ensure your Drupal user has permission to access JSON:API endpoints. The "View published content" permission is usually sufficient for read operations.
JSON:API not enabled
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"
Development
Adding new tools
- Define the tool schema in
TOOLSarray insrc/index.ts - Implement the handler in the
CallToolRequestSchemaswitch statement - Add any new methods to
DrupalClientclass as needed - Rebuild:
npm run build
Extending functionality
Potential enhancements:
- Create/update content (POST/PATCH requests)
- Manage taxonomy terms
- Query users
- Execute Views
- Upload media/files
- Manage menus
License
MIT
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。