Skip to content

Commit 95c49ff

Browse files
feat: Add MCP server for Drupal tools suggestion
- Implements MCP server using latest @modelcontextprotocol/sdk - Provides three tools: list_tools, search_tools, and get_tool - Reads tool data from _data/projects/*.yml files - Features semantic search with smart scoring system - Supports category filtering and detailed tool retrieval - Static-only operation with no external APIs - Auto-indexing of 186+ Drupal tools Resolves #39 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent df40aa9 commit 95c49ff

File tree

6 files changed

+1621
-0
lines changed

6 files changed

+1621
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ bundle install
4848
bundle exec jekyll serve --server 8080
4949
```
5050

51+
## MCP Server
52+
53+
This repository includes an MCP (Model Context Protocol) server that provides programmatic access to the Drupal tools database. See [mcp-server/README.md](./mcp-server/README.md) for details.
54+
55+
### Quick Start
56+
57+
```bash
58+
npm install
59+
npm run mcp
60+
```
61+
62+
The MCP server provides three tools:
63+
- `list_tools`: List all tools with optional category filtering
64+
- `search_tools`: Semantic search for tools
65+
- `get_tool`: Get detailed information about a specific tool
66+
5167
Or just open in Gitpod!
5268

5369
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/drupaltools/drupaltools.github.io)

mcp-server/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
*.log
3+
.env
4+
.DS_Store

mcp-server/README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Drupal Tools MCP Server
2+
3+
A simple MCP (Model Context Protocol) server that suggests Drupal tools from the `_data/projects` folder. This server provides semantic search and discovery of Drupal development tools, utilities, and projects.
4+
5+
## Features
6+
7+
- **list_tools**: List all available Drupal tools/projects with optional filtering
8+
- **search_tools**: Search for tools using semantic matching
9+
- **get_tool**: Get detailed information about a specific tool
10+
11+
## Setup
12+
13+
1. Install dependencies:
14+
```bash
15+
npm install
16+
```
17+
18+
2. Run the MCP server:
19+
```bash
20+
npm run mcp
21+
```
22+
23+
## Usage with Claude Desktop
24+
25+
Add the following to your Claude Desktop configuration file:
26+
27+
```json
28+
{
29+
"mcpServers": {
30+
"drupal-tools": {
31+
"command": "node",
32+
"args": ["/path/to/drupaltools.github.io/mcp-server/index.js"],
33+
"cwd": "/path/to/drupaltools.github.io"
34+
}
35+
}
36+
}
37+
```
38+
39+
## Available Tools
40+
41+
### 1. list_tools
42+
Lists all available Drupal tools/projects.
43+
44+
**Parameters:**
45+
- `category` (optional): Filter by category (e.g., 'testing', 'cli', 'deployment')
46+
- `limit` (optional, default: 50): Maximum number of tools to return
47+
48+
**Example:**
49+
```javascript
50+
{
51+
"name": "list_tools",
52+
"arguments": {
53+
"category": "testing",
54+
"limit": 10
55+
}
56+
}
57+
```
58+
59+
### 2. search_tools
60+
Search for tools using a query string. Uses smart scoring:
61+
- Title matches: 100 points
62+
- Category matches: 50 points
63+
- Tag matches: 30 points
64+
- Description matches: 20 points
65+
- Homepage/source matches: 10 points
66+
67+
**Parameters:**
68+
- `query` (required): Search query
69+
- `limit` (optional, default: 10): Maximum results to return
70+
71+
**Example:**
72+
```javascript
73+
{
74+
"name": "search_tools",
75+
"arguments": {
76+
"query": "docker",
77+
"limit": 5
78+
}
79+
}
80+
```
81+
82+
### 3. get_tool
83+
Get detailed information about a specific tool by ID or name.
84+
85+
**Parameters:**
86+
- `tool_id` (required): The tool ID (filename without .yml) or tool name
87+
88+
**Example:**
89+
```javascript
90+
{
91+
"name": "get_tool",
92+
"arguments": {
93+
"tool_id": "blt"
94+
}
95+
}
96+
```
97+
98+
## Data Format
99+
100+
The server reads YAML files from `_data/projects/*.yml`. Each file contains:
101+
102+
```yaml
103+
name: Tool Name
104+
year_created: 2020
105+
source: https://github.com/example/tool
106+
homepage: https://github.com/example/tool
107+
docs: https://docs.example.com
108+
description: "Tool description"
109+
requires:
110+
- git
111+
- composer
112+
drupal_versions:
113+
- 9
114+
- 10
115+
category:
116+
- testing
117+
- cli
118+
tags:
119+
- popular
120+
similar:
121+
- other-tool
122+
```
123+
124+
## Testing
125+
126+
Run the test suite:
127+
```bash
128+
node mcp-server/test.js
129+
```
130+
131+
Or test individual functionality:
132+
```bash
133+
node mcp-server/test-get-tool.js
134+
```
135+
136+
## Development
137+
138+
The server is built using the [Model Context Protocol SDK](https://modelcontextprotocol.io/docs/sdk).
139+
140+
Key features:
141+
- Static content only - no external APIs
142+
- Read-only operations
143+
- Minimal latency and cost
144+
- Automatic indexing on startup
145+
- Deterministic tool suggestions

0 commit comments

Comments
 (0)