@zzp123/mcp-zentao 1.18.3 → 1.18.4
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/CHANGELOG.md +34 -0
- package/README.md +39 -0
- package/dist/api/zentaoApi.js +1 -266
- package/dist/config.js +1 -1
- package/dist/index-dev.js +4 -23
- package/dist/index-pm.js +26 -23
- package/dist/index-qa.js +1 -23
- package/dist/index.js +12 -33
- package/dist/mcpHelpers.d.ts +13 -0
- package/dist/mcpHelpers.js +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function ensureApi(getApi) {
|
|
2
|
+
const api = getApi();
|
|
3
|
+
if (!api) {
|
|
4
|
+
throw new Error("Please initialize Zentao API first");
|
|
5
|
+
}
|
|
6
|
+
return api;
|
|
7
|
+
}
|
|
8
|
+
export function withApi(getApi, handler) {
|
|
9
|
+
return async (args) => {
|
|
10
|
+
const api = ensureApi(getApi);
|
|
11
|
+
return handler(api, args);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function registerTools(server, tools) {
|
|
15
|
+
for (const tool of tools) {
|
|
16
|
+
const { name, description, schema, handler } = tool;
|
|
17
|
+
if (description) {
|
|
18
|
+
server.tool(name, description, schema, handler);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
server.tool(name, schema, handler);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|