@zavudev/sdk-mcp 0.24.0 → 0.25.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/code-tool.d.mts +4 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +4 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +14 -1
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +14 -1
- package/code-tool.mjs.map +1 -1
- package/http.d.mts +7 -2
- package/http.d.mts.map +1 -1
- package/http.d.ts +7 -2
- package/http.d.ts.map +1 -1
- package/http.js +25 -10
- package/http.js.map +1 -1
- package/http.mjs +25 -10
- package/http.mjs.map +1 -1
- package/index.js +6 -2
- package/index.js.map +1 -1
- package/index.mjs +6 -2
- package/index.mjs.map +1 -1
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +526 -0
- package/methods.js.map +1 -0
- package/methods.mjs +522 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +4 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +4 -0
- package/options.d.ts.map +1 -1
- package/options.js +30 -12
- package/options.js.map +1 -1
- package/options.mjs +30 -12
- package/options.mjs.map +1 -1
- package/package.json +13 -2
- package/server.d.mts +2 -3
- package/server.d.mts.map +1 -1
- package/server.d.ts +2 -3
- package/server.d.ts.map +1 -1
- package/server.js +40 -8
- package/server.js.map +1 -1
- package/server.mjs +39 -7
- package/server.mjs.map +1 -1
- package/src/code-tool.ts +20 -1
- package/src/http.ts +33 -10
- package/src/index.ts +6 -2
- package/src/methods.ts +546 -0
- package/src/options.ts +37 -12
- package/src/server.ts +49 -8
- package/src/stdio.ts +4 -3
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +3 -3
- package/stdio.js.map +1 -1
- package/stdio.mjs +3 -3
- package/stdio.mjs.map +1 -1
package/src/server.ts
CHANGED
|
@@ -12,28 +12,65 @@ import Zavudev from '@zavudev/sdk';
|
|
|
12
12
|
import { codeTool } from './code-tool';
|
|
13
13
|
import docsSearchTool from './docs-search-tool';
|
|
14
14
|
import { McpOptions } from './options';
|
|
15
|
+
import { blockedMethodsForCodeTool } from './methods';
|
|
15
16
|
import { HandlerFunction, McpTool } from './types';
|
|
16
17
|
|
|
17
18
|
export { McpOptions } from './options';
|
|
18
19
|
export { ClientOptions } from '@zavudev/sdk';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
async function getInstructions() {
|
|
22
|
+
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
23
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
24
|
+
const response = await fetch(
|
|
25
|
+
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/zavudev',
|
|
26
|
+
{
|
|
27
|
+
method: 'GET',
|
|
28
|
+
headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
let instructions: string | undefined;
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
console.warn(
|
|
35
|
+
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
instructions = `
|
|
39
|
+
This is the zavudev MCP server. You will use Code Mode to help the user perform
|
|
40
|
+
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
41
|
+
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
42
|
+
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
43
|
+
block: it can be as long as you need to get the job done!
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
48
|
+
instructions = `
|
|
49
|
+
The current time in Unix timestamps is ${Date.now()}.
|
|
50
|
+
|
|
51
|
+
${instructions}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
return instructions;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const newMcpServer = async () =>
|
|
21
58
|
new McpServer(
|
|
22
59
|
{
|
|
23
60
|
name: 'zavudev_sdk_api',
|
|
24
|
-
version: '0.
|
|
61
|
+
version: '0.25.0',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
instructions: await getInstructions(),
|
|
65
|
+
capabilities: { tools: {}, logging: {} },
|
|
25
66
|
},
|
|
26
|
-
{ capabilities: { tools: {}, logging: {} } },
|
|
27
67
|
);
|
|
28
68
|
|
|
29
|
-
// Create server instance
|
|
30
|
-
export const server = newMcpServer();
|
|
31
|
-
|
|
32
69
|
/**
|
|
33
70
|
* Initializes the provided MCP Server with the given tools and handlers.
|
|
34
71
|
* If not provided, the default client, tools and handlers will be used.
|
|
35
72
|
*/
|
|
36
|
-
export function initMcpServer(params: {
|
|
73
|
+
export async function initMcpServer(params: {
|
|
37
74
|
server: Server | McpServer;
|
|
38
75
|
clientOptions?: ClientOptions;
|
|
39
76
|
mcpOptions?: McpOptions;
|
|
@@ -111,7 +148,11 @@ export function initMcpServer(params: {
|
|
|
111
148
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
112
149
|
*/
|
|
113
150
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
114
|
-
const includedTools = [
|
|
151
|
+
const includedTools = [
|
|
152
|
+
codeTool({
|
|
153
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
154
|
+
}),
|
|
155
|
+
];
|
|
115
156
|
if (options?.includeDocsTools ?? true) {
|
|
116
157
|
includedTools.push(docsSearchTool);
|
|
117
158
|
}
|
package/src/stdio.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
+
import { McpOptions } from './options';
|
|
2
3
|
import { initMcpServer, newMcpServer } from './server';
|
|
3
4
|
|
|
4
|
-
export const launchStdioServer = async () => {
|
|
5
|
-
const server = newMcpServer();
|
|
5
|
+
export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
6
|
+
const server = await newMcpServer();
|
|
6
7
|
|
|
7
|
-
initMcpServer({ server });
|
|
8
|
+
await initMcpServer({ server, mcpOptions });
|
|
8
9
|
|
|
9
10
|
const transport = new StdioServerTransport();
|
|
10
11
|
await server.connect(transport);
|
package/stdio.d.mts
CHANGED
package/stdio.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.d.ts
CHANGED
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.launchStdioServer = void 0;
|
|
4
4
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
5
|
const server_1 = require("./server.js");
|
|
6
|
-
const launchStdioServer = async () => {
|
|
7
|
-
const server = (0, server_1.newMcpServer)();
|
|
8
|
-
(0, server_1.initMcpServer)({ server });
|
|
6
|
+
const launchStdioServer = async (mcpOptions) => {
|
|
7
|
+
const server = await (0, server_1.newMcpServer)();
|
|
8
|
+
await (0, server_1.initMcpServer)({ server, mcpOptions });
|
|
9
9
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
10
|
await server.connect(transport);
|
|
11
11
|
console.error('MCP Server running on stdio');
|
package/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IAEpC,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
package/stdio.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
|
-
export const launchStdioServer = async () => {
|
|
4
|
-
const server = newMcpServer();
|
|
5
|
-
initMcpServer({ server });
|
|
3
|
+
export const launchStdioServer = async (mcpOptions) => {
|
|
4
|
+
const server = await newMcpServer();
|
|
5
|
+
await initMcpServer({ server, mcpOptions });
|
|
6
6
|
const transport = new StdioServerTransport();
|
|
7
7
|
await server.connect(transport);
|
|
8
8
|
console.error('MCP Server running on stdio');
|
package/stdio.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;
|
|
1
|
+
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IAEpC,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
|