lark-billing-mcp 0.7.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.
Files changed (94) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -0
  3. package/code-tool-types.d.mts +13 -0
  4. package/code-tool-types.d.mts.map +1 -0
  5. package/code-tool-types.d.ts +13 -0
  6. package/code-tool-types.d.ts.map +1 -0
  7. package/code-tool-types.js +4 -0
  8. package/code-tool-types.js.map +1 -0
  9. package/code-tool-types.mjs +3 -0
  10. package/code-tool-types.mjs.map +1 -0
  11. package/code-tool.d.mts +12 -0
  12. package/code-tool.d.mts.map +1 -0
  13. package/code-tool.d.ts +12 -0
  14. package/code-tool.d.ts.map +1 -0
  15. package/code-tool.js +85 -0
  16. package/code-tool.js.map +1 -0
  17. package/code-tool.mjs +82 -0
  18. package/code-tool.mjs.map +1 -0
  19. package/docs-search-tool.d.mts +50 -0
  20. package/docs-search-tool.d.mts.map +1 -0
  21. package/docs-search-tool.d.ts +50 -0
  22. package/docs-search-tool.d.ts.map +1 -0
  23. package/docs-search-tool.js +51 -0
  24. package/docs-search-tool.js.map +1 -0
  25. package/docs-search-tool.mjs +47 -0
  26. package/docs-search-tool.mjs.map +1 -0
  27. package/headers.d.mts +4 -0
  28. package/headers.d.mts.map +1 -0
  29. package/headers.d.ts +4 -0
  30. package/headers.d.ts.map +1 -0
  31. package/headers.js +10 -0
  32. package/headers.js.map +1 -0
  33. package/headers.mjs +6 -0
  34. package/headers.mjs.map +1 -0
  35. package/http.d.mts +9 -0
  36. package/http.d.mts.map +1 -0
  37. package/http.d.ts +9 -0
  38. package/http.d.ts.map +1 -0
  39. package/http.js +91 -0
  40. package/http.js.map +1 -0
  41. package/http.mjs +83 -0
  42. package/http.mjs.map +1 -0
  43. package/index.d.mts +3 -0
  44. package/index.d.mts.map +1 -0
  45. package/index.d.ts +3 -0
  46. package/index.d.ts.map +1 -0
  47. package/index.js +55 -0
  48. package/index.js.map +1 -0
  49. package/index.mjs +53 -0
  50. package/index.mjs.map +1 -0
  51. package/options.d.mts +11 -0
  52. package/options.d.mts.map +1 -0
  53. package/options.d.ts +11 -0
  54. package/options.d.ts.map +1 -0
  55. package/options.js +72 -0
  56. package/options.js.map +1 -0
  57. package/options.mjs +65 -0
  58. package/options.mjs.map +1 -0
  59. package/package.json +161 -0
  60. package/server.d.mts +30 -0
  61. package/server.d.mts.map +1 -0
  62. package/server.d.ts +30 -0
  63. package/server.d.ts.map +1 -0
  64. package/server.js +121 -0
  65. package/server.js.map +1 -0
  66. package/server.mjs +109 -0
  67. package/server.mjs.map +1 -0
  68. package/src/code-tool-types.ts +15 -0
  69. package/src/code-tool.ts +96 -0
  70. package/src/docs-search-tool.ts +59 -0
  71. package/src/headers.ts +10 -0
  72. package/src/http.ts +109 -0
  73. package/src/index.ts +61 -0
  74. package/src/options.ts +92 -0
  75. package/src/server.ts +147 -0
  76. package/src/stdio.ts +12 -0
  77. package/src/tsconfig.json +11 -0
  78. package/src/types.ts +115 -0
  79. package/stdio.d.mts +2 -0
  80. package/stdio.d.mts.map +1 -0
  81. package/stdio.d.ts +2 -0
  82. package/stdio.d.ts.map +1 -0
  83. package/stdio.js +14 -0
  84. package/stdio.js.map +1 -0
  85. package/stdio.mjs +10 -0
  86. package/stdio.mjs.map +1 -0
  87. package/types.d.mts +52 -0
  88. package/types.d.mts.map +1 -0
  89. package/types.d.ts +52 -0
  90. package/types.d.ts.map +1 -0
  91. package/types.js +58 -0
  92. package/types.js.map +1 -0
  93. package/types.mjs +53 -0
  94. package/types.mjs.map +1 -0
