dap-mcp-server 0.1.5
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/.claude/settings.local.json +31 -0
- package/.forgejo/workflows/publish.yml +63 -0
- package/CLAUDE.md +71 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/SKILL.md +62 -0
- package/build/adapters/builtin.d.ts +24 -0
- package/build/adapters/builtin.js +46 -0
- package/build/adapters/builtin.js.map +1 -0
- package/build/adapters/detect.d.ts +23 -0
- package/build/adapters/detect.js +36 -0
- package/build/adapters/detect.js.map +1 -0
- package/build/adapters/registry.d.ts +39 -0
- package/build/adapters/registry.js +79 -0
- package/build/adapters/registry.js.map +1 -0
- package/build/dap/dap-client.d.ts +46 -0
- package/build/dap/dap-client.js +190 -0
- package/build/dap/dap-client.js.map +1 -0
- package/build/dap/protocol.d.ts +32 -0
- package/build/dap/protocol.js +71 -0
- package/build/dap/protocol.js.map +1 -0
- package/build/dap/ring-buffer.d.ts +35 -0
- package/build/dap/ring-buffer.js +57 -0
- package/build/dap/ring-buffer.js.map +1 -0
- package/build/dap/types.d.ts +87 -0
- package/build/dap/types.js +25 -0
- package/build/dap/types.js.map +1 -0
- package/build/index.d.ts +24 -0
- package/build/index.js +30 -0
- package/build/index.js.map +1 -0
- package/build/server.d.ts +24 -0
- package/build/server.js +735 -0
- package/build/server.js.map +1 -0
- package/build/session/session-manager.d.ts +32 -0
- package/build/session/session-manager.js +60 -0
- package/build/session/session-manager.js.map +1 -0
- package/build/session/session.d.ts +85 -0
- package/build/session/session.js +374 -0
- package/build/session/session.js.map +1 -0
- package/docs/plans/2026-03-05-dap-wrapper-mcp-design.md +326 -0
- package/docs/plans/2026-03-05-dap-wrapper-mcp-implementation.md +2815 -0
- package/package.json +43 -0
- package/src/adapters/builtin.ts +47 -0
- package/src/adapters/detect.test.ts +36 -0
- package/src/adapters/detect.ts +36 -0
- package/src/adapters/registry.test.ts +73 -0
- package/src/adapters/registry.ts +86 -0
- package/src/dap/dap-client.test.ts +87 -0
- package/src/dap/dap-client.ts +216 -0
- package/src/dap/protocol.test.ts +82 -0
- package/src/dap/protocol.ts +78 -0
- package/src/dap/ring-buffer.test.ts +82 -0
- package/src/dap/ring-buffer.ts +64 -0
- package/src/dap/types.ts +92 -0
- package/src/index.ts +30 -0
- package/src/integration/debug-lifecycle.test.ts +107 -0
- package/src/server.ts +866 -0
- package/src/session/session-manager.test.ts +74 -0
- package/src/session/session-manager.ts +67 -0
- package/src/session/session.test.ts +84 -0
- package/src/session/session.ts +435 -0
- package/src/test-fixtures/crash-adapter.js +23 -0
- package/src/test-fixtures/mock-adapter.js +142 -0
- package/src/test-fixtures/silent-adapter.js +24 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { EventEmitter } from "node:events";
|
|
24
|
+
import { DebugProtocol } from "@vscode/debugprotocol";
|
|
25
|
+
export declare class DAPClientError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class DAPClient extends EventEmitter {
|
|
29
|
+
private runtime;
|
|
30
|
+
private executable;
|
|
31
|
+
private args;
|
|
32
|
+
private process?;
|
|
33
|
+
private parser?;
|
|
34
|
+
private seq;
|
|
35
|
+
private pending;
|
|
36
|
+
private stderrOutput;
|
|
37
|
+
private _exited;
|
|
38
|
+
private _exitCode?;
|
|
39
|
+
constructor(runtime: string, executable: string, args?: string[]);
|
|
40
|
+
spawn(): Promise<void>;
|
|
41
|
+
sendRequest(command: string, args?: Record<string, unknown>, timeout?: number): Promise<DebugProtocol.Response>;
|
|
42
|
+
private handleMessage;
|
|
43
|
+
get exited(): boolean;
|
|
44
|
+
get stderr(): string;
|
|
45
|
+
dispose(): Promise<void>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { spawn } from "node:child_process";
|
|
24
|
+
import { EventEmitter } from "node:events";
|
|
25
|
+
import { encodeMessage, MessageParser } from "./protocol.js";
|
|
26
|
+
export class DAPClientError extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "DAPClientError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class DAPClient extends EventEmitter {
|
|
33
|
+
runtime;
|
|
34
|
+
executable;
|
|
35
|
+
args;
|
|
36
|
+
process;
|
|
37
|
+
parser;
|
|
38
|
+
seq = 1;
|
|
39
|
+
pending = new Map();
|
|
40
|
+
stderrOutput = [];
|
|
41
|
+
_exited = false;
|
|
42
|
+
_exitCode;
|
|
43
|
+
constructor(runtime, executable, args = []) {
|
|
44
|
+
super();
|
|
45
|
+
this.runtime = runtime;
|
|
46
|
+
this.executable = executable;
|
|
47
|
+
this.args = args;
|
|
48
|
+
}
|
|
49
|
+
async spawn() {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
const runtimeArgs = this.runtime
|
|
52
|
+
? [this.executable, ...this.args]
|
|
53
|
+
: this.args;
|
|
54
|
+
const cmd = this.runtime || this.executable;
|
|
55
|
+
this.process = spawn(cmd, runtimeArgs, {
|
|
56
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
57
|
+
});
|
|
58
|
+
this.parser = new MessageParser((msg) => this.handleMessage(msg));
|
|
59
|
+
this.process.stdout.on("data", (data) => {
|
|
60
|
+
this.parser.feed(data);
|
|
61
|
+
});
|
|
62
|
+
this.process.stderr.on("data", (data) => {
|
|
63
|
+
this.stderrOutput.push(data.toString());
|
|
64
|
+
});
|
|
65
|
+
// Suppress EPIPE and other stream errors on stdin; the exit handler handles cleanup
|
|
66
|
+
this.process.stdin.on("error", () => {
|
|
67
|
+
// ignore — exit event will reject pending requests
|
|
68
|
+
});
|
|
69
|
+
this.process.on("error", (err) => {
|
|
70
|
+
reject(new DAPClientError(`Failed to spawn adapter: ${err.message}`));
|
|
71
|
+
});
|
|
72
|
+
this.process.on("exit", (code, signal) => {
|
|
73
|
+
this._exited = true;
|
|
74
|
+
this._exitCode = code ?? undefined;
|
|
75
|
+
for (const [, req] of this.pending) {
|
|
76
|
+
if (req.timer)
|
|
77
|
+
clearTimeout(req.timer);
|
|
78
|
+
req.reject(new DAPClientError(`Adapter exited (code=${code}, signal=${signal}). stderr: ${this.stderrOutput.join("")}`));
|
|
79
|
+
}
|
|
80
|
+
this.pending.clear();
|
|
81
|
+
this.emit("exit", code, signal);
|
|
82
|
+
});
|
|
83
|
+
// Resolve once the process is spawned (use flag to prevent double-resolve)
|
|
84
|
+
let resolved = false;
|
|
85
|
+
this.process.stdout.once("readable", () => {
|
|
86
|
+
if (!resolved) {
|
|
87
|
+
resolved = true;
|
|
88
|
+
resolve();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
if (!resolved) {
|
|
93
|
+
resolved = true;
|
|
94
|
+
resolve();
|
|
95
|
+
}
|
|
96
|
+
}, 100);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async sendRequest(command, args, timeout = 10000) {
|
|
100
|
+
if (this._exited) {
|
|
101
|
+
throw new DAPClientError(`Adapter has exited (code=${this._exitCode}). stderr: ${this.stderrOutput.join("")}`);
|
|
102
|
+
}
|
|
103
|
+
if (!this.process?.stdin?.writable) {
|
|
104
|
+
throw new DAPClientError("Adapter stdin is not writable");
|
|
105
|
+
}
|
|
106
|
+
const seq = this.seq++;
|
|
107
|
+
const request = {
|
|
108
|
+
seq,
|
|
109
|
+
type: "request",
|
|
110
|
+
command,
|
|
111
|
+
arguments: args,
|
|
112
|
+
};
|
|
113
|
+
return new Promise((resolve, reject) => {
|
|
114
|
+
const pending = { resolve, reject };
|
|
115
|
+
if (timeout > 0) {
|
|
116
|
+
pending.timer = setTimeout(() => {
|
|
117
|
+
this.pending.delete(seq);
|
|
118
|
+
reject(new DAPClientError(`Request '${command}' timeout after ${timeout}ms`));
|
|
119
|
+
}, timeout);
|
|
120
|
+
}
|
|
121
|
+
this.pending.set(seq, pending);
|
|
122
|
+
try {
|
|
123
|
+
this.process.stdin.write(encodeMessage(request), (err) => {
|
|
124
|
+
if (err) {
|
|
125
|
+
// Write failed (e.g. EPIPE); clean up and reject
|
|
126
|
+
const p = this.pending.get(seq);
|
|
127
|
+
if (p) {
|
|
128
|
+
if (p.timer)
|
|
129
|
+
clearTimeout(p.timer);
|
|
130
|
+
this.pending.delete(seq);
|
|
131
|
+
p.reject(new DAPClientError(`Write to adapter failed: ${err.message}`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
this.pending.delete(seq);
|
|
138
|
+
if (pending.timer)
|
|
139
|
+
clearTimeout(pending.timer);
|
|
140
|
+
reject(new DAPClientError(`Write to adapter failed: ${err.message}`));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
handleMessage(msg) {
|
|
145
|
+
if (msg.type === "response") {
|
|
146
|
+
const response = msg;
|
|
147
|
+
const pending = this.pending.get(response.request_seq);
|
|
148
|
+
if (pending) {
|
|
149
|
+
if (pending.timer)
|
|
150
|
+
clearTimeout(pending.timer);
|
|
151
|
+
this.pending.delete(response.request_seq);
|
|
152
|
+
if (response.success) {
|
|
153
|
+
pending.resolve(response);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
pending.reject(new DAPClientError(`DAP error on '${response.command}': ${response.message || "unknown error"}`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (msg.type === "event") {
|
|
161
|
+
const event = msg;
|
|
162
|
+
this.emit(event.event, event);
|
|
163
|
+
this.emit("event", event);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
get exited() {
|
|
167
|
+
return this._exited;
|
|
168
|
+
}
|
|
169
|
+
get stderr() {
|
|
170
|
+
return this.stderrOutput.join("");
|
|
171
|
+
}
|
|
172
|
+
async dispose() {
|
|
173
|
+
if (this.process && !this._exited) {
|
|
174
|
+
this.process.stdin?.end();
|
|
175
|
+
this.process.kill("SIGTERM");
|
|
176
|
+
await new Promise((resolve) => {
|
|
177
|
+
const timer = setTimeout(() => {
|
|
178
|
+
this.process?.kill("SIGKILL");
|
|
179
|
+
resolve();
|
|
180
|
+
}, 3000);
|
|
181
|
+
this.process.on("exit", () => {
|
|
182
|
+
clearTimeout(timer);
|
|
183
|
+
resolve();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
this.removeAllListeners();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=dap-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dap-client.js","sourceRoot":"","sources":["../../src/dap/dap-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,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ACX,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBAClC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC5B,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;oBAC9B,OAAO,EAAE,CAAC;gBACZ,CAAC,EAAE,IAAI,CAAC,CAAC;gBACT,IAAI,CAAC,OAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;oBAC5B,YAAY,CAAC,KAAK,CAAC,CAAC;oBACpB,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { DebugProtocol } from "@vscode/debugprotocol";
|
|
24
|
+
export declare function encodeMessage(msg: DebugProtocol.ProtocolMessage): Buffer;
|
|
25
|
+
export declare class MessageParser {
|
|
26
|
+
private buffer;
|
|
27
|
+
private contentLength;
|
|
28
|
+
private onMessage;
|
|
29
|
+
constructor(onMessage: (msg: DebugProtocol.ProtocolMessage) => void);
|
|
30
|
+
feed(data: Buffer): void;
|
|
31
|
+
private parse;
|
|
32
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const TWO_CRLF = "\r\n\r\n";
|
|
24
|
+
const CONTENT_LENGTH = "Content-Length: ";
|
|
25
|
+
export function encodeMessage(msg) {
|
|
26
|
+
const json = JSON.stringify(msg);
|
|
27
|
+
const header = `${CONTENT_LENGTH}${Buffer.byteLength(json)}${TWO_CRLF}`;
|
|
28
|
+
return Buffer.from(header + json, "utf-8");
|
|
29
|
+
}
|
|
30
|
+
export class MessageParser {
|
|
31
|
+
buffer = Buffer.alloc(0);
|
|
32
|
+
contentLength = -1;
|
|
33
|
+
onMessage;
|
|
34
|
+
constructor(onMessage) {
|
|
35
|
+
this.onMessage = onMessage;
|
|
36
|
+
}
|
|
37
|
+
feed(data) {
|
|
38
|
+
this.buffer = Buffer.concat([this.buffer, data]);
|
|
39
|
+
this.parse();
|
|
40
|
+
}
|
|
41
|
+
parse() {
|
|
42
|
+
while (true) {
|
|
43
|
+
if (this.contentLength === -1) {
|
|
44
|
+
const headerEnd = this.buffer.indexOf(TWO_CRLF);
|
|
45
|
+
if (headerEnd === -1)
|
|
46
|
+
return;
|
|
47
|
+
const header = this.buffer.subarray(0, headerEnd).toString("utf-8");
|
|
48
|
+
const match = header.match(/Content-Length:\s*(\d+)/i);
|
|
49
|
+
if (!match) {
|
|
50
|
+
this.buffer = this.buffer.subarray(headerEnd + TWO_CRLF.length);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
this.contentLength = parseInt(match[1], 10);
|
|
54
|
+
this.buffer = this.buffer.subarray(headerEnd + TWO_CRLF.length);
|
|
55
|
+
}
|
|
56
|
+
if (this.buffer.length < this.contentLength)
|
|
57
|
+
return;
|
|
58
|
+
const body = this.buffer.subarray(0, this.contentLength).toString("utf-8");
|
|
59
|
+
this.buffer = this.buffer.subarray(this.contentLength);
|
|
60
|
+
this.contentLength = -1;
|
|
61
|
+
try {
|
|
62
|
+
const msg = JSON.parse(body);
|
|
63
|
+
this.onMessage(msg);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Skip malformed JSON
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/dap/protocol.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG,UAAU,CAAC;AAC5B,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,MAAM,UAAU,aAAa,CAAC,GAAkC;IAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,GAAG,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC;IACxE,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,OAAO,aAAa;IAChB,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,aAAa,GAAG,CAAC,CAAC,CAAC;IACnB,SAAS,CAA+C;IAEhE,YAAY,SAAuD;QACjE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC,IA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,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACvD,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;YAExB,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkC,CAAC;gBAC9D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;YAAC,MAAM,CAAC;gBACP,sBAAsB;YACxB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export declare class RingBuffer<T> {
|
|
24
|
+
private buffer;
|
|
25
|
+
private maxSize;
|
|
26
|
+
private _truncated;
|
|
27
|
+
constructor(maxSize: number);
|
|
28
|
+
push(item: T): void;
|
|
29
|
+
getAll(): T[];
|
|
30
|
+
getFiltered(predicate: (item: T) => boolean): T[];
|
|
31
|
+
clear(): void;
|
|
32
|
+
removeMatching(predicate: (item: T) => boolean): void;
|
|
33
|
+
get size(): number;
|
|
34
|
+
get truncated(): boolean;
|
|
35
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export class RingBuffer {
|
|
24
|
+
buffer = [];
|
|
25
|
+
maxSize;
|
|
26
|
+
_truncated = false;
|
|
27
|
+
constructor(maxSize) {
|
|
28
|
+
this.maxSize = maxSize;
|
|
29
|
+
}
|
|
30
|
+
push(item) {
|
|
31
|
+
if (this.buffer.length >= this.maxSize) {
|
|
32
|
+
this.buffer.shift();
|
|
33
|
+
this._truncated = true;
|
|
34
|
+
}
|
|
35
|
+
this.buffer.push(item);
|
|
36
|
+
}
|
|
37
|
+
getAll() {
|
|
38
|
+
return [...this.buffer];
|
|
39
|
+
}
|
|
40
|
+
getFiltered(predicate) {
|
|
41
|
+
return this.buffer.filter(predicate);
|
|
42
|
+
}
|
|
43
|
+
clear() {
|
|
44
|
+
this.buffer = [];
|
|
45
|
+
this._truncated = false;
|
|
46
|
+
}
|
|
47
|
+
removeMatching(predicate) {
|
|
48
|
+
this.buffer = this.buffer.filter((item) => !predicate(item));
|
|
49
|
+
}
|
|
50
|
+
get size() {
|
|
51
|
+
return this.buffer.length;
|
|
52
|
+
}
|
|
53
|
+
get truncated() {
|
|
54
|
+
return this._truncated;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=ring-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ring-buffer.js","sourceRoot":"","sources":["../../src/dap/ring-buffer.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;IACb,MAAM,GAAQ,EAAE,CAAC;IACjB,OAAO,CAAS;IAChB,UAAU,GAAG,KAAK,CAAC;IAE3B,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,IAAO;QACV,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,MAAM;QACJ,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,WAAW,CAAC,SAA+B;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,cAAc,CAAC,SAA+B;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export type SessionState = "idle" | "configuring" | "running" | "stopped" | "terminated";
|
|
24
|
+
export interface StoppedState {
|
|
25
|
+
status: "stopped";
|
|
26
|
+
reason: string;
|
|
27
|
+
location: {
|
|
28
|
+
file: string;
|
|
29
|
+
line: number;
|
|
30
|
+
column?: number;
|
|
31
|
+
functionName?: string;
|
|
32
|
+
};
|
|
33
|
+
threads: Array<{
|
|
34
|
+
id: number;
|
|
35
|
+
name: string;
|
|
36
|
+
stopped: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
stackTrace: Array<{
|
|
39
|
+
id: number;
|
|
40
|
+
name: string;
|
|
41
|
+
file: string;
|
|
42
|
+
line: number;
|
|
43
|
+
column?: number;
|
|
44
|
+
}>;
|
|
45
|
+
scopes: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
variables: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
value: string;
|
|
50
|
+
type?: string;
|
|
51
|
+
hasChildren: boolean;
|
|
52
|
+
variablesReference: number;
|
|
53
|
+
}>;
|
|
54
|
+
}>;
|
|
55
|
+
output?: string[];
|
|
56
|
+
}
|
|
57
|
+
export interface RunningState {
|
|
58
|
+
status: "running";
|
|
59
|
+
output?: string[];
|
|
60
|
+
elapsedMs?: number;
|
|
61
|
+
}
|
|
62
|
+
export type DebugState = StoppedState | RunningState;
|
|
63
|
+
export interface AdapterConfig {
|
|
64
|
+
type: string;
|
|
65
|
+
runtime?: string;
|
|
66
|
+
program: string;
|
|
67
|
+
args?: string[];
|
|
68
|
+
launchDefaults?: Record<string, unknown>;
|
|
69
|
+
installHint?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface OutputEntry {
|
|
72
|
+
category: string;
|
|
73
|
+
text: string;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
}
|
|
76
|
+
export interface BreakpointConfig {
|
|
77
|
+
line: number;
|
|
78
|
+
condition?: string;
|
|
79
|
+
hitCondition?: string;
|
|
80
|
+
logMessage?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface BreakpointResult {
|
|
83
|
+
id?: number;
|
|
84
|
+
verified: boolean;
|
|
85
|
+
line: number;
|
|
86
|
+
message?: string;
|
|
87
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// src/dap/types.ts
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dap/types.ts"],"names":[],"mappings":"AAAA,mBAAmB"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
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
|
|
13
|
+
* all 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.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export {};
|
package/build/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
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
|
|
13
|
+
* all 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.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
25
|
+
import { createServer } from "./server.js";
|
|
26
|
+
const server = createServer();
|
|
27
|
+
const transport = new StdioServerTransport();
|
|
28
|
+
await server.connect(transport);
|
|
29
|
+
console.error("dap-mcp-server running on stdio");
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAChC,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 Ivan Iraci <ivan.iraci@professioneit.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
* SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
24
|
+
export declare function createServer(): McpServer;
|