debugger-mcp-server 0.1.6 → 0.1.8
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.
- package/README.md +0 -1
- package/dist/bridge/bridgeTypes.d.ts +0 -9
- package/dist/tools/toolRegistry.js +0 -2
- package/dist/tools/toolRegistry.js.map +1 -1
- package/package.json +1 -3
- package/src/bridge/bridgeTypes.ts +0 -10
- package/src/tools/toolRegistry.ts +0 -2
- package/dist/server.d.ts +0 -2
- package/dist/server.js +0 -124
- package/dist/server.js.map +0 -1
- package/dist/tools/analysis/analyzeCode.d.ts +0 -4
- package/dist/tools/analysis/analyzeCode.js +0 -26
- package/dist/tools/analysis/analyzeCode.js.map +0 -1
- package/src/server.ts +0 -143
- package/src/tools/analysis/analyzeCode.ts +0 -33
package/README.md
CHANGED
|
@@ -24,7 +24,6 @@ The package is available on [npm](https://www.npmjs.com/package/debugger-mcp-ser
|
|
|
24
24
|
|
|
25
25
|
| Category | Tool | Description |
|
|
26
26
|
|---|---|---|
|
|
27
|
-
| Analysis | `analyzeCode` | Analyze code with the VS Code language server |
|
|
28
27
|
| Breakpoints | `setBreakpoints` | Set breakpoints in a file |
|
|
29
28
|
| Breakpoints | `removeBreakpoints` | Remove breakpoints |
|
|
30
29
|
| Breakpoints | `listBreakpoints` | List all active breakpoints |
|
|
@@ -29,15 +29,6 @@ export interface RemoveBreakpointsResponse {
|
|
|
29
29
|
export interface ListBreakpointsResponse {
|
|
30
30
|
breakpoints: BreakpointInfo[];
|
|
31
31
|
}
|
|
32
|
-
export interface AnalyzeCodeResponse {
|
|
33
|
-
locations: Array<{
|
|
34
|
-
filePath: string;
|
|
35
|
-
lineNumber: number;
|
|
36
|
-
codeSnippet: string;
|
|
37
|
-
reason: string;
|
|
38
|
-
}>;
|
|
39
|
-
summary: string;
|
|
40
|
-
}
|
|
41
32
|
export interface StartDebugSessionResponse {
|
|
42
33
|
sessionId: string;
|
|
43
34
|
name: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { registerAnalyzeCodeTool } from "./analysis/analyzeCode.js";
|
|
2
1
|
import { registerSetBreakpointsTool } from "./breakpoints/setBreakpoints.js";
|
|
3
2
|
import { registerRemoveBreakpointsTool } from "./breakpoints/removeBreakpoints.js";
|
|
4
3
|
import { registerListBreakpointsTool } from "./breakpoints/listBreakpoints.js";
|
|
@@ -12,7 +11,6 @@ import { registerGetVariablesTool } from "./debugSession/getVariables.js";
|
|
|
12
11
|
import { registerGetCallStackTool } from "./debugSession/getCallStack.js";
|
|
13
12
|
import { registerEvaluateExpressionTool } from "./debugSession/evaluateExpression.js";
|
|
14
13
|
export const registerAllTools = (params) => {
|
|
15
|
-
registerAnalyzeCodeTool(params);
|
|
16
14
|
registerSetBreakpointsTool(params);
|
|
17
15
|
registerRemoveBreakpointsTool(params);
|
|
18
16
|
registerListBreakpointsTool(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAA6B,EAAQ,EAAE;IACtE,0BAA0B,CAAC,MAAM,CAAC,CAAC;IACnC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACrC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,8BAA8B,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debugger-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "MCP server for VS Code debugging via bridge extension",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
17
|
-
"express": "^4.21.0",
|
|
18
17
|
"zod": "^3.24.0"
|
|
19
18
|
},
|
|
20
19
|
"devDependencies": {
|
|
21
|
-
"@types/express": "^5.0.0",
|
|
22
20
|
"@types/node": "^22.0.0",
|
|
23
21
|
"tsx": "^4.0.0",
|
|
24
22
|
"typescript": "^5.7.0"
|
|
@@ -32,16 +32,6 @@ export interface ListBreakpointsResponse {
|
|
|
32
32
|
breakpoints: BreakpointInfo[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export interface AnalyzeCodeResponse {
|
|
36
|
-
locations: Array<{
|
|
37
|
-
filePath: string;
|
|
38
|
-
lineNumber: number;
|
|
39
|
-
codeSnippet: string;
|
|
40
|
-
reason: string;
|
|
41
|
-
}>;
|
|
42
|
-
summary: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
35
|
export interface StartDebugSessionResponse {
|
|
46
36
|
sessionId: string;
|
|
47
37
|
name: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { registerAnalyzeCodeTool } from "./analysis/analyzeCode.js";
|
|
3
2
|
import { registerSetBreakpointsTool } from "./breakpoints/setBreakpoints.js";
|
|
4
3
|
import { registerRemoveBreakpointsTool } from "./breakpoints/removeBreakpoints.js";
|
|
5
4
|
import { registerListBreakpointsTool } from "./breakpoints/listBreakpoints.js";
|
|
@@ -14,7 +13,6 @@ import { registerGetCallStackTool } from "./debugSession/getCallStack.js";
|
|
|
14
13
|
import { registerEvaluateExpressionTool } from "./debugSession/evaluateExpression.js";
|
|
15
14
|
|
|
16
15
|
export const registerAllTools = (params: { server: McpServer }): void => {
|
|
17
|
-
registerAnalyzeCodeTool(params);
|
|
18
16
|
registerSetBreakpointsTool(params);
|
|
19
17
|
registerRemoveBreakpointsTool(params);
|
|
20
18
|
registerListBreakpointsTool(params);
|
package/dist/server.d.ts
DELETED
package/dist/server.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
3
|
-
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
-
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
import { randomUUID } from "crypto";
|
|
6
|
-
import express from "express";
|
|
7
|
-
import { registerAllTools } from "./tools/toolRegistry.js";
|
|
8
|
-
const createConnectedServer = () => {
|
|
9
|
-
const server = new McpServer({
|
|
10
|
-
name: "debugger-mcp-server",
|
|
11
|
-
version: "0.1.0",
|
|
12
|
-
});
|
|
13
|
-
registerAllTools({ server });
|
|
14
|
-
return server;
|
|
15
|
-
};
|
|
16
|
-
export const createApp = () => {
|
|
17
|
-
const app = express();
|
|
18
|
-
app.use(express.json());
|
|
19
|
-
const transports = new Map();
|
|
20
|
-
// ==========================================================================
|
|
21
|
-
// Streamable HTTP transport (protocol version 2025-11-25)
|
|
22
|
-
// ==========================================================================
|
|
23
|
-
app.post("/mcp", async (req, res) => {
|
|
24
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
25
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
26
|
-
const existingTransport = transports.get(sessionId);
|
|
27
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
28
|
-
res.status(400).json({
|
|
29
|
-
jsonrpc: "2.0",
|
|
30
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
31
|
-
id: null,
|
|
32
|
-
});
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
await existingTransport.handleRequest(req, res, req.body);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (isInitializeRequest(req.body)) {
|
|
39
|
-
const transport = new StreamableHTTPServerTransport({
|
|
40
|
-
sessionIdGenerator: () => randomUUID(),
|
|
41
|
-
onsessioninitialized: (newSessionId) => {
|
|
42
|
-
transports.set(newSessionId, transport);
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
transport.onclose = () => {
|
|
46
|
-
const transportSessionId = transport.sessionId;
|
|
47
|
-
if (transportSessionId !== undefined) {
|
|
48
|
-
transports.delete(transportSessionId);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const server = createConnectedServer();
|
|
52
|
-
await server.connect(transport);
|
|
53
|
-
await transport.handleRequest(req, res, req.body);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
res.status(400).json({ error: "Invalid request. Missing session ID or not an initialize request." });
|
|
57
|
-
});
|
|
58
|
-
app.get("/mcp", async (req, res) => {
|
|
59
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
60
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
61
|
-
const existingTransport = transports.get(sessionId);
|
|
62
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
63
|
-
res.status(400).json({
|
|
64
|
-
jsonrpc: "2.0",
|
|
65
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
66
|
-
id: null,
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
await existingTransport.handleRequest(req, res);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
res.status(400).json({ error: "Invalid session." });
|
|
74
|
-
});
|
|
75
|
-
app.delete("/mcp", async (req, res) => {
|
|
76
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
77
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
78
|
-
const existingTransport = transports.get(sessionId);
|
|
79
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
80
|
-
res.status(400).json({
|
|
81
|
-
jsonrpc: "2.0",
|
|
82
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
83
|
-
id: null,
|
|
84
|
-
});
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
await existingTransport.handleRequest(req, res);
|
|
88
|
-
transports.delete(sessionId);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
res.status(400).json({ error: "Invalid session." });
|
|
92
|
-
});
|
|
93
|
-
// ==========================================================================
|
|
94
|
-
// Legacy SSE transport (protocol version 2024-11-05)
|
|
95
|
-
// ==========================================================================
|
|
96
|
-
app.get("/sse", async (_req, res) => {
|
|
97
|
-
const transport = new SSEServerTransport("/messages", res);
|
|
98
|
-
transports.set(transport.sessionId, transport);
|
|
99
|
-
res.on("close", () => {
|
|
100
|
-
transports.delete(transport.sessionId);
|
|
101
|
-
});
|
|
102
|
-
const server = createConnectedServer();
|
|
103
|
-
await server.connect(transport);
|
|
104
|
-
});
|
|
105
|
-
app.post("/messages", async (req, res) => {
|
|
106
|
-
const sessionId = req.query.sessionId;
|
|
107
|
-
if (sessionId === undefined) {
|
|
108
|
-
res.status(400).json({ error: "Missing sessionId query parameter." });
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const existingTransport = transports.get(sessionId);
|
|
112
|
-
if (!(existingTransport instanceof SSEServerTransport)) {
|
|
113
|
-
res.status(400).json({
|
|
114
|
-
jsonrpc: "2.0",
|
|
115
|
-
error: { code: -32000, message: "No SSE transport found for this session." },
|
|
116
|
-
id: null,
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
await existingTransport.handlePostMessage(req, res, req.body);
|
|
121
|
-
});
|
|
122
|
-
return app;
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,qB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AAC;QAED,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
3
|
-
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
4
|
-
const ANALYZE_CODE_TIMEOUT_MS = 120000;
|
|
5
|
-
export const registerAnalyzeCodeTool = (params) => {
|
|
6
|
-
params.server.tool("analyze_code", "Analyze codebase to find relevant code locations for debugging a feature. Uses AI to explore and identify entry points, core logic, and key functions.", {
|
|
7
|
-
featureDescription: z.string().describe("Description of the feature or code area to analyze"),
|
|
8
|
-
workspacePath: z.string().describe("Absolute path to the workspace root"),
|
|
9
|
-
}, async (args) => {
|
|
10
|
-
try {
|
|
11
|
-
const result = await sendBridgeCommand({
|
|
12
|
-
command: "analyzeCode",
|
|
13
|
-
args: {
|
|
14
|
-
featureDescription: args.featureDescription,
|
|
15
|
-
workspacePath: args.workspacePath,
|
|
16
|
-
},
|
|
17
|
-
timeoutMs: ANALYZE_CODE_TIMEOUT_MS,
|
|
18
|
-
});
|
|
19
|
-
return { content: [{ type: "text", text: formatToolResult({ data: result }) }] };
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
return { content: [{ type: "text", text: formatErrorResult({ error }) }], isError: true };
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=analyzeCode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeCode.js","sourceRoot":"","sources":["../../../src/tools/analysis/analyzeCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB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EServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
3
|
-
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
-
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
import { randomUUID } from "crypto";
|
|
6
|
-
import express from "express";
|
|
7
|
-
import { registerAllTools } from "./tools/toolRegistry.js";
|
|
8
|
-
|
|
9
|
-
const createConnectedServer = (): McpServer => {
|
|
10
|
-
const server = new McpServer({
|
|
11
|
-
name: "debugger-mcp-server",
|
|
12
|
-
version: "0.1.0",
|
|
13
|
-
});
|
|
14
|
-
registerAllTools({ server });
|
|
15
|
-
return server;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const createApp = (): express.Express => {
|
|
19
|
-
const app = express();
|
|
20
|
-
app.use(express.json());
|
|
21
|
-
|
|
22
|
-
const transports = new Map<string, StreamableHTTPServerTransport | SSEServerTransport>();
|
|
23
|
-
|
|
24
|
-
// ==========================================================================
|
|
25
|
-
// Streamable HTTP transport (protocol version 2025-11-25)
|
|
26
|
-
// ==========================================================================
|
|
27
|
-
|
|
28
|
-
app.post("/mcp", async (req, res) => {
|
|
29
|
-
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
|
30
|
-
|
|
31
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
32
|
-
const existingTransport = transports.get(sessionId) as NonNullable<ReturnType<typeof transports.get>>;
|
|
33
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
34
|
-
res.status(400).json({
|
|
35
|
-
jsonrpc: "2.0",
|
|
36
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
37
|
-
id: null,
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
await existingTransport.handleRequest(req, res, req.body);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (isInitializeRequest(req.body)) {
|
|
46
|
-
const transport = new StreamableHTTPServerTransport({
|
|
47
|
-
sessionIdGenerator: () => randomUUID(),
|
|
48
|
-
onsessioninitialized: (newSessionId) => {
|
|
49
|
-
transports.set(newSessionId, transport);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
transport.onclose = () => {
|
|
54
|
-
const transportSessionId = transport.sessionId;
|
|
55
|
-
if (transportSessionId !== undefined) {
|
|
56
|
-
transports.delete(transportSessionId);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const server = createConnectedServer();
|
|
61
|
-
await server.connect(transport);
|
|
62
|
-
await transport.handleRequest(req, res, req.body);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
res.status(400).json({ error: "Invalid request. Missing session ID or not an initialize request." });
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
app.get("/mcp", async (req, res) => {
|
|
70
|
-
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
|
71
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
72
|
-
const existingTransport = transports.get(sessionId) as NonNullable<ReturnType<typeof transports.get>>;
|
|
73
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
74
|
-
res.status(400).json({
|
|
75
|
-
jsonrpc: "2.0",
|
|
76
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
77
|
-
id: null,
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
await existingTransport.handleRequest(req, res);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
res.status(400).json({ error: "Invalid session." });
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
app.delete("/mcp", async (req, res) => {
|
|
88
|
-
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
|
89
|
-
if (sessionId !== undefined && transports.has(sessionId)) {
|
|
90
|
-
const existingTransport = transports.get(sessionId) as NonNullable<ReturnType<typeof transports.get>>;
|
|
91
|
-
if (existingTransport instanceof SSEServerTransport) {
|
|
92
|
-
res.status(400).json({
|
|
93
|
-
jsonrpc: "2.0",
|
|
94
|
-
error: { code: -32000, message: "Session uses a different transport protocol." },
|
|
95
|
-
id: null,
|
|
96
|
-
});
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
await existingTransport.handleRequest(req, res);
|
|
100
|
-
transports.delete(sessionId);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
res.status(400).json({ error: "Invalid session." });
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// ==========================================================================
|
|
107
|
-
// Legacy SSE transport (protocol version 2024-11-05)
|
|
108
|
-
// ==========================================================================
|
|
109
|
-
|
|
110
|
-
app.get("/sse", async (_req, res) => {
|
|
111
|
-
const transport = new SSEServerTransport("/messages", res);
|
|
112
|
-
transports.set(transport.sessionId, transport);
|
|
113
|
-
|
|
114
|
-
res.on("close", () => {
|
|
115
|
-
transports.delete(transport.sessionId);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const server = createConnectedServer();
|
|
119
|
-
await server.connect(transport);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
app.post("/messages", async (req, res) => {
|
|
123
|
-
const sessionId = req.query.sessionId as string | undefined;
|
|
124
|
-
if (sessionId === undefined) {
|
|
125
|
-
res.status(400).json({ error: "Missing sessionId query parameter." });
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const existingTransport = transports.get(sessionId);
|
|
130
|
-
if (!(existingTransport instanceof SSEServerTransport)) {
|
|
131
|
-
res.status(400).json({
|
|
132
|
-
jsonrpc: "2.0",
|
|
133
|
-
error: { code: -32000, message: "No SSE transport found for this session." },
|
|
134
|
-
id: null,
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
await existingTransport.handlePostMessage(req, res, req.body);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
return app;
|
|
143
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { sendBridgeCommand } from "../../bridge/bridgeClient.js";
|
|
4
|
-
import { formatToolResult, formatErrorResult } from "../toolTypes.js";
|
|
5
|
-
import type { AnalyzeCodeResponse } from "../../bridge/bridgeTypes.js";
|
|
6
|
-
|
|
7
|
-
const ANALYZE_CODE_TIMEOUT_MS = 120000;
|
|
8
|
-
|
|
9
|
-
export const registerAnalyzeCodeTool = (params: { server: McpServer }): void => {
|
|
10
|
-
params.server.tool(
|
|
11
|
-
"analyze_code",
|
|
12
|
-
"Analyze codebase to find relevant code locations for debugging a feature. Uses AI to explore and identify entry points, core logic, and key functions.",
|
|
13
|
-
{
|
|
14
|
-
featureDescription: z.string().describe("Description of the feature or code area to analyze"),
|
|
15
|
-
workspacePath: z.string().describe("Absolute path to the workspace root"),
|
|
16
|
-
},
|
|
17
|
-
async (args) => {
|
|
18
|
-
try {
|
|
19
|
-
const result = await sendBridgeCommand<AnalyzeCodeResponse>({
|
|
20
|
-
command: "analyzeCode",
|
|
21
|
-
args: {
|
|
22
|
-
featureDescription: args.featureDescription,
|
|
23
|
-
workspacePath: args.workspacePath,
|
|
24
|
-
},
|
|
25
|
-
timeoutMs: ANALYZE_CODE_TIMEOUT_MS,
|
|
26
|
-
});
|
|
27
|
-
return { content: [{ type: "text" as const, text: formatToolResult({ data: result }) }] };
|
|
28
|
-
} catch (error) {
|
|
29
|
-
return { content: [{ type: "text" as const, text: formatErrorResult({ error }) }], isError: true };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
};
|