@@ -0,0 +1,50 @@
1
+ import { Metadata } from "./types.js";
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ export declare const metadata: Metadata;
4
+ export declare const tool: Tool;
5
+ export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
6
+ declare const _default: {
7
+ metadata: Metadata;
8
+ tool: {
9
+ inputSchema: {
10
+ [x: string]: unknown;
11
+ type: "object";
12
+ properties?: {
13
+ [x: string]: object;
14
+ } | undefined;
15
+ required?: string[] | undefined;
16
+ };
17
+ name: string;
18
+ description?: string | undefined;
19
+ outputSchema?: {
20
+ [x: string]: unknown;
21
+ type: "object";
22
+ properties?: {
23
+ [x: string]: object;
24
+ } | undefined;
25
+ required?: string[] | undefined;
26
+ } | undefined;
27
+ annotations?: {
28
+ title?: string | undefined;
29
+ readOnlyHint?: boolean | undefined;
30
+ destructiveHint?: boolean | undefined;
31
+ idempotentHint?: boolean | undefined;
32
+ openWorldHint?: boolean | undefined;
33
+ } | undefined;
34
+ execution?: {
35
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
36
+ } | undefined;
37
+ _meta?: {
38
+ [x: string]: unknown;
39
+ } | undefined;
40
+ icons?: {
41
+ src: string;
42
+ mimeType?: string | undefined;
43
+ sizes?: string[] | undefined;
44
+ }[] | undefined;
45
+ title?: string | undefined;
46
+ };
47
+ handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./types").ToolCallResult>;
48
+ };
49
+ export default _default;
50
+ //# sourceMappingURL=docs-search-tool.d.ts.map
@@ -0,0 +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,8CAYlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAZ+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAcnF,wBAA2C"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.handler = exports.tool = exports.metadata = void 0;
5
+ const types_1 = require("./types.js");
6
+ exports.metadata = {
7
+ resource: 'all',
8
+ operation: 'read',
9
+ tags: [],
10
+ httpMethod: 'get',
11
+ };
12
+ exports.tool = {
13
+ name: 'search_docs',
14
+ description: 'Search for documentation for how to use the client to interact with the API.',
15
+ inputSchema: {
16
+ type: 'object',
17
+ properties: {
18
+ query: {
19
+ type: 'string',
20
+ description: 'The query to search for.',
21
+ },
22
+ language: {
23
+ type: 'string',
24
+ description: 'The language for the SDK to search for.',
25
+ enum: ['http', 'python', 'go', 'typescript', 'javascript', 'terraform', 'ruby', 'java', 'kotlin'],
26
+ },
27
+ detail: {
28
+ type: 'string',
29
+ description: 'The amount of detail to return.',
30
+ enum: ['default', 'verbose'],
31
+ },
32
+ },
33
+ required: ['query', 'language'],
34
+ },
35
+ annotations: {
36
+ readOnlyHint: true,
37
+ },
38
+ };
39
+ const docsSearchURL = process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/lark/docs/search';
40
+ const handler = async (_, args) => {
41
+ const body = args;
42
+ const query = new URLSearchParams(body).toString();
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
+ }
47
+ return (0, types_1.asTextContentResult)(await result.json());
48
+ };
49
+ exports.handler = handler;
50
+ exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
51
+ //# sourceMappingURL=docs-search-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAwD;AAI3C,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;I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,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"}
@@ -0,0 +1,47 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { asTextContentResult } from "./types.mjs";
3
+ export const metadata = {
4
+ resource: 'all',
5
+ operation: 'read',
6
+ tags: [],
7
+ httpMethod: 'get',
8
+ };
9
+ export const tool = {
10
+ name: 'search_docs',
11
+ description: 'Search for documentation for how to use the client to interact with the API.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ query: {
16
+ type: 'string',
17
+ description: 'The query to search for.',
18
+ },
19
+ language: {
20
+ type: 'string',
21
+ description: 'The language for the SDK to search for.',
22
+ enum: ['http', 'python', 'go', 'typescript', 'javascript', 'terraform', 'ruby', 'java', 'kotlin'],
23
+ },
24
+ detail: {
25
+ type: 'string',
26
+ description: 'The amount of detail to return.',
27
+ enum: ['default', 'verbose'],
28
+ },
29
+ },
30
+ required: ['query', 'language'],
31
+ },
32
+ annotations: {
33
+ readOnlyHint: true,
34
+ },
35
+ };
36
+ const docsSearchURL = process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/lark/docs/search';
37
+ export const handler = async (_, args) => {
38
+ const body = args;
39
+ const query = new URLSearchParams(body).toString();
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
+ }
44
+ return asTextContentResult(await result.json());
45
+ };
46
+ export default { metadata, tool, handler };
47
+ //# sourceMappingURL=docs-search-tool.mjs.map
@@ -0,0 +1 @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,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,IAAI,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,mBAAmB,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
package/headers.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ import { IncomingMessage } from 'node:http';
2
+ import { ClientOptions } from 'lark-billing';
3
+ export declare const parseAuthHeaders: (req: IncomingMessage) => Partial<ClientOptions>;
4
+ //# sourceMappingURL=headers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.mts","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE,MAAM,WAAW;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,KAAG,OAAO,CAAC,aAAa,CAI5E,CAAC"}
package/headers.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { IncomingMessage } from 'node:http';
2
+ import { ClientOptions } from 'lark-billing';
3
+ export declare const parseAuthHeaders: (req: IncomingMessage) => Partial<ClientOptions>;
4
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE,MAAM,WAAW;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,KAAG,OAAO,CAAC,aAAa,CAI5E,CAAC"}
package/headers.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.parseAuthHeaders = void 0;
5
+ const parseAuthHeaders = (req) => {
6
+ const apiKey = Array.isArray(req.headers['x-api-key']) ? req.headers['x-api-key'][0] : req.headers['x-api-key'];
7
+ return { apiKey };
8
+ };
9
+ exports.parseAuthHeaders = parseAuthHeaders;
10
+ //# sourceMappingURL=headers.js.map
package/headers.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.js","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAK/E,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAA0B,EAAE;IAC/E,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnG,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
package/headers.mjs ADDED
@@ -0,0 +1,6 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export const parseAuthHeaders = (req) => {
3
+ const apiKey = Array.isArray(req.headers['x-api-key']) ? req.headers['x-api-key'][0] : req.headers['x-api-key'];
4
+ return { apiKey };
5
+ };
6
+ //# sourceMappingURL=headers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.mjs","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAKtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAA0B,EAAE;IAC/E,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnG,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC"}
package/http.d.mts ADDED
@@ -0,0 +1,9 @@
1
+ import express from 'express';
2
+ import { McpOptions } from "./options.mjs";
3
+ import { ClientOptions } from "./server.mjs";
4
+ export declare const streamableHTTPApp: ({ clientOptions, mcpOptions, }: {
5
+ clientOptions?: ClientOptions;
6
+ mcpOptions?: McpOptions;
7
+ }) => express.Express;
8
+ export declare const launchStreamableHTTPServer: (options: McpOptions, port: number | string | undefined) => Promise<void>;
9
+ //# sourceMappingURL=http.d.mts.map
package/http.d.mts.map ADDED
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,9 @@
1
+ import express from 'express';
2
+ import { McpOptions } from "./options.js";
3
+ import { ClientOptions } from "./server.js";
4
+ export declare const streamableHTTPApp: ({ clientOptions, mcpOptions, }: {
5
+ clientOptions?: ClientOptions;
6
+ mcpOptions?: McpOptions;
7
+ }) => express.Express;
8
+ export declare const launchStreamableHTTPServer: (options: McpOptions, port: number | string | undefined) => Promise<void>;
9
+ //# sourceMappingURL=http.d.ts.map
package/http.d.ts.map ADDED
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.launchStreamableHTTPServer = exports.streamableHTTPApp = void 0;
8
+ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
9
+ const express_1 = __importDefault(require("express"));
10
+ const server_1 = require("./server.js");
11
+ const headers_1 = require("./headers.js");
12
+ const newServer = ({ clientOptions, req, res, }) => {
13
+ const server = (0, server_1.newMcpServer)();
14
+ try {
15
+ const authOptions = (0, headers_1.parseAuthHeaders)(req);
16
+ (0, server_1.initMcpServer)({
17
+ server: server,
18
+ clientOptions: {
19
+ ...clientOptions,
20
+ ...authOptions,
21
+ },
22
+ });
23
+ }
24
+ catch (error) {
25
+ res.status(401).json({
26
+ jsonrpc: '2.0',
27
+ error: {
28
+ code: -32000,
29
+ message: `Unauthorized: ${error instanceof Error ? error.message : error}`,
30
+ },
31
+ });
32
+ return null;
33
+ }
34
+ return server;
35
+ };
36
+ const post = (options) => async (req, res) => {
37
+ const server = newServer({ ...options, req, res });
38
+ // If we return null, we already set the authorization error.
39
+ if (server === null)
40
+ return;
41
+ const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
42
+ // Stateless server
43
+ sessionIdGenerator: undefined,
44
+ });
45
+ await server.connect(transport);
46
+ await transport.handleRequest(req, res, req.body);
47
+ };
48
+ const get = async (req, res) => {
49
+ res.status(405).json({
50
+ jsonrpc: '2.0',
51
+ error: {
52
+ code: -32000,
53
+ message: 'Method not supported',
54
+ },
55
+ });
56
+ };
57
+ const del = async (req, res) => {
58
+ res.status(405).json({
59
+ jsonrpc: '2.0',
60
+ error: {
61
+ code: -32000,
62
+ message: 'Method not supported',
63
+ },
64
+ });
65
+ };
66
+ const streamableHTTPApp = ({ clientOptions = {}, mcpOptions = {}, }) => {
67
+ const app = (0, express_1.default)();
68
+ app.set('query parser', 'extended');
69
+ app.use(express_1.default.json());
70
+ app.get('/', get);
71
+ app.post('/', post({ clientOptions, mcpOptions }));
72
+ app.delete('/', del);
73
+ return app;
74
+ };
75
+ exports.streamableHTTPApp = streamableHTTPApp;
76
+ const launchStreamableHTTPServer = async (options, port) => {
77
+ const app = (0, exports.streamableHTTPApp)({ mcpOptions: options });
78
+ const server = app.listen(port);
79
+ const address = server.address();
80
+ if (typeof address === 'string') {
81
+ console.error(`MCP Server running on streamable HTTP at ${address}`);
82
+ }
83
+ else if (address !== null) {
84
+ console.error(`MCP Server running on streamable HTTP on port ${address.port}`);
85
+ }
86
+ else {
87
+ console.error(`MCP Server running on streamable HTTP on port ${port}`);
88
+ }
89
+ };
90
+ exports.launchStreamableHTTPServer = launchStreamableHTTPServer;
91
+ //# sourceMappingURL=http.js.map
package/http.js.map ADDED
@@ -0,0 +1 @@
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,SAA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AAO,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 ADDED
@@ -0,0 +1,83 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
3
+ import express from 'express';
4
+ import { initMcpServer, newMcpServer } from "./server.mjs";
5
+ import { parseAuthHeaders } from "./headers.mjs";
6
+ const newServer = ({ clientOptions, req, res, }) => {
7
+ const server = newMcpServer();
8
+ try {
9
+ const authOptions = parseAuthHeaders(req);
10
+ initMcpServer({
11
+ server: server,
12
+ clientOptions: {
13
+ ...clientOptions,
14
+ ...authOptions,
15
+ },
16
+ });
17
+ }
18
+ catch (error) {
19
+ res.status(401).json({
20
+ jsonrpc: '2.0',
21
+ error: {
22
+ code: -32000,
23
+ message: `Unauthorized: ${error instanceof Error ? error.message : error}`,
24
+ },
25
+ });
26
+ return null;
27
+ }
28
+ return server;
29
+ };
30
+ const post = (options) => async (req, res) => {
31
+ const server = newServer({ ...options, req, res });
32
+ // If we return null, we already set the authorization error.
33
+ if (server === null)
34
+ return;
35
+ const transport = new StreamableHTTPServerTransport({
36
+ // Stateless server
37
+ sessionIdGenerator: undefined,
38
+ });
39
+ await server.connect(transport);
40
+ await transport.handleRequest(req, res, req.body);
41
+ };
42
+ const get = async (req, res) => {
43
+ res.status(405).json({
44
+ jsonrpc: '2.0',
45
+ error: {
46
+ code: -32000,
47
+ message: 'Method not supported',
48
+ },
49
+ });
50
+ };
51
+ const del = async (req, res) => {
52
+ res.status(405).json({
53
+ jsonrpc: '2.0',
54
+ error: {
55
+ code: -32000,
56
+ message: 'Method not supported',
57
+ },
58
+ });
59
+ };
60
+ export const streamableHTTPApp = ({ clientOptions = {}, mcpOptions = {}, }) => {
61
+ const app = express();
62
+ app.set('query parser', 'extended');
63
+ app.use(express.json());
64
+ app.get('/', get);
65
+ app.post('/', post({ clientOptions, mcpOptions }));
66
+ app.delete('/', del);
67
+ return app;
68
+ };
69
+ export const launchStreamableHTTPServer = async (options, port) => {
70
+ const app = streamableHTTPApp({ mcpOptions: options });
71
+ const server = app.listen(port);
72
+ const address = server.address();
73
+ if (typeof address === 'string') {
74
+ console.error(`MCP Server running on streamable HTTP at ${address}`);
75
+ }
76
+ else if (address !== null) {
77
+ console.error(`MCP Server running on streamable HTTP on port ${address.port}`);
78
+ }
79
+ else {
80
+ console.error(`MCP Server running on streamable HTTP on port ${port}`);
81
+ }
82
+ };
83
+ //# sourceMappingURL=http.mjs.map
package/http.mjs.map ADDED
@@ -0,0 +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;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,GAA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;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"}
package/index.d.mts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""}
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":""}
package/index.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const server_1 = require("./server.js");
5
+ const options_1 = require("./options.js");
6
+ const stdio_1 = require("./stdio.js");
7
+ const http_1 = require("./http.js");
8
+ async function main() {
9
+ const options = parseOptionsOrError();
10
+ const selectedTools = await selectToolsOrError(options);
11
+ console.error(`MCP Server starting with ${selectedTools.length} tools:`, selectedTools.map((e) => e.tool.name));
12
+ switch (options.transport) {
13
+ case 'stdio':
14
+ await (0, stdio_1.launchStdioServer)();
15
+ break;
16
+ case 'http':
17
+ await (0, http_1.launchStreamableHTTPServer)(options, options.port ?? options.socket);
18
+ break;
19
+ }
20
+ }
21
+ if (require.main === module) {
22
+ main().catch((error) => {
23
+ console.error('Fatal error in main():', error);
24
+ process.exit(1);
25
+ });
26
+ }
27
+ function parseOptionsOrError() {
28
+ try {
29
+ return (0, options_1.parseCLIOptions)();
30
+ }
31
+ catch (error) {
32
+ console.error('Error parsing options:', error);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ async function selectToolsOrError(options) {
37
+ try {
38
+ const includedTools = (0, server_1.selectTools)(options);
39
+ if (includedTools.length === 0) {
40
+ console.error('No tools match the provided filters.');
41
+ process.exit(1);
42
+ }
43
+ return includedTools;
44
+ }
45
+ catch (error) {
46
+ if (error instanceof Error) {
47
+ console.error('Error filtering tools:', error.message);
48
+ }
49
+ else {
50
+ console.error('Error filtering tools:', error);
51
+ }
52
+ process.exit(1);
53
+ }
54
+ }
55
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAEA,wCAAuC;AACvC,0CAAwD;AACxD,sCAA4C;AAC5C,oCAAoD;AAGpD,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,aAAa,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAExD,OAAO,CAAC,KAAK,CACX,4BAA4B,aAAa,CAAC,MAAM,SAAS,EACzD,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACtC,CAAC;IAEF,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,OAAO;YACV,MAAM,IAAA,yBAAiB,GAAE,CAAC;YAC1B,MAAM;QACR,KAAK,MAAM;YACT,MAAM,IAAA,iCAA0B,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1E,MAAM;IACV,CAAC;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB;IAC1B,IAAI,CAAC;QACH,OAAO,IAAA,yBAAe,GAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,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 ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ import { selectTools } from "./server.mjs";
3
+ import { parseCLIOptions } from "./options.mjs";
4
+ import { launchStdioServer } from "./stdio.mjs";
5
+ import { launchStreamableHTTPServer } from "./http.mjs";
6
+ async function main() {
7
+ const options = parseOptionsOrError();
8
+ const selectedTools = await selectToolsOrError(options);
9
+ console.error(`MCP Server starting with ${selectedTools.length} tools:`, selectedTools.map((e) => e.tool.name));
10
+ switch (options.transport) {
11
+ case 'stdio':
12
+ await launchStdioServer();
13
+ break;
14
+ case 'http':
15
+ await launchStreamableHTTPServer(options, options.port ?? options.socket);
16
+ break;
17
+ }
18
+ }
19
+ if (require.main === module) {
20
+ main().catch((error) => {
21
+ console.error('Fatal error in main():', error);
22
+ process.exit(1);
23
+ });
24
+ }
25
+ function parseOptionsOrError() {
26
+ try {
27
+ return parseCLIOptions();
28
+ }
29
+ catch (error) {
30
+ console.error('Error parsing options:', error);
31
+ process.exit(1);
32
+ }
33
+ }
34
+ async function selectToolsOrError(options) {
35
+ try {
36
+ const includedTools = selectTools(options);
37
+ if (includedTools.length === 0) {
38
+ console.error('No tools match the provided filters.');
39
+ process.exit(1);
40
+ }
41
+ return includedTools;
42
+ }
43
+ catch (error) {
44
+ if (error instanceof Error) {
45
+ console.error('Error filtering tools:', error.message);
46
+ }
47
+ else {
48
+ console.error('Error filtering tools:', error);
49
+ }
50
+ process.exit(1);
51
+ }
52
+ }
53
+ //# sourceMappingURL=index.mjs.map
package/index.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";OAEO,EAAE,WAAW,EAAE;OACf,EAAc,eAAe,EAAE;OAC/B,EAAE,iBAAiB,EAAE;OACrB,EAAE,0BAA0B,EAAE;AAGrC,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,MAAM,aAAa,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAExD,OAAO,CAAC,KAAK,CACX,4BAA4B,aAAa,CAAC,MAAM,SAAS,EACzD,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAA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K,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/options.d.mts ADDED
@@ -0,0 +1,11 @@
1
+ export type CLIOptions = McpOptions & {
2
+ transport: 'stdio' | 'http';
3
+ port: number | undefined;
4
+ socket: string | undefined;
5
+ };
6
+ export type McpOptions = {
7
+ includeDocsTools?: boolean | undefined;
8
+ };
9
+ export declare function parseCLIOptions(): CLIOptions;
10
+ export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
11
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,wBAAgB,eAAe,IAAI,UAAU,CA+C5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAYxF"}
package/options.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export type CLIOptions = McpOptions & {
2
+ transport: 'stdio' | 'http';
3
+ port: number | undefined;
4
+ socket: string | undefined;
5
+ };
6
+ export type McpOptions = {
7
+ includeDocsTools?: boolean | undefined;
8
+ };
9
+ export declare function parseCLIOptions(): CLIOptions;
10
+ export declare function parseQueryOptions(defaultOptions: McpOptions, query: unknown): McpOptions;
11
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,wBAAgB,eAAe,IAAI,UAAU,CA+C5C;AAiBD,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAYxF"}