@henrylabs/mcp 0.14.0 → 0.17.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/README.md +13 -334
- package/code-tool-types.d.mts +2 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +2 -0
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool.d.mts +2 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +2 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +27 -130
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +27 -97
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +15 -9
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +15 -9
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +4 -1
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +4 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +1 -18
- package/http.js.map +1 -1
- package/http.mjs +1 -18
- package/http.mjs.map +1 -1
- package/index.js +4 -40
- package/index.js.map +1 -1
- package/index.mjs +4 -40
- package/index.mjs.map +1 -1
- package/options.d.mts +0 -9
- package/options.d.mts.map +1 -1
- package/options.d.ts +0 -9
- package/options.d.ts.map +1 -1
- package/options.js +4 -359
- package/options.js.map +1 -1
- package/options.mjs +4 -359
- package/options.mjs.map +1 -1
- package/package.json +10 -66
- package/server.d.mts +3 -8
- package/server.d.mts.map +1 -1
- package/server.d.ts +3 -8
- package/server.d.ts.map +1 -1
- package/server.js +12 -65
- package/server.js.map +1 -1
- package/server.mjs +11 -62
- package/server.mjs.map +1 -1
- package/src/code-tool-types.ts +5 -1
- package/src/code-tool.ts +36 -121
- package/src/docs-search-tool.ts +8 -1
- package/src/http.ts +1 -19
- package/src/index.ts +5 -52
- package/src/options.ts +5 -386
- package/src/server.ts +12 -72
- package/src/stdio.ts +2 -3
- package/src/{tools/types.ts → types.ts} +1 -1
- package/stdio.d.mts +1 -2
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -2
- package/stdio.d.ts.map +1 -1
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +1 -1
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +1 -1
- package/types.d.ts.map +1 -0
- package/types.js.map +1 -0
- package/types.mjs.map +1 -0
- package/code-tool-paths.cjs +0 -6
- package/code-tool-paths.cjs.map +0 -1
- package/code-tool-paths.d.cts +0 -2
- package/code-tool-paths.d.cts.map +0 -1
- package/code-tool-worker.d.mts +0 -5
- package/code-tool-worker.d.mts.map +0 -1
- package/code-tool-worker.d.ts +0 -5
- package/code-tool-worker.d.ts.map +0 -1
- package/code-tool-worker.js +0 -162
- package/code-tool-worker.js.map +0 -1
- package/code-tool-worker.mjs +0 -157
- package/code-tool-worker.mjs.map +0 -1
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -3
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -3
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -24
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -16
- package/filtering.mjs.map +0 -1
- package/src/code-tool-paths.cts +0 -3
- package/src/code-tool-worker.ts +0 -208
- package/src/compat.ts +0 -483
- package/src/dynamic-tools.ts +0 -153
- package/src/filtering.ts +0 -18
- package/src/tools/cart/create-cart-checkout.ts +0 -56
- package/src/tools/cart/items/add-cart-items.ts +0 -100
- package/src/tools/cart/items/clear-cart-items.ts +0 -54
- package/src/tools/cart/items/list-cart-items.ts +0 -54
- package/src/tools/cart/items/remove-cart-items.ts +0 -57
- package/src/tools/index.ts +0 -87
- package/src/tools/orders/retrieve-status-orders.ts +0 -54
- package/src/tools/products/retrieve-product-details.ts +0 -41
- package/src/tools/products/search-products.ts +0 -110
- package/src/tools/wallet/collect-payment-details.ts +0 -56
- package/src/tools.ts +0 -1
- package/tools/cart/create-cart-checkout.d.mts +0 -45
- package/tools/cart/create-cart-checkout.d.mts.map +0 -1
- package/tools/cart/create-cart-checkout.d.ts +0 -45
- package/tools/cart/create-cart-checkout.d.ts.map +0 -1
- package/tools/cart/create-cart-checkout.js +0 -52
- package/tools/cart/create-cart-checkout.js.map +0 -1
- package/tools/cart/create-cart-checkout.mjs +0 -48
- package/tools/cart/create-cart-checkout.mjs.map +0 -1
- package/tools/cart/items/add-cart-items.d.mts +0 -45
- package/tools/cart/items/add-cart-items.d.mts.map +0 -1
- package/tools/cart/items/add-cart-items.d.ts +0 -45
- package/tools/cart/items/add-cart-items.d.ts.map +0 -1
- package/tools/cart/items/add-cart-items.js +0 -94
- package/tools/cart/items/add-cart-items.js.map +0 -1
- package/tools/cart/items/add-cart-items.mjs +0 -90
- package/tools/cart/items/add-cart-items.mjs.map +0 -1
- package/tools/cart/items/clear-cart-items.d.mts +0 -45
- package/tools/cart/items/clear-cart-items.d.mts.map +0 -1
- package/tools/cart/items/clear-cart-items.d.ts +0 -45
- package/tools/cart/items/clear-cart-items.d.ts.map +0 -1
- package/tools/cart/items/clear-cart-items.js +0 -50
- package/tools/cart/items/clear-cart-items.js.map +0 -1
- package/tools/cart/items/clear-cart-items.mjs +0 -46
- package/tools/cart/items/clear-cart-items.mjs.map +0 -1
- package/tools/cart/items/list-cart-items.d.mts +0 -45
- package/tools/cart/items/list-cart-items.d.mts.map +0 -1
- package/tools/cart/items/list-cart-items.d.ts +0 -45
- package/tools/cart/items/list-cart-items.d.ts.map +0 -1
- package/tools/cart/items/list-cart-items.js +0 -50
- package/tools/cart/items/list-cart-items.js.map +0 -1
- package/tools/cart/items/list-cart-items.mjs +0 -46
- package/tools/cart/items/list-cart-items.mjs.map +0 -1
- package/tools/cart/items/remove-cart-items.d.mts +0 -45
- package/tools/cart/items/remove-cart-items.d.mts.map +0 -1
- package/tools/cart/items/remove-cart-items.d.ts +0 -45
- package/tools/cart/items/remove-cart-items.d.ts.map +0 -1
- package/tools/cart/items/remove-cart-items.js +0 -53
- package/tools/cart/items/remove-cart-items.js.map +0 -1
- package/tools/cart/items/remove-cart-items.mjs +0 -49
- package/tools/cart/items/remove-cart-items.mjs.map +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -71
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -64
- package/tools/index.mjs.map +0 -1
- package/tools/orders/retrieve-status-orders.d.mts +0 -45
- package/tools/orders/retrieve-status-orders.d.mts.map +0 -1
- package/tools/orders/retrieve-status-orders.d.ts +0 -45
- package/tools/orders/retrieve-status-orders.d.ts.map +0 -1
- package/tools/orders/retrieve-status-orders.js +0 -50
- package/tools/orders/retrieve-status-orders.js.map +0 -1
- package/tools/orders/retrieve-status-orders.mjs +0 -46
- package/tools/orders/retrieve-status-orders.mjs.map +0 -1
- package/tools/products/retrieve-product-details.d.mts +0 -45
- package/tools/products/retrieve-product-details.d.mts.map +0 -1
- package/tools/products/retrieve-product-details.d.ts +0 -45
- package/tools/products/retrieve-product-details.d.ts.map +0 -1
- package/tools/products/retrieve-product-details.js +0 -37
- package/tools/products/retrieve-product-details.js.map +0 -1
- package/tools/products/retrieve-product-details.mjs +0 -33
- package/tools/products/retrieve-product-details.mjs.map +0 -1
- package/tools/products/search-products.d.mts +0 -45
- package/tools/products/search-products.d.mts.map +0 -1
- package/tools/products/search-products.d.ts +0 -45
- package/tools/products/search-products.d.ts.map +0 -1
- package/tools/products/search-products.js +0 -106
- package/tools/products/search-products.js.map +0 -1
- package/tools/products/search-products.mjs +0 -102
- package/tools/products/search-products.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools/wallet/collect-payment-details.d.mts +0 -45
- package/tools/wallet/collect-payment-details.d.mts.map +0 -1
- package/tools/wallet/collect-payment-details.d.ts +0 -45
- package/tools/wallet/collect-payment-details.d.ts.map +0 -1
- package/tools/wallet/collect-payment-details.js +0 -52
- package/tools/wallet/collect-payment-details.js.map +0 -1
- package/tools/wallet/collect-payment-details.mjs +0 -48
- package/tools/wallet/collect-payment-details.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
- /package/{tools/types.js → types.js} +0 -0
- /package/{tools/types.mjs → types.mjs} +0 -0
package/code-tool.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { asTextContentResult } from "./types.mjs";
|
|
3
|
+
import { readEnv } from "./server.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* A tool that runs code against a copy of the SDK.
|
|
6
6
|
*
|
|
@@ -10,109 +10,39 @@ import { pathToFileURL } from 'node:url';
|
|
|
10
10
|
*
|
|
11
11
|
* @param endpoints - The endpoints to include in the list.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export function codeTool() {
|
|
14
14
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
15
15
|
const tool = {
|
|
16
16
|
name: 'execute',
|
|
17
|
-
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized
|
|
17
|
+
description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
18
18
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
printOutput: true,
|
|
36
|
-
spawnOptions: {
|
|
37
|
-
cwd: dirname(workerPath),
|
|
20
|
+
const handler = async (_, args) => {
|
|
21
|
+
const code = args.code;
|
|
22
|
+
// this is not required, but passing a Stainless API key for the matching project_name
|
|
23
|
+
// will allow you to run code-mode queries against non-published versions of your SDK.
|
|
24
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
25
|
+
const codeModeEndpoint = readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
26
|
+
const res = await fetch(codeModeEndpoint, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: {
|
|
29
|
+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
client_envs: JSON.stringify({
|
|
32
|
+
HENRY_SDK_API_KEY: readEnv('HENRY_SDK_API_KEY'),
|
|
33
|
+
HENRY_SDK_BASE_URL: readEnv('HENRY_SDK_BASE_URL'),
|
|
34
|
+
}),
|
|
38
35
|
},
|
|
36
|
+
body: JSON.stringify({
|
|
37
|
+
project_name: 'henry-sdk',
|
|
38
|
+
client_opts: { environment: (readEnv('HENRY_SDK_ENVIRONMENT') || undefined) },
|
|
39
|
+
code,
|
|
40
|
+
}),
|
|
39
41
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
worker.addEventListener('exit', (exitCode) => {
|
|
43
|
-
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
44
|
-
});
|
|
45
|
-
const opts = {
|
|
46
|
-
baseURL: client.baseURL,
|
|
47
|
-
apiKey: client.apiKey,
|
|
48
|
-
defaultHeaders: {
|
|
49
|
-
'X-Stainless-MCP': 'true',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
const req = worker.request('http://localhost', {
|
|
53
|
-
headers: {
|
|
54
|
-
'content-type': 'application/json',
|
|
55
|
-
},
|
|
56
|
-
method: 'POST',
|
|
57
|
-
}, (resp) => {
|
|
58
|
-
const body = [];
|
|
59
|
-
resp.on('error', (err) => {
|
|
60
|
-
reject(err);
|
|
61
|
-
});
|
|
62
|
-
resp.on('data', (chunk) => {
|
|
63
|
-
body.push(chunk);
|
|
64
|
-
});
|
|
65
|
-
resp.on('end', () => {
|
|
66
|
-
resolve(new Response(Buffer.concat(body).toString(), {
|
|
67
|
-
status: resp.statusCode ?? 200,
|
|
68
|
-
headers: resp.headers,
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
const body = JSON.stringify({
|
|
73
|
-
opts,
|
|
74
|
-
code,
|
|
75
|
-
});
|
|
76
|
-
req.write(body, (err) => {
|
|
77
|
-
if (err != null) {
|
|
78
|
-
reject(err);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
req.end();
|
|
82
|
-
});
|
|
83
|
-
if (resp.status === 200) {
|
|
84
|
-
const { result, logLines, errLines } = (await resp.json());
|
|
85
|
-
const returnOutput = result == null ? null : ({
|
|
86
|
-
type: 'text',
|
|
87
|
-
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
88
|
-
});
|
|
89
|
-
const logOutput = logLines.length === 0 ?
|
|
90
|
-
null
|
|
91
|
-
: {
|
|
92
|
-
type: 'text',
|
|
93
|
-
text: logLines.join('\n'),
|
|
94
|
-
};
|
|
95
|
-
const errOutput = errLines.length === 0 ?
|
|
96
|
-
null
|
|
97
|
-
: {
|
|
98
|
-
type: 'text',
|
|
99
|
-
text: 'Error output:\n' + errLines.join('\n'),
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
const { message } = (await resp.json());
|
|
107
|
-
return {
|
|
108
|
-
content: message == null ? [] : [{ type: 'text', text: message }],
|
|
109
|
-
isError: true,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
worker.terminate();
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
115
44
|
}
|
|
45
|
+
return asTextContentResult((await res.json()));
|
|
116
46
|
};
|
|
117
47
|
return { metadata, tool, handler };
|
|
118
48
|
}
|
package/code-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,
|
|
1
|
+
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.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AQ,EAAE;gBACpF,IAAI;aACL,CAAC;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,GAAG,GAAG,CAAC,MAAM,KACX,GAAG,CAAC,UACN,4DAA4D,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAC/E,CAAC;QACJ,CAAC;QAED,OAAO,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAkB,CAAC,CAAC;IAClE,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/docs-search-tool.d.mts
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { Metadata } from "./
|
|
1
|
+
import { Metadata } from "./types.mjs";
|
|
2
2
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
export declare const metadata: Metadata;
|
|
4
4
|
export declare const tool: Tool;
|
|
5
|
-
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./
|
|
5
|
+
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
|
|
6
6
|
declare const _default: {
|
|
7
7
|
metadata: Metadata;
|
|
8
8
|
tool: {
|
|
9
|
-
[x: string]: unknown;
|
|
10
|
-
name: string;
|
|
11
9
|
inputSchema: {
|
|
12
10
|
[x: string]: unknown;
|
|
13
11
|
type: "object";
|
|
14
12
|
properties?: {
|
|
15
|
-
[x: string]:
|
|
13
|
+
[x: string]: object;
|
|
16
14
|
} | undefined;
|
|
17
15
|
required?: string[] | undefined;
|
|
18
16
|
};
|
|
19
|
-
|
|
17
|
+
name: string;
|
|
20
18
|
description?: string | undefined;
|
|
21
19
|
outputSchema?: {
|
|
22
20
|
[x: string]: unknown;
|
|
23
21
|
type: "object";
|
|
24
22
|
properties?: {
|
|
25
|
-
[x: string]:
|
|
23
|
+
[x: string]: object;
|
|
26
24
|
} | undefined;
|
|
27
25
|
required?: string[] | undefined;
|
|
28
26
|
} | undefined;
|
|
29
27
|
annotations?: {
|
|
30
|
-
[x: string]: unknown;
|
|
31
28
|
title?: string | undefined;
|
|
32
29
|
readOnlyHint?: boolean | undefined;
|
|
33
30
|
destructiveHint?: boolean | undefined;
|
|
34
31
|
idempotentHint?: boolean | undefined;
|
|
35
32
|
openWorldHint?: boolean | undefined;
|
|
36
33
|
} | undefined;
|
|
34
|
+
execution?: {
|
|
35
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
36
|
+
} | undefined;
|
|
37
37
|
_meta?: {
|
|
38
38
|
[x: string]: unknown;
|
|
39
39
|
} | undefined;
|
|
40
|
+
icons?: {
|
|
41
|
+
src: string;
|
|
42
|
+
mimeType?: string | undefined;
|
|
43
|
+
sizes?: string[] | undefined;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
40
46
|
};
|
|
41
|
-
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./
|
|
47
|
+
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
|
|
42
48
|
};
|
|
43
49
|
export default _default;
|
|
44
50
|
//# sourceMappingURL=docs-search-tool.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.d.mts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.mts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,8CAYlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAZ+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAcnF,wBAA2C"}
|
package/docs-search-tool.d.ts
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { Metadata } from "./
|
|
1
|
+
import { Metadata } from "./types.js";
|
|
2
2
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
export declare const metadata: Metadata;
|
|
4
4
|
export declare const tool: Tool;
|
|
5
|
-
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./
|
|
5
|
+
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
|
|
6
6
|
declare const _default: {
|
|
7
7
|
metadata: Metadata;
|
|
8
8
|
tool: {
|
|
9
|
-
[x: string]: unknown;
|
|
10
|
-
name: string;
|
|
11
9
|
inputSchema: {
|
|
12
10
|
[x: string]: unknown;
|
|
13
11
|
type: "object";
|
|
14
12
|
properties?: {
|
|
15
|
-
[x: string]:
|
|
13
|
+
[x: string]: object;
|
|
16
14
|
} | undefined;
|
|
17
15
|
required?: string[] | undefined;
|
|
18
16
|
};
|
|
19
|
-
|
|
17
|
+
name: string;
|
|
20
18
|
description?: string | undefined;
|
|
21
19
|
outputSchema?: {
|
|
22
20
|
[x: string]: unknown;
|
|
23
21
|
type: "object";
|
|
24
22
|
properties?: {
|
|
25
|
-
[x: string]:
|
|
23
|
+
[x: string]: object;
|
|
26
24
|
} | undefined;
|
|
27
25
|
required?: string[] | undefined;
|
|
28
26
|
} | undefined;
|
|
29
27
|
annotations?: {
|
|
30
|
-
[x: string]: unknown;
|
|
31
28
|
title?: string | undefined;
|
|
32
29
|
readOnlyHint?: boolean | undefined;
|
|
33
30
|
destructiveHint?: boolean | undefined;
|
|
34
31
|
idempotentHint?: boolean | undefined;
|
|
35
32
|
openWorldHint?: boolean | undefined;
|
|
36
33
|
} | undefined;
|
|
34
|
+
execution?: {
|
|
35
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
36
|
+
} | undefined;
|
|
37
37
|
_meta?: {
|
|
38
38
|
[x: string]: unknown;
|
|
39
39
|
} | undefined;
|
|
40
|
+
icons?: {
|
|
41
|
+
src: string;
|
|
42
|
+
mimeType?: string | undefined;
|
|
43
|
+
sizes?: string[] | undefined;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
40
46
|
};
|
|
41
|
-
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./
|
|
47
|
+
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
|
|
42
48
|
};
|
|
43
49
|
export default _default;
|
|
44
50
|
//# sourceMappingURL=docs-search-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.d.ts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.ts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IA0BlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,8CAYlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAZ+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAcnF,wBAA2C"}
|
package/docs-search-tool.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.handler = exports.tool = exports.metadata = void 0;
|
|
5
|
-
const types_1 = require("./
|
|
5
|
+
const types_1 = require("./types.js");
|
|
6
6
|
exports.metadata = {
|
|
7
7
|
resource: 'all',
|
|
8
8
|
operation: 'read',
|
|
@@ -41,6 +41,9 @@ const handler = async (_, args) => {
|
|
|
41
41
|
const body = args;
|
|
42
42
|
const query = new URLSearchParams(body).toString();
|
|
43
43
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
throw new Error(`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`);
|
|
46
|
+
}
|
|
44
47
|
return (0, types_1.asTextContentResult)(await result.json());
|
|
45
48
|
};
|
|
46
49
|
exports.handler = handler;
|
package/docs-search-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
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,KAAK,EAAE,CAAC,CAAC;IAExD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,yCAAyC,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,2BAAmB,EAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAZW,QAAA,OAAO,WAYlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
package/docs-search-tool.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { asTextContentResult } from "./
|
|
2
|
+
import { asTextContentResult } from "./types.mjs";
|
|
3
3
|
export const metadata = {
|
|
4
4
|
resource: 'all',
|
|
5
5
|
operation: 'read',
|
|
@@ -38,6 +38,9 @@ export const handler = async (_, args) => {
|
|
|
38
38
|
const body = args;
|
|
39
39
|
const query = new URLSearchParams(body).toString();
|
|
40
40
|
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
41
|
+
if (!result.ok) {
|
|
42
|
+
throw new Error(`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`);
|
|
43
|
+
}
|
|
41
44
|
return asTextContentResult(await result.json());
|
|
42
45
|
};
|
|
43
46
|
export default { metadata, tool, handler };
|
package/docs-search-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-search-tool.mjs","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAY,mBAAmB,EAAE;AAIxC,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,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AAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,UAAU,yCAAyC,MAAM,MAAM,CAAC,IAAI,EAAE,EAAE,CACrG,CAAC;IACJ,CAAC;IAED,OAAO,mBAAmB,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
package/http.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.mts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAKO,OAAO,MAAM,SAAS;
|
|
1
|
+
{"version":3,"file":"http.d.mts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAKO,OAAO,MAAM,SAAS;OACtB,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAA+B;AAuErD,eAAO,MAAM,iBAAiB,GAAI,gCAG/B;IACD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,OAAO,CAAC,OAUX,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,SAAS,UAAU,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,kBAYtG,CAAC"}
|
package/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAKO,OAAO,MAAM,SAAS;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAKO,OAAO,MAAM,SAAS;OACtB,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAA+B;AAuErD,eAAO,MAAM,iBAAiB,GAAI,gCAG/B;IACD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,OAAO,CAAC,OAUX,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,SAAS,UAAU,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,kBAYtG,CAAC"}
|
package/http.js
CHANGED
|
@@ -7,26 +7,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.launchStreamableHTTPServer = exports.streamableHTTPApp = void 0;
|
|
8
8
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
9
9
|
const express_1 = __importDefault(require("express"));
|
|
10
|
-
const v3_1 = require("zod-validation-error/v3");
|
|
11
|
-
const options_1 = require("./options.js");
|
|
12
10
|
const server_1 = require("./server.js");
|
|
13
11
|
const headers_1 = require("./headers.js");
|
|
14
|
-
const newServer = ({ clientOptions,
|
|
12
|
+
const newServer = ({ clientOptions, req, res, }) => {
|
|
15
13
|
const server = (0, server_1.newMcpServer)();
|
|
16
|
-
let mcpOptions;
|
|
17
|
-
try {
|
|
18
|
-
mcpOptions = (0, options_1.parseQueryOptions)(defaultMcpOptions, req.query);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
res.status(400).json({
|
|
22
|
-
jsonrpc: '2.0',
|
|
23
|
-
error: {
|
|
24
|
-
code: -32000,
|
|
25
|
-
message: `Invalid request: ${(0, v3_1.fromError)(error)}`,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
14
|
try {
|
|
31
15
|
const authOptions = (0, headers_1.parseAuthHeaders)(req);
|
|
32
16
|
(0, server_1.initMcpServer)({
|
|
@@ -35,7 +19,6 @@ const newServer = ({ clientOptions, mcpOptions: defaultMcpOptions, req, res, })
|
|
|
35
19
|
...clientOptions,
|
|
36
20
|
...authOptions,
|
|
37
21
|
},
|
|
38
|
-
mcpOptions,
|
|
39
22
|
});
|
|
40
23
|
}
|
|
41
24
|
catch (error) {
|
package/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAGtF,0FAAmG;AAEnG,sDAA8B;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAGtF,0FAAmG;AAEnG,sDAA8B;AAE9B,wCAAsE;AACtE,0CAA6C;AAE7C,MAAM,SAAS,GAAG,CAAC,EACjB,aAAa,EACb,GAAG,EACH,GAAG,GAKJ,EAAoB,EAAE;IACrB,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,0BAAgB,EAAC,GAAG,CAAC,CAAC;QAC1C,IAAA,sBAAa,EAAC;YACZ,MAAM,EAAE,MAAM;YACd,aAAa,EAAE;gBACb,GAAG,aAAa;gBAChB,GAAG,WAAW;aACf;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC,KAAK;gBACZ,OAAO,EAAE,iBAAiB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE;aAC3E;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,IAAI,GACR,CAAC,OAAiE,EAAE,EAAE,CACtE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IACpD,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACnD,6DAA6D;IAC7D,IAA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a,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAErB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B;AAEK,MAAM,0BAA0B,GAAG,KAAK,EAAE,OAAmB,EAAE,IAAiC,EAAE,EAAE;IACzG,MAAM,GAAG,GAAG,IAAA,yBAAiB,EAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,4CAA4C,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,iDAAiD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,0BAA0B,8BAYrC"}
|
package/http.mjs
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
3
3
|
import express from 'express';
|
|
4
|
-
import { fromError } from 'zod-validation-error/v3';
|
|
5
|
-
import { parseQueryOptions } from "./options.mjs";
|
|
6
4
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
7
5
|
import { parseAuthHeaders } from "./headers.mjs";
|
|
8
|
-
const newServer = ({ clientOptions,
|
|
6
|
+
const newServer = ({ clientOptions, req, res, }) => {
|
|
9
7
|
const server = newMcpServer();
|
|
10
|
-
let mcpOptions;
|
|
11
|
-
try {
|
|
12
|
-
mcpOptions = parseQueryOptions(defaultMcpOptions, req.query);
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
res.status(400).json({
|
|
16
|
-
jsonrpc: '2.0',
|
|
17
|
-
error: {
|
|
18
|
-
code: -32000,
|
|
19
|
-
message: `Invalid request: ${fromError(error)}`,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
8
|
try {
|
|
25
9
|
const authOptions = parseAuthHeaders(req);
|
|
26
10
|
initMcpServer({
|
|
@@ -29,7 +13,6 @@ const newServer = ({ clientOptions, mcpOptions: defaultMcpOptions, req, res, })
|
|
|
29
13
|
...clientOptions,
|
|
30
14
|
...authOptions,
|
|
31
15
|
},
|
|
32
|
-
mcpOptions,
|
|
33
16
|
});
|
|
34
17
|
}
|
|
35
18
|
catch (error) {
|
package/http.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.mjs","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,6BAA6B,EAAE,MAAM,oDAAoD;OAE3F,OAAO,MAAM,SAAS;
|
|
1
|
+
{"version":3,"file":"http.mjs","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,6BAA6B,EAAE,MAAM,oDAAoD;OAE3F,OAAO,MAAM,SAAS;OAEtB,EAAiB,aAAa,EAAE,YAAY,EAAE;OAC9C,EAAE,gBAAgB,EAAE;AAE3B,MAAM,SAAS,GAAG,CAAC,EACjB,aAAa,EACb,GAAG,EACH,GAAG,GAKJ,EAAoB,EAAE;IACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,C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,4CAA4C,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,iDAAiD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC"}
|
package/index.js
CHANGED
|
@@ -2,21 +2,16 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const server_1 = require("./server.js");
|
|
5
|
-
const tools_1 = require("./tools.js");
|
|
6
5
|
const options_1 = require("./options.js");
|
|
7
6
|
const stdio_1 = require("./stdio.js");
|
|
8
7
|
const http_1 = require("./http.js");
|
|
9
8
|
async function main() {
|
|
10
9
|
const options = parseOptionsOrError();
|
|
11
|
-
|
|
12
|
-
listAllTools();
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const selectedTools = await selectToolsOrError(tools_1.endpoints, options);
|
|
10
|
+
const selectedTools = await selectToolsOrError(options);
|
|
16
11
|
console.error(`MCP Server starting with ${selectedTools.length} tools:`, selectedTools.map((e) => e.tool.name));
|
|
17
12
|
switch (options.transport) {
|
|
18
13
|
case 'stdio':
|
|
19
|
-
await (0, stdio_1.launchStdioServer)(
|
|
14
|
+
await (0, stdio_1.launchStdioServer)();
|
|
20
15
|
break;
|
|
21
16
|
case 'http':
|
|
22
17
|
await (0, http_1.launchStreamableHTTPServer)(options, options.port ?? options.socket);
|
|
@@ -38,9 +33,9 @@ function parseOptionsOrError() {
|
|
|
38
33
|
process.exit(1);
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
|
-
async function selectToolsOrError(
|
|
36
|
+
async function selectToolsOrError(options) {
|
|
42
37
|
try {
|
|
43
|
-
const includedTools =
|
|
38
|
+
const includedTools = (0, server_1.selectTools)(options);
|
|
44
39
|
if (includedTools.length === 0) {
|
|
45
40
|
console.error('No tools match the provided filters.');
|
|
46
41
|
process.exit(1);
|
|
@@ -57,35 +52,4 @@ async function selectToolsOrError(endpoints, options) {
|
|
|
57
52
|
process.exit(1);
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
|
-
function listAllTools() {
|
|
61
|
-
if (tools_1.endpoints.length === 0) {
|
|
62
|
-
console.log('No tools available.');
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
console.log('Available tools:\n');
|
|
66
|
-
// Group endpoints by resource
|
|
67
|
-
const resourceGroups = new Map();
|
|
68
|
-
for (const endpoint of tools_1.endpoints) {
|
|
69
|
-
const resource = endpoint.metadata.resource;
|
|
70
|
-
if (!resourceGroups.has(resource)) {
|
|
71
|
-
resourceGroups.set(resource, []);
|
|
72
|
-
}
|
|
73
|
-
resourceGroups.get(resource).push(endpoint);
|
|
74
|
-
}
|
|
75
|
-
// Sort resources alphabetically
|
|
76
|
-
const sortedResources = Array.from(resourceGroups.keys()).sort();
|
|
77
|
-
// Display hierarchically by resource
|
|
78
|
-
for (const resource of sortedResources) {
|
|
79
|
-
console.log(`Resource: ${resource}`);
|
|
80
|
-
const resourceEndpoints = resourceGroups.get(resource);
|
|
81
|
-
// Sort endpoints by tool name
|
|
82
|
-
resourceEndpoints.sort((a, b) => a.tool.name.localeCompare(b.tool.name));
|
|
83
|
-
for (const endpoint of resourceEndpoints) {
|
|
84
|
-
const { tool, metadata: { operation, tags }, } = endpoint;
|
|
85
|
-
console.log(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
|
|
86
|
-
console.log(` Description: ${tool.description}`);
|
|
87
|
-
}
|
|
88
|
-
console.log('');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
55
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names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ACH,CAAC;AAED,KAAK,UAAU,kBAAkB,CAAC,OAAmB;IACnD,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/index.mjs
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { selectTools } from "./server.mjs";
|
|
3
|
-
import { endpoints } from "./tools.mjs";
|
|
4
3
|
import { parseCLIOptions } from "./options.mjs";
|
|
5
4
|
import { launchStdioServer } from "./stdio.mjs";
|
|
6
5
|
import { launchStreamableHTTPServer } from "./http.mjs";
|
|
7
6
|
async function main() {
|
|
8
7
|
const options = parseOptionsOrError();
|
|
9
|
-
|
|
10
|
-
listAllTools();
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const selectedTools = await selectToolsOrError(endpoints, options);
|
|
8
|
+
const selectedTools = await selectToolsOrError(options);
|
|
14
9
|
console.error(`MCP Server starting with ${selectedTools.length} tools:`, selectedTools.map((e) => e.tool.name));
|
|
15
10
|
switch (options.transport) {
|
|
16
11
|
case 'stdio':
|
|
17
|
-
await launchStdioServer(
|
|
12
|
+
await launchStdioServer();
|
|
18
13
|
break;
|
|
19
14
|
case 'http':
|
|
20
15
|
await launchStreamableHTTPServer(options, options.port ?? options.socket);
|
|
@@ -36,9 +31,9 @@ function parseOptionsOrError() {
|
|
|
36
31
|
process.exit(1);
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
|
-
async function selectToolsOrError(
|
|
34
|
+
async function selectToolsOrError(options) {
|
|
40
35
|
try {
|
|
41
|
-
const includedTools =
|
|
36
|
+
const includedTools = selectTools(options);
|
|
42
37
|
if (includedTools.length === 0) {
|
|
43
38
|
console.error('No tools match the provided filters.');
|
|
44
39
|
process.exit(1);
|
|
@@ -55,35 +50,4 @@ async function selectToolsOrError(endpoints, options) {
|
|
|
55
50
|
process.exit(1);
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
|
-
function listAllTools() {
|
|
59
|
-
if (endpoints.length === 0) {
|
|
60
|
-
console.log('No tools available.');
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
console.log('Available tools:\n');
|
|
64
|
-
// Group endpoints by resource
|
|
65
|
-
const resourceGroups = new Map();
|
|
66
|
-
for (const endpoint of endpoints) {
|
|
67
|
-
const resource = endpoint.metadata.resource;
|
|
68
|
-
if (!resourceGroups.has(resource)) {
|
|
69
|
-
resourceGroups.set(resource, []);
|
|
70
|
-
}
|
|
71
|
-
resourceGroups.get(resource).push(endpoint);
|
|
72
|
-
}
|
|
73
|
-
// Sort resources alphabetically
|
|
74
|
-
const sortedResources = Array.from(resourceGroups.keys()).sort();
|
|
75
|
-
// Display hierarchically by resource
|
|
76
|
-
for (const resource of sortedResources) {
|
|
77
|
-
console.log(`Resource: ${resource}`);
|
|
78
|
-
const resourceEndpoints = resourceGroups.get(resource);
|
|
79
|
-
// Sort endpoints by tool name
|
|
80
|
-
resourceEndpoints.sort((a, b) => a.tool.name.localeCompare(b.tool.name));
|
|
81
|
-
for (const endpoint of resourceEndpoints) {
|
|
82
|
-
const { tool, metadata: { operation, tags }, } = endpoint;
|
|
83
|
-
console.log(` - ${tool.name} (${operation}) ${tags.length > 0 ? `tags: ${tags.join(', ')}` : ''}`);
|
|
84
|
-
console.log(` Description: ${tool.description}`);
|
|
85
|
-
}
|
|
86
|
-
console.log('');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
53
|
//# sourceMappingURL=index.mjs.map
|