driftdetect-mcp 0.9.5 → 0.9.6
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,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Drift MCP HTTP Server Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Exposes the MCP server over HTTP using SSE (Server-Sent Events) transport.
|
|
6
|
+
* This enables running Drift MCP as a containerized service accessible via HTTP.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* drift-mcp-http # Run server on default port 3000
|
|
10
|
+
* drift-mcp-http --port 8080 # Run on custom port
|
|
11
|
+
* drift-mcp-http --project /path/to/proj # Analyze specific project
|
|
12
|
+
*
|
|
13
|
+
* Environment Variables:
|
|
14
|
+
* PORT - HTTP server port (default: 3000)
|
|
15
|
+
* PROJECT_ROOT - Path to project to analyze (default: /project)
|
|
16
|
+
* ENABLE_CACHE - Enable response caching (default: true)
|
|
17
|
+
* ENABLE_RATE_LIMIT - Enable rate limiting (default: true)
|
|
18
|
+
* VERBOSE - Enable verbose logging (default: false)
|
|
19
|
+
*
|
|
20
|
+
* Endpoints:
|
|
21
|
+
* GET /health - Health check endpoint
|
|
22
|
+
* GET /sse - SSE endpoint for MCP communication
|
|
23
|
+
* POST /message - Send messages to MCP server
|
|
24
|
+
*
|
|
25
|
+
* Docker:
|
|
26
|
+
* docker compose up -d
|
|
27
|
+
* # Then configure your MCP client to connect to http://localhost:3000
|
|
28
|
+
*/
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=http-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../src/bin/http-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Drift MCP HTTP Server Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Exposes the MCP server over HTTP using SSE (Server-Sent Events) transport.
|
|
6
|
+
* This enables running Drift MCP as a containerized service accessible via HTTP.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* drift-mcp-http # Run server on default port 3000
|
|
10
|
+
* drift-mcp-http --port 8080 # Run on custom port
|
|
11
|
+
* drift-mcp-http --project /path/to/proj # Analyze specific project
|
|
12
|
+
*
|
|
13
|
+
* Environment Variables:
|
|
14
|
+
* PORT - HTTP server port (default: 3000)
|
|
15
|
+
* PROJECT_ROOT - Path to project to analyze (default: /project)
|
|
16
|
+
* ENABLE_CACHE - Enable response caching (default: true)
|
|
17
|
+
* ENABLE_RATE_LIMIT - Enable rate limiting (default: true)
|
|
18
|
+
* VERBOSE - Enable verbose logging (default: false)
|
|
19
|
+
*
|
|
20
|
+
* Endpoints:
|
|
21
|
+
* GET /health - Health check endpoint
|
|
22
|
+
* GET /sse - SSE endpoint for MCP communication
|
|
23
|
+
* POST /message - Send messages to MCP server
|
|
24
|
+
*
|
|
25
|
+
* Docker:
|
|
26
|
+
* docker compose up -d
|
|
27
|
+
* # Then configure your MCP client to connect to http://localhost:3000
|
|
28
|
+
*/
|
|
29
|
+
import { createServer } from 'http';
|
|
30
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
31
|
+
import {} from '@modelcontextprotocol/sdk/server/index.js';
|
|
32
|
+
import { createEnterpriseMCPServer } from '../enterprise-server.js';
|
|
33
|
+
// Server version (matches enterprise-server)
|
|
34
|
+
const SERVER_VERSION = '2.0.0';
|
|
35
|
+
// Track active transports for cleanup
|
|
36
|
+
const activeTransports = new Map();
|
|
37
|
+
let transportIdCounter = 0;
|
|
38
|
+
/**
|
|
39
|
+
* Set CORS headers for cross-origin requests
|
|
40
|
+
*/
|
|
41
|
+
function setCorsHeaders(res) {
|
|
42
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
43
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
44
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Accept');
|
|
45
|
+
res.setHeader('Access-Control-Expose-Headers', 'X-Transport-Id');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create health check handler
|
|
49
|
+
*/
|
|
50
|
+
function createHealthHandler(projectRoot) {
|
|
51
|
+
return function handleHealthCheck(res) {
|
|
52
|
+
setCorsHeaders(res);
|
|
53
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
54
|
+
res.end(JSON.stringify({
|
|
55
|
+
status: 'healthy',
|
|
56
|
+
service: 'drift-mcp',
|
|
57
|
+
version: SERVER_VERSION,
|
|
58
|
+
projectRoot,
|
|
59
|
+
activeConnections: activeTransports.size,
|
|
60
|
+
timestamp: new Date().toISOString(),
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create SSE connection handler
|
|
66
|
+
*/
|
|
67
|
+
function createSSEHandler(mcpServer, verbose) {
|
|
68
|
+
return async function handleSSE(req, res) {
|
|
69
|
+
const transportId = `transport-${++transportIdCounter}`;
|
|
70
|
+
if (verbose) {
|
|
71
|
+
console.error(`[drift-mcp-http] New SSE connection: ${transportId}`);
|
|
72
|
+
}
|
|
73
|
+
setCorsHeaders(res);
|
|
74
|
+
// Create SSE transport
|
|
75
|
+
const transport = new SSEServerTransport('/message', res);
|
|
76
|
+
activeTransports.set(transportId, transport);
|
|
77
|
+
// Add transport ID header so client knows which ID to use for messages
|
|
78
|
+
res.setHeader('X-Transport-Id', transportId);
|
|
79
|
+
// Clean up on disconnect
|
|
80
|
+
req.on('close', () => {
|
|
81
|
+
if (verbose) {
|
|
82
|
+
console.error(`[drift-mcp-http] SSE connection closed: ${transportId}`);
|
|
83
|
+
}
|
|
84
|
+
activeTransports.delete(transportId);
|
|
85
|
+
});
|
|
86
|
+
// Connect to MCP server
|
|
87
|
+
try {
|
|
88
|
+
await mcpServer.connect(transport);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.error(`[drift-mcp-http] Failed to connect transport ${transportId}:`, error);
|
|
92
|
+
activeTransports.delete(transportId);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Handle message POST requests
|
|
98
|
+
*/
|
|
99
|
+
async function handleMessage(req, res) {
|
|
100
|
+
setCorsHeaders(res);
|
|
101
|
+
// Read body
|
|
102
|
+
let body = '';
|
|
103
|
+
for await (const chunk of req) {
|
|
104
|
+
body += chunk;
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
// Find the transport to use
|
|
108
|
+
// The transport ID can be passed in the URL or we use the most recent one
|
|
109
|
+
const url = new URL(req.url ?? '/', `http://${req.headers.host}`);
|
|
110
|
+
const transportId = url.searchParams.get('transportId');
|
|
111
|
+
let transport;
|
|
112
|
+
if (transportId) {
|
|
113
|
+
transport = activeTransports.get(transportId);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// Use the most recent transport
|
|
117
|
+
const entries = Array.from(activeTransports.entries());
|
|
118
|
+
const lastEntry = entries[entries.length - 1];
|
|
119
|
+
if (lastEntry) {
|
|
120
|
+
transport = lastEntry[1];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!transport) {
|
|
124
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
125
|
+
res.end(JSON.stringify({
|
|
126
|
+
error: 'No active SSE connection',
|
|
127
|
+
hint: 'Connect to /sse first before sending messages',
|
|
128
|
+
}));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Parse and forward the message
|
|
132
|
+
const message = JSON.parse(body);
|
|
133
|
+
await transport.handlePostMessage(req, res, message);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error('[drift-mcp-http] Message handling error:', error);
|
|
137
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
138
|
+
res.end(JSON.stringify({
|
|
139
|
+
error: 'Internal server error',
|
|
140
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create request router
|
|
146
|
+
*/
|
|
147
|
+
function createRequestHandler(handleHealthCheck, handleSSE, projectRoot) {
|
|
148
|
+
return async function handleRequest(req, res) {
|
|
149
|
+
const url = new URL(req.url ?? '/', `http://${req.headers.host}`);
|
|
150
|
+
const pathname = url.pathname;
|
|
151
|
+
const method = req.method?.toUpperCase();
|
|
152
|
+
// Handle CORS preflight
|
|
153
|
+
if (method === 'OPTIONS') {
|
|
154
|
+
setCorsHeaders(res);
|
|
155
|
+
res.writeHead(204);
|
|
156
|
+
res.end();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// Route requests
|
|
160
|
+
switch (pathname) {
|
|
161
|
+
case '/health':
|
|
162
|
+
handleHealthCheck(res);
|
|
163
|
+
break;
|
|
164
|
+
case '/sse':
|
|
165
|
+
if (method === 'GET') {
|
|
166
|
+
await handleSSE(req, res);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
170
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
case '/message':
|
|
174
|
+
if (method === 'POST') {
|
|
175
|
+
await handleMessage(req, res);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
179
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
default:
|
|
183
|
+
// Root endpoint - provide API info
|
|
184
|
+
if (pathname === '/' && method === 'GET') {
|
|
185
|
+
setCorsHeaders(res);
|
|
186
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
187
|
+
res.end(JSON.stringify({
|
|
188
|
+
name: 'Drift MCP Server',
|
|
189
|
+
version: SERVER_VERSION,
|
|
190
|
+
description: 'MCP server for codebase intelligence',
|
|
191
|
+
endpoints: {
|
|
192
|
+
'/health': 'Health check endpoint (GET)',
|
|
193
|
+
'/sse': 'SSE endpoint for MCP communication (GET)',
|
|
194
|
+
'/message': 'Send messages to MCP server (POST)',
|
|
195
|
+
},
|
|
196
|
+
projectRoot,
|
|
197
|
+
documentation: 'https://github.com/dadbodgeoff/drift',
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
202
|
+
res.end(JSON.stringify({ error: 'Not found' }));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Create graceful shutdown handler
|
|
209
|
+
*/
|
|
210
|
+
function createShutdownHandler(mcpServer, httpServer, verbose) {
|
|
211
|
+
return async function shutdown() {
|
|
212
|
+
console.error('[drift-mcp-http] Shutting down...');
|
|
213
|
+
// Close all SSE connections
|
|
214
|
+
for (const [transportId] of activeTransports) {
|
|
215
|
+
if (verbose) {
|
|
216
|
+
console.error(`[drift-mcp-http] Closing transport: ${transportId}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
activeTransports.clear();
|
|
220
|
+
// Close MCP server
|
|
221
|
+
await mcpServer.close();
|
|
222
|
+
// Close HTTP server
|
|
223
|
+
httpServer.close(() => {
|
|
224
|
+
console.error('[drift-mcp-http] Server stopped');
|
|
225
|
+
process.exit(0);
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
async function main() {
|
|
230
|
+
// Configuration from environment variables
|
|
231
|
+
const envPort = parseInt(process.env['PORT'] ?? '3000', 10);
|
|
232
|
+
const envProjectRoot = process.env['PROJECT_ROOT'] ?? '/project';
|
|
233
|
+
const enableCache = process.env['ENABLE_CACHE'] !== 'false';
|
|
234
|
+
const enableRateLimit = process.env['ENABLE_RATE_LIMIT'] !== 'false';
|
|
235
|
+
const verbose = process.env['VERBOSE'] === 'true';
|
|
236
|
+
const skipWarmup = process.env['SKIP_WARMUP'] === 'true';
|
|
237
|
+
// Parse command line arguments (override env vars)
|
|
238
|
+
const args = process.argv.slice(2);
|
|
239
|
+
let port = envPort;
|
|
240
|
+
let projectRoot = envProjectRoot;
|
|
241
|
+
for (let i = 0; i < args.length; i++) {
|
|
242
|
+
const arg = args[i];
|
|
243
|
+
const nextArg = args[i + 1];
|
|
244
|
+
if (arg === '--port' && nextArg) {
|
|
245
|
+
port = parseInt(nextArg, 10);
|
|
246
|
+
i++;
|
|
247
|
+
}
|
|
248
|
+
else if (arg === '--project' && nextArg) {
|
|
249
|
+
projectRoot = nextArg;
|
|
250
|
+
i++;
|
|
251
|
+
}
|
|
252
|
+
else if (arg === '--verbose' || arg === '-v') {
|
|
253
|
+
// Allow --verbose flag like the stdio server
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (verbose) {
|
|
257
|
+
console.error(`[drift-mcp-http] Starting server for: ${projectRoot}`);
|
|
258
|
+
}
|
|
259
|
+
// Create MCP server instance
|
|
260
|
+
const mcpServer = createEnterpriseMCPServer({
|
|
261
|
+
projectRoot,
|
|
262
|
+
enableCache,
|
|
263
|
+
enableRateLimiting: enableRateLimit,
|
|
264
|
+
enableMetrics: true,
|
|
265
|
+
verbose,
|
|
266
|
+
skipWarmup,
|
|
267
|
+
});
|
|
268
|
+
// Create handlers
|
|
269
|
+
const handleHealthCheck = createHealthHandler(projectRoot);
|
|
270
|
+
const handleSSE = createSSEHandler(mcpServer, verbose);
|
|
271
|
+
const handleRequest = createRequestHandler(handleHealthCheck, handleSSE, projectRoot);
|
|
272
|
+
// Create HTTP server
|
|
273
|
+
const httpServer = createServer(async (req, res) => {
|
|
274
|
+
try {
|
|
275
|
+
await handleRequest(req, res);
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.error('[drift-mcp-http] Request error:', error);
|
|
279
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
280
|
+
res.end(JSON.stringify({ error: 'Internal server error' }));
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
// Setup graceful shutdown
|
|
284
|
+
const shutdown = createShutdownHandler(mcpServer, httpServer, verbose);
|
|
285
|
+
process.on('SIGINT', shutdown);
|
|
286
|
+
process.on('SIGTERM', shutdown);
|
|
287
|
+
// Start server
|
|
288
|
+
httpServer.listen(port, '0.0.0.0', () => {
|
|
289
|
+
console.error(`[drift-mcp-http] Server running at http://0.0.0.0:${port}`);
|
|
290
|
+
console.error(`[drift-mcp-http] Project root: ${projectRoot}`);
|
|
291
|
+
console.error(`[drift-mcp-http] Cache: ${enableCache ? 'enabled' : 'disabled'}`);
|
|
292
|
+
console.error(`[drift-mcp-http] Rate limiting: ${enableRateLimit ? 'enabled' : 'disabled'}`);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
main().catch((error) => {
|
|
296
|
+
console.error('Failed to start Drift MCP HTTP server:', error);
|
|
297
|
+
process.exit(1);
|
|
298
|
+
});
|
|
299
|
+
//# sourceMappingURL=http-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-server.js","sourceRoot":"","sources":["../../src/bin/http-server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAwE,MAAM,MAAM,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAe,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,sCAAsC;AACtC,MAAM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|
|
|
1
1
|
{
|
|
2
2
|
"name": "driftdetect-mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "MCP server that gives AI agents (Claude, Cursor, Copilot) deep understanding of your codebase patterns, conventions, and architecture. Query patterns, security boundaries, call graphs in real-time.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Geoffrey Fernald",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"main": "./dist/index.js",
|
|
36
36
|
"types": "./dist/index.d.ts",
|
|
37
37
|
"bin": {
|
|
38
|
-
"drift-mcp": "./dist/bin/server.js"
|
|
38
|
+
"drift-mcp": "./dist/bin/server.js",
|
|
39
|
+
"drift-mcp-http": "./dist/bin/http-server.js"
|
|
39
40
|
},
|
|
40
41
|
"exports": {
|
|
41
42
|
".": {
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
],
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
51
|
-
"driftdetect-core": "0.9.
|
|
52
|
-
"driftdetect-detectors": "0.9.
|
|
52
|
+
"driftdetect-core": "0.9.6",
|
|
53
|
+
"driftdetect-detectors": "0.9.6"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@types/node": "^20.10.0",
|