maic-server-fs-mcp 1.0.0
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/dist/const.d.ts +9 -0
- package/dist/const.d.ts.map +1 -0
- package/dist/const.js +10 -0
- package/dist/const.js.map +1 -0
- package/dist/server.d.ts +78 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +256 -0
- package/dist/server.js.map +1 -0
- package/package.json +28 -0
package/dist/const.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const enum toolsName {
|
|
2
|
+
writeFile = "writeFile",
|
|
3
|
+
readDirectory = "readDirectory",
|
|
4
|
+
readFile = "readFile",
|
|
5
|
+
executeCommand = "executeCommand",
|
|
6
|
+
dispatchTask = "dispatchTask",
|
|
7
|
+
humanReview = "humanReview"
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../const.ts"],"names":[],"mappings":"AAAA,0BAAkB,SAAS;IACzB,SAAS,cAAc;IACvB,aAAa,kBAAkB;IAC/B,QAAQ,aAAa;IACrB,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;CAC5B"}
|
package/dist/const.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var toolsName;
|
|
2
|
+
(function (toolsName) {
|
|
3
|
+
toolsName["writeFile"] = "writeFile";
|
|
4
|
+
toolsName["readDirectory"] = "readDirectory";
|
|
5
|
+
toolsName["readFile"] = "readFile";
|
|
6
|
+
toolsName["executeCommand"] = "executeCommand";
|
|
7
|
+
toolsName["dispatchTask"] = "dispatchTask";
|
|
8
|
+
toolsName["humanReview"] = "humanReview";
|
|
9
|
+
})(toolsName || (toolsName = {}));
|
|
10
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAkB,SAOjB;AAPD,WAAkB,SAAS;IACzB,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,kCAAqB,CAAA;IACrB,8CAAiC,CAAA;IACjC,0CAA6B,CAAA;IAC7B,wCAA2B,CAAA;AAC7B,CAAC,EAPiB,SAAS,KAAT,SAAS,QAO1B"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { toolsName } from "./const";
|
|
3
|
+
export declare const humanReviewTool: {
|
|
4
|
+
name: toolsName;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
message: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
required: string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const readfileTool: ({ filePath }: {
|
|
18
|
+
filePath: string;
|
|
19
|
+
}) => {
|
|
20
|
+
content: {
|
|
21
|
+
type: string;
|
|
22
|
+
text: string;
|
|
23
|
+
}[];
|
|
24
|
+
isError: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
content: {
|
|
27
|
+
type: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
isError?: never;
|
|
31
|
+
};
|
|
32
|
+
export declare const writefileTool: ({ filePath, content, }: {
|
|
33
|
+
filePath: string;
|
|
34
|
+
content: string;
|
|
35
|
+
}) => {
|
|
36
|
+
content: {
|
|
37
|
+
type: string;
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
isError?: never;
|
|
41
|
+
} | {
|
|
42
|
+
content: {
|
|
43
|
+
type: string;
|
|
44
|
+
text: string;
|
|
45
|
+
}[];
|
|
46
|
+
isError: boolean;
|
|
47
|
+
};
|
|
48
|
+
export declare const readDirectoryTool: ({ dirPath }: {
|
|
49
|
+
dirPath?: string;
|
|
50
|
+
}) => string | {
|
|
51
|
+
content: {
|
|
52
|
+
type: string;
|
|
53
|
+
text: string;
|
|
54
|
+
}[];
|
|
55
|
+
isError?: never;
|
|
56
|
+
} | {
|
|
57
|
+
content: {
|
|
58
|
+
type: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}[];
|
|
61
|
+
isError: boolean;
|
|
62
|
+
};
|
|
63
|
+
export declare const execCommandTool: ({ command }: {
|
|
64
|
+
command: string;
|
|
65
|
+
}) => {
|
|
66
|
+
content: {
|
|
67
|
+
type: string;
|
|
68
|
+
text: string;
|
|
69
|
+
}[];
|
|
70
|
+
isError?: never;
|
|
71
|
+
} | {
|
|
72
|
+
content: {
|
|
73
|
+
type: string;
|
|
74
|
+
text: string;
|
|
75
|
+
}[];
|
|
76
|
+
isError: boolean;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AA0GpC,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAa3B,CAAC;AAGF,eAAO,MAAM,YAAY,GAAI,cAAc;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;CAuB9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,wBAG3B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;;;;;;;;;;;;CAyBA,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,aAAmB;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;CAmCxE,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,aAAa;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;CAsB/D,CAAC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
import { execSync } from "child_process";
|
|
8
|
+
import { toolsName } from "./const";
|
|
9
|
+
// 1. 初始化 MCP 服务端实例,声明你的服务名称和版本
|
|
10
|
+
const server = new Server({
|
|
11
|
+
name: "maic-local-filesystem-mcp",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
}, {
|
|
14
|
+
capabilities: {
|
|
15
|
+
tools: {}, // 声明这个 Server 具备提供“工具(Tools)”的能力
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
// 2. 注册工具列表:当 Client (比如你的 CLI) 发送 tools/list 请求时,告知对方你有什么工具
|
|
19
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
20
|
+
return {
|
|
21
|
+
tools: [
|
|
22
|
+
{
|
|
23
|
+
name: toolsName.readFile,
|
|
24
|
+
description: "读取指定路径的本地文件内容,允许 AI 查看文件代码或文本。",
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {
|
|
28
|
+
filePath: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "相对或绝对路径,例如 'package.json' 或 'src/index.js'",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["filePath"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: toolsName.writeFile,
|
|
38
|
+
description: "写入指定路径的本地文件内容,允许 AI 修改文件代码或文本。",
|
|
39
|
+
inputSchema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: {
|
|
42
|
+
filePath: {
|
|
43
|
+
type: "STRING",
|
|
44
|
+
description: "相对或绝对路径,例如 'package.json' 或 'src/index.js'",
|
|
45
|
+
},
|
|
46
|
+
content: {
|
|
47
|
+
type: "STRING",
|
|
48
|
+
description: "要写入文件的内容",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ["filePath", "content"],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: toolsName.readDirectory,
|
|
56
|
+
description: "列出指定目录下的所有文件和文件夹名称(已自动忽略 node_modules 等大文件夹)。当你不确定项目结构、找不到某个文件在哪里时,必须先调用此工具。",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
filePath: {
|
|
61
|
+
type: "STRING",
|
|
62
|
+
description: "要查询的目录路径,默认是当前根目录 '.',或者例如 'src/components'",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: ['filePath']
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: toolsName.executeCommand,
|
|
70
|
+
description: "在本地终端安全运行 shell 命令(如 npm test, git status, npm run build)。当修改代码后需要验证是否报错,或者需要安装依赖、运行构建时使用此工具。",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
command: {
|
|
75
|
+
type: "STRING",
|
|
76
|
+
description: "需要执行的完整命令,例如 'npm run build' 或 'node test.js'",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
required: ["command"],
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: toolsName.dispatchTask,
|
|
84
|
+
description: "当需要安排下属专家执行具体工作时调用此工具。每次只能派发一个任务,等下属汇报结果后,再派发下一个。",
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: "object",
|
|
87
|
+
properties: {
|
|
88
|
+
worker: {
|
|
89
|
+
type: "STRING",
|
|
90
|
+
description: "接收任务的专家。'CODER' 负责读写代码文件;'TESTER' 负责运行终端编译或测试命令。",
|
|
91
|
+
},
|
|
92
|
+
taskInstruction: {
|
|
93
|
+
type: "STRING",
|
|
94
|
+
description: "具体要这个专家执行的详细指令。例如:'帮我查看 src/index.ts 的内容并修复其中的类型 Bug'。",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
required: ["worker", "taskInstruction"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
// 定义人类审阅工具(无实际执行逻辑,仅用于触发对话)
|
|
104
|
+
export const humanReviewTool = {
|
|
105
|
+
name: toolsName.humanReview,
|
|
106
|
+
description: "需要人工审核或确认时调用。",
|
|
107
|
+
parameters: {
|
|
108
|
+
type: "object",
|
|
109
|
+
properties: {
|
|
110
|
+
message: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "给人类的留言或请求确认的内容。",
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
required: ["message"]
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
export const readfileTool = ({ filePath }) => {
|
|
119
|
+
try {
|
|
120
|
+
const fullPath = path.resolve(process.cwd(), filePath);
|
|
121
|
+
if (!fs.existsSync(fullPath)) {
|
|
122
|
+
return {
|
|
123
|
+
content: [
|
|
124
|
+
{ type: "text", text: `Error: File ${fullPath} does not exist.` },
|
|
125
|
+
],
|
|
126
|
+
isError: true,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const fileContent = fs.readFileSync(fullPath, "utf-8");
|
|
130
|
+
return {
|
|
131
|
+
content: [{ type: "text", text: fileContent }],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{ type: "text", text: `Error reading file: ${error.message}` },
|
|
138
|
+
],
|
|
139
|
+
isError: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
export const writefileTool = ({ filePath, content, }) => {
|
|
144
|
+
try {
|
|
145
|
+
const fullPath = path.resolve(process.cwd(), filePath);
|
|
146
|
+
// 确保目标文件的父级文件夹存在(可选,防错)
|
|
147
|
+
const dir = path.dirname(fullPath);
|
|
148
|
+
if (!fs.existsSync(dir)) {
|
|
149
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
150
|
+
}
|
|
151
|
+
fs.writeFileSync(fullPath, content, "utf-8");
|
|
152
|
+
return {
|
|
153
|
+
content: [
|
|
154
|
+
{ type: 'text', text: `✅ Successfully wrote ${content.length} characters to: ${fullPath}` }
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
return {
|
|
160
|
+
content: [
|
|
161
|
+
{
|
|
162
|
+
type: 'text',
|
|
163
|
+
text: `❌ Error writing file: ${error.message}`
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
isError: true,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
export const readDirectoryTool = ({ dirPath = "." }) => {
|
|
171
|
+
try {
|
|
172
|
+
const fullPath = path.resolve(process.cwd(), dirPath);
|
|
173
|
+
if (!fs.existsSync(fullPath)) {
|
|
174
|
+
return `❌ Error: Directory ${fullPath} does not exist.`;
|
|
175
|
+
}
|
|
176
|
+
// 读取当前目录下的所有文件和文件夹
|
|
177
|
+
const files = fs.readdirSync(fullPath, { withFileTypes: true });
|
|
178
|
+
// 过滤掉不必要的庞大文件夹(如 node_modules, .git),否则数据太多会干扰 AI
|
|
179
|
+
const ignoredDirs = ["node_modules", ".git", ".next", "dist"];
|
|
180
|
+
const resultList = files
|
|
181
|
+
.filter((file) => !ignoredDirs.includes(file.name))
|
|
182
|
+
.map((file) => {
|
|
183
|
+
return `${file.isDirectory() ? "📁" : "📄"} ${file.name}`;
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
content: [
|
|
187
|
+
{ type: 'text', text: `📁 Current Directory: ${dirPath}\n` + resultList.join("\n") }
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
return {
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: 'text',
|
|
196
|
+
text: `❌ Error reading directory: ${error.message}`
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
isError: true,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// 修复工具函数:执行命令行指令
|
|
204
|
+
export const execCommandTool = ({ command }) => {
|
|
205
|
+
try {
|
|
206
|
+
console.log(`\n⚠️ [⚠️安全警告] Agent 正在本地终端执行命令: ${command}`);
|
|
207
|
+
// 在当前目录下同步执行命令,并捕获标准输出
|
|
208
|
+
const output = execSync(command, { encoding: "utf-8", timeout: 30000 });
|
|
209
|
+
return {
|
|
210
|
+
content: [
|
|
211
|
+
{ type: 'text', text: `ℹ️ Command Executed Successfully. Output:\n${output}` }
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
// 如果命令报错(比如编译挂了),把报错信息完整吐给 AI,AI 会根据报错自己修 Bug!
|
|
217
|
+
return {
|
|
218
|
+
content: [
|
|
219
|
+
{
|
|
220
|
+
type: 'text',
|
|
221
|
+
text: `❌ Command Failed with Error:\n${error.stdout || error.message}`
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
isError: true,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const toolMap = new Map([
|
|
229
|
+
[toolsName.readFile, readfileTool],
|
|
230
|
+
[toolsName.writeFile, writefileTool],
|
|
231
|
+
[toolsName.readDirectory, readDirectoryTool],
|
|
232
|
+
[toolsName.executeCommand, execCommandTool],
|
|
233
|
+
]);
|
|
234
|
+
// 3. 注册工具执行核心:当 AI 真正要调用工具时,执行你原本的 Node.js 物理逻辑
|
|
235
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
236
|
+
const { name, arguments: args } = request.params;
|
|
237
|
+
if (toolMap.has(name)) {
|
|
238
|
+
const fn = toolMap.get(name);
|
|
239
|
+
return fn?.(args);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
throw new Error(`未知工具: ${name}`);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
// 4. 启动服务端:绑定到当前的 Stdio (标准输入输出通道)
|
|
246
|
+
async function main() {
|
|
247
|
+
const transport = new StdioServerTransport();
|
|
248
|
+
await server.connect(transport);
|
|
249
|
+
console.error("🚀 独立 MCP 进程已通过 Stdio 通道成功挂载!");
|
|
250
|
+
// ⚠️ 避坑提醒:MCP Server 内部的所有普通日志必须用 console.error 打印,因为 stdout 被 JSON-RPC 进程通信独占了!
|
|
251
|
+
}
|
|
252
|
+
main().catch((error) => {
|
|
253
|
+
console.error("MCP Server 崩溃:", error);
|
|
254
|
+
process.exit(1);
|
|
255
|
+
});
|
|
256
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,+BAA+B;AAC/B,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,2BAA2B;IACjC,OAAO,EA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G,OAAO,CAAC,MAAM,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mCAAmC;AACnC,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC/C,iFAAiF;AACnF,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "maic-server-fs-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "一个用于读取本地文件的自定义标准 MCP 服务端",
|
|
5
|
+
"main": "./dist/server.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp-server-fs": "dist/server.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"build": "tsc"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^25.9.3",
|
|
25
|
+
"tsx": "^4.22.4",
|
|
26
|
+
"typescript": "^6.0.3"
|
|
27
|
+
}
|
|
28
|
+
}
|