drupal-rag-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 John Paul Mariano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,371 @@
1
+ Metadata-Version: 2.4
2
+ Name: drupal-rag-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for Drupal RAG, file access, routes, and safe Drupal commands
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: mcp>=1.27.2
9
+ Requires-Dist: requests>=2.34.2
10
+ Requires-Dist: python-dotenv>=1.2.2
11
+ Requires-Dist: PyYAML>=6.0.3
12
+ Requires-Dist: psutil>=7.2.2
13
+ Requires-Dist: ipython>=9.14.1
14
+ Provides-Extra: rag
15
+ Requires-Dist: chromadb>=1.5.9; extra == "rag"
16
+ Requires-Dist: langchain>=1.3.2; extra == "rag"
17
+ Requires-Dist: langchain-chroma>=1.1.0; extra == "rag"
18
+ Requires-Dist: langchain-community>=0.4.2; extra == "rag"
19
+ Requires-Dist: langchain-core>=1.4.0; extra == "rag"
20
+ Requires-Dist: langchain-huggingface>=1.2.2; extra == "rag"
21
+ Requires-Dist: langchain-text-splitters>=1.1.2; extra == "rag"
22
+ Requires-Dist: sentence-transformers>=5.5.1; extra == "rag"
23
+ Requires-Dist: fastapi>=0.136.3; extra == "rag"
24
+ Requires-Dist: uvicorn>=0.48.0; extra == "rag"
25
+ Dynamic: license-file
26
+
27
+ # Drupal RAG MCP
28
+ <img src="media/screenshot.png" alt="Drupal Agent Screenshot" style="max-width: 150px;">
29
+
30
+ A Model Context Protocol (MCP) server that gives AI coding assistants direct access to Drupal projects through:
31
+
32
+ * Drupal codebase search (RAG)
33
+ * File reading
34
+ * File writing
35
+ * Drupal route discovery
36
+ * Safe Drupal command execution
37
+ * Project file listing
38
+
39
+ This server is designed for use with MCP-compatible clients such as:
40
+
41
+ * Claude Desktop
42
+ * Claude Code
43
+ * Cursor
44
+ * Windsurf
45
+ * Cline
46
+ * OpenAI Codex CLI
47
+ * Other MCP-compatible tools
48
+
49
+ ---
50
+
51
+ ## Features
52
+
53
+ ### Search Drupal Knowledge Base
54
+
55
+ Search indexed Drupal source code and documentation using semantic search.
56
+
57
+ Tool:
58
+
59
+ ```text
60
+ search_drupal_docs
61
+ ```
62
+
63
+ ### Read Drupal Files
64
+
65
+ Read any file within the configured Drupal project.
66
+
67
+ Tool:
68
+
69
+ ```text
70
+ read_drupal_file
71
+ ```
72
+
73
+ ### Write Drupal Files
74
+
75
+ Create or update files inside the Drupal project.
76
+
77
+ Tool:
78
+
79
+ ```text
80
+ write_drupal_file
81
+ ```
82
+
83
+ ### Run Drupal Commands
84
+
85
+ Execute approved Drupal development commands.
86
+
87
+ Supported commands:
88
+
89
+ * drush
90
+ * composer
91
+ * phpunit
92
+
93
+ Tool:
94
+
95
+ ```text
96
+ run_drupal_command
97
+ ```
98
+
99
+ ### List Project Files
100
+
101
+ Browse project source files without using embeddings.
102
+
103
+ Tool:
104
+
105
+ ```text
106
+ list_project_files
107
+ ```
108
+
109
+ ### Discover Drupal Routes
110
+
111
+ Search Drupal routes by:
112
+
113
+ * Route name
114
+ * Path
115
+ * Controller
116
+ * Form
117
+ * Permission
118
+ * Title
119
+
120
+ Tool:
121
+
122
+ ```text
123
+ find_routes
124
+ ```
125
+
126
+ ---
127
+
128
+ # Architecture
129
+
130
+ ```text
131
+ AI Client
132
+
133
+
134
+ Drupal MCP Server
135
+
136
+
137
+ Drupal RAG API
138
+
139
+ ├── Chroma Vector Database
140
+ ├── Drupal Source Code
141
+ └── Drupal Documentation
142
+ ```
143
+
144
+ The MCP server communicates with a local FastAPI service that performs indexing, search, file operations, and command execution.
145
+
146
+ ---
147
+
148
+ # Installation
149
+
150
+ Install from PyPI:
151
+
152
+ ```bash
153
+ pip install drupal-rag-mcp
154
+ ```
155
+
156
+ Or install with RAG dependencies:
157
+
158
+ ```bash
159
+ pip install "drupal-rag-mcp[rag]"
160
+ ```
161
+
162
+ ---
163
+
164
+ # Requirements
165
+
166
+ * Python 3.10+
167
+ * Drupal project
168
+ * Composer
169
+ * Drush (optional)
170
+ * ChromaDB
171
+
172
+ ---
173
+
174
+
175
+ # Build Your Drupal RAG
176
+ Create a .drupal-rag folder under your home directory
177
+ ```bash
178
+ mkdir ~/.drupal-rag
179
+ cd ~/.drupal-rag
180
+ touch config.toml
181
+ ```
182
+ Paste this settings
183
+ ```toml
184
+ drupal_root = "/path_to_drupal_project_directory"
185
+ db_dir = "~/.drupal-rag/chroma"
186
+ ```
187
+
188
+ Inside ~/.drupal-rag
189
+ ```bash
190
+ mkdir docs
191
+ ```
192
+
193
+ Inside docs add all your drupal documentation (PDF, MD, txt).
194
+ Start indexing your docs to create rag
195
+
196
+ ```bash
197
+ drupal-rag-index
198
+ ```
199
+
200
+ This will:
201
+
202
+ 1. Scan Drupal files
203
+ 2. Split documents into chunks
204
+ 3. Generate embeddings
205
+ 4. Store vectors in Chroma
206
+
207
+ ---
208
+
209
+ # Start the API Server
210
+
211
+ ```bash
212
+ drupal-rag-api
213
+ ```
214
+
215
+ The API provides:
216
+
217
+ ```text
218
+ POST /search
219
+ POST /read-file
220
+ POST /write-file
221
+ POST /run-command
222
+ POST /list-files
223
+ POST /find-routes
224
+ ```
225
+
226
+ ---
227
+
228
+ # Start the MCP Server
229
+
230
+ ```bash
231
+ drupal-rag-mcp
232
+ ```
233
+
234
+ The MCP server uses stdio transport and is intended to be launched by an MCP client.
235
+
236
+ ---
237
+
238
+ # MCP Client Configuration
239
+
240
+ ## Claude Desktop
241
+
242
+ ```json
243
+ {
244
+ "mcpServers": {
245
+ "drupal-rag": {
246
+ "command": "drupal-rag-mcp"
247
+ }
248
+ }
249
+ }
250
+ ```
251
+
252
+ ## Cursor
253
+
254
+ ```json
255
+ {
256
+ "mcpServers": {
257
+ "drupal-rag": {
258
+ "command": "drupal-rag-mcp"
259
+ }
260
+ }
261
+ }
262
+ ```
263
+
264
+ ## VSCODE
265
+
266
+ ### Installing and Running Ollama on Mac
267
+ ```bash
268
+ brew install ollama
269
+ brew services start ollama
270
+ brew services stop ollama
271
+ ```
272
+
273
+ ### Run and Download an AI Model
274
+ ```bash
275
+ ollama pull qwen3
276
+ ollama run qwen3
277
+ ```
278
+
279
+ ### Set Up Continue
280
+ 1. Add Extension Continue
281
+ 2. Configure Continue config.yaml
282
+ ```yml
283
+ name: Local Config
284
+ version: 1.0.0
285
+ schema: v1
286
+
287
+ models:
288
+ - name: Qwen3
289
+ provider: ollama
290
+ model: qwen3
291
+ ```
292
+
293
+ 3. Add MCP server in Continue
294
+
295
+ ```bash
296
+ which drupal-rag-mcp
297
+ ```
298
+ Example output: `/opt/anaconda3/envs/drupal_rag/bin/drupal-rag-mcp`
299
+
300
+ Configure Continue mcp-server.yaml
301
+ ```yml
302
+ name: Drupal RAG MCP
303
+ version: 0.0.1
304
+ schema: v1
305
+
306
+ mcpServers:
307
+ - name: drupal-rag
308
+ command: /opt/anaconda3/envs/drupal_rag/bin/drupal-rag-mcp
309
+ args: []
310
+ env:
311
+ DRUPAL_ROOT: /path_to_your_drupal
312
+ ```
313
+
314
+
315
+ ## Codex CLI
316
+
317
+ ```toml
318
+ [mcp_servers.drupal-rag]
319
+ command = "drupal-rag-mcp"
320
+ args = []
321
+ ```
322
+
323
+ ---
324
+
325
+ # Example Prompts
326
+
327
+ ```text
328
+ Find the route responsible for user login.
329
+ ```
330
+
331
+ ```text
332
+ Search Drupal documentation for cache tags.
333
+ ```
334
+
335
+ ```text
336
+ Show me all custom routes under /admin.
337
+ ```
338
+
339
+ ```text
340
+ Read web/modules/custom/example/src/Form/ExampleForm.php
341
+ ```
342
+
343
+ ```text
344
+ Run drush cr
345
+ ```
346
+
347
+ ---
348
+
349
+ # Security
350
+
351
+ The server includes several safeguards:
352
+
353
+ * Path traversal protection
354
+ * Drupal root restriction
355
+ * Command allow-list
356
+ * Ignored directories and file types
357
+ * Local-only API access
358
+
359
+ Only approved commands can be executed.
360
+
361
+ Review the source code before enabling write access in production environments.
362
+
363
+ ---
364
+
365
+ # License
366
+
367
+ MIT License
368
+
369
+ Copyright (c) 2026 John Paul Mariano
370
+
371
+ See the LICENSE file for full license text.
@@ -0,0 +1,345 @@
1
+ # Drupal RAG MCP
2
+ <img src="media/screenshot.png" alt="Drupal Agent Screenshot" style="max-width: 150px;">
3
+
4
+ A Model Context Protocol (MCP) server that gives AI coding assistants direct access to Drupal projects through:
5
+
6
+ * Drupal codebase search (RAG)
7
+ * File reading
8
+ * File writing
9
+ * Drupal route discovery
10
+ * Safe Drupal command execution
11
+ * Project file listing
12
+
13
+ This server is designed for use with MCP-compatible clients such as:
14
+
15
+ * Claude Desktop
16
+ * Claude Code
17
+ * Cursor
18
+ * Windsurf
19
+ * Cline
20
+ * OpenAI Codex CLI
21
+ * Other MCP-compatible tools
22
+
23
+ ---
24
+
25
+ ## Features
26
+
27
+ ### Search Drupal Knowledge Base
28
+
29
+ Search indexed Drupal source code and documentation using semantic search.
30
+
31
+ Tool:
32
+
33
+ ```text
34
+ search_drupal_docs
35
+ ```
36
+
37
+ ### Read Drupal Files
38
+
39
+ Read any file within the configured Drupal project.
40
+
41
+ Tool:
42
+
43
+ ```text
44
+ read_drupal_file
45
+ ```
46
+
47
+ ### Write Drupal Files
48
+
49
+ Create or update files inside the Drupal project.
50
+
51
+ Tool:
52
+
53
+ ```text
54
+ write_drupal_file
55
+ ```
56
+
57
+ ### Run Drupal Commands
58
+
59
+ Execute approved Drupal development commands.
60
+
61
+ Supported commands:
62
+
63
+ * drush
64
+ * composer
65
+ * phpunit
66
+
67
+ Tool:
68
+
69
+ ```text
70
+ run_drupal_command
71
+ ```
72
+
73
+ ### List Project Files
74
+
75
+ Browse project source files without using embeddings.
76
+
77
+ Tool:
78
+
79
+ ```text
80
+ list_project_files
81
+ ```
82
+
83
+ ### Discover Drupal Routes
84
+
85
+ Search Drupal routes by:
86
+
87
+ * Route name
88
+ * Path
89
+ * Controller
90
+ * Form
91
+ * Permission
92
+ * Title
93
+
94
+ Tool:
95
+
96
+ ```text
97
+ find_routes
98
+ ```
99
+
100
+ ---
101
+
102
+ # Architecture
103
+
104
+ ```text
105
+ AI Client
106
+
107
+
108
+ Drupal MCP Server
109
+
110
+
111
+ Drupal RAG API
112
+
113
+ ├── Chroma Vector Database
114
+ ├── Drupal Source Code
115
+ └── Drupal Documentation
116
+ ```
117
+
118
+ The MCP server communicates with a local FastAPI service that performs indexing, search, file operations, and command execution.
119
+
120
+ ---
121
+
122
+ # Installation
123
+
124
+ Install from PyPI:
125
+
126
+ ```bash
127
+ pip install drupal-rag-mcp
128
+ ```
129
+
130
+ Or install with RAG dependencies:
131
+
132
+ ```bash
133
+ pip install "drupal-rag-mcp[rag]"
134
+ ```
135
+
136
+ ---
137
+
138
+ # Requirements
139
+
140
+ * Python 3.10+
141
+ * Drupal project
142
+ * Composer
143
+ * Drush (optional)
144
+ * ChromaDB
145
+
146
+ ---
147
+
148
+
149
+ # Build Your Drupal RAG
150
+ Create a .drupal-rag folder under your home directory
151
+ ```bash
152
+ mkdir ~/.drupal-rag
153
+ cd ~/.drupal-rag
154
+ touch config.toml
155
+ ```
156
+ Paste this settings
157
+ ```toml
158
+ drupal_root = "/path_to_drupal_project_directory"
159
+ db_dir = "~/.drupal-rag/chroma"
160
+ ```
161
+
162
+ Inside ~/.drupal-rag
163
+ ```bash
164
+ mkdir docs
165
+ ```
166
+
167
+ Inside docs add all your drupal documentation (PDF, MD, txt).
168
+ Start indexing your docs to create rag
169
+
170
+ ```bash
171
+ drupal-rag-index
172
+ ```
173
+
174
+ This will:
175
+
176
+ 1. Scan Drupal files
177
+ 2. Split documents into chunks
178
+ 3. Generate embeddings
179
+ 4. Store vectors in Chroma
180
+
181
+ ---
182
+
183
+ # Start the API Server
184
+
185
+ ```bash
186
+ drupal-rag-api
187
+ ```
188
+
189
+ The API provides:
190
+
191
+ ```text
192
+ POST /search
193
+ POST /read-file
194
+ POST /write-file
195
+ POST /run-command
196
+ POST /list-files
197
+ POST /find-routes
198
+ ```
199
+
200
+ ---
201
+
202
+ # Start the MCP Server
203
+
204
+ ```bash
205
+ drupal-rag-mcp
206
+ ```
207
+
208
+ The MCP server uses stdio transport and is intended to be launched by an MCP client.
209
+
210
+ ---
211
+
212
+ # MCP Client Configuration
213
+
214
+ ## Claude Desktop
215
+
216
+ ```json
217
+ {
218
+ "mcpServers": {
219
+ "drupal-rag": {
220
+ "command": "drupal-rag-mcp"
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## Cursor
227
+
228
+ ```json
229
+ {
230
+ "mcpServers": {
231
+ "drupal-rag": {
232
+ "command": "drupal-rag-mcp"
233
+ }
234
+ }
235
+ }
236
+ ```
237
+
238
+ ## VSCODE
239
+
240
+ ### Installing and Running Ollama on Mac
241
+ ```bash
242
+ brew install ollama
243
+ brew services start ollama
244
+ brew services stop ollama
245
+ ```
246
+
247
+ ### Run and Download an AI Model
248
+ ```bash
249
+ ollama pull qwen3
250
+ ollama run qwen3
251
+ ```
252
+
253
+ ### Set Up Continue
254
+ 1. Add Extension Continue
255
+ 2. Configure Continue config.yaml
256
+ ```yml
257
+ name: Local Config
258
+ version: 1.0.0
259
+ schema: v1
260
+
261
+ models:
262
+ - name: Qwen3
263
+ provider: ollama
264
+ model: qwen3
265
+ ```
266
+
267
+ 3. Add MCP server in Continue
268
+
269
+ ```bash
270
+ which drupal-rag-mcp
271
+ ```
272
+ Example output: `/opt/anaconda3/envs/drupal_rag/bin/drupal-rag-mcp`
273
+
274
+ Configure Continue mcp-server.yaml
275
+ ```yml
276
+ name: Drupal RAG MCP
277
+ version: 0.0.1
278
+ schema: v1
279
+
280
+ mcpServers:
281
+ - name: drupal-rag
282
+ command: /opt/anaconda3/envs/drupal_rag/bin/drupal-rag-mcp
283
+ args: []
284
+ env:
285
+ DRUPAL_ROOT: /path_to_your_drupal
286
+ ```
287
+
288
+
289
+ ## Codex CLI
290
+
291
+ ```toml
292
+ [mcp_servers.drupal-rag]
293
+ command = "drupal-rag-mcp"
294
+ args = []
295
+ ```
296
+
297
+ ---
298
+
299
+ # Example Prompts
300
+
301
+ ```text
302
+ Find the route responsible for user login.
303
+ ```
304
+
305
+ ```text
306
+ Search Drupal documentation for cache tags.
307
+ ```
308
+
309
+ ```text
310
+ Show me all custom routes under /admin.
311
+ ```
312
+
313
+ ```text
314
+ Read web/modules/custom/example/src/Form/ExampleForm.php
315
+ ```
316
+
317
+ ```text
318
+ Run drush cr
319
+ ```
320
+
321
+ ---
322
+
323
+ # Security
324
+
325
+ The server includes several safeguards:
326
+
327
+ * Path traversal protection
328
+ * Drupal root restriction
329
+ * Command allow-list
330
+ * Ignored directories and file types
331
+ * Local-only API access
332
+
333
+ Only approved commands can be executed.
334
+
335
+ Review the source code before enabling write access in production environments.
336
+
337
+ ---
338
+
339
+ # License
340
+
341
+ MIT License
342
+
343
+ Copyright (c) 2026 John Paul Mariano
344
+
345
+ See the LICENSE file for full license text.