@metronome/mcp 3.0.0 → 3.5.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 (146) hide show
  1. package/README.md +3 -3
  2. package/auth.d.mts +6 -0
  3. package/auth.d.mts.map +1 -0
  4. package/auth.d.ts +6 -0
  5. package/auth.d.ts.map +1 -0
  6. package/auth.js +37 -0
  7. package/auth.js.map +1 -0
  8. package/{headers.js → auth.mjs} +16 -6
  9. package/auth.mjs.map +1 -0
  10. package/code-tool-paths.cjs +8 -0
  11. package/code-tool-paths.cjs.map +1 -0
  12. package/code-tool-paths.d.cts +2 -0
  13. package/code-tool-paths.d.cts.map +1 -0
  14. package/code-tool-types.d.mts.map +1 -1
  15. package/code-tool-types.d.ts.map +1 -1
  16. package/code-tool-worker.d.mts +5 -0
  17. package/code-tool-worker.d.mts.map +1 -0
  18. package/code-tool-worker.d.ts +5 -0
  19. package/code-tool-worker.d.ts.map +1 -0
  20. package/code-tool-worker.js +383 -0
  21. package/code-tool-worker.js.map +1 -0
  22. package/code-tool-worker.mjs +345 -0
  23. package/code-tool-worker.mjs.map +1 -0
  24. package/code-tool.d.mts +11 -2
  25. package/code-tool.d.mts.map +1 -1
  26. package/code-tool.d.ts +11 -2
  27. package/code-tool.d.ts.map +1 -1
  28. package/code-tool.js +283 -41
  29. package/code-tool.js.map +1 -1
  30. package/code-tool.mjs +251 -42
  31. package/code-tool.mjs.map +1 -1
  32. package/docs-search-tool.d.mts +11 -3
  33. package/docs-search-tool.d.mts.map +1 -1
  34. package/docs-search-tool.d.ts +11 -3
  35. package/docs-search-tool.d.ts.map +1 -1
  36. package/docs-search-tool.js +58 -5
  37. package/docs-search-tool.js.map +1 -1
  38. package/docs-search-tool.mjs +57 -5
  39. package/docs-search-tool.mjs.map +1 -1
  40. package/http.d.mts +6 -3
  41. package/http.d.mts.map +1 -1
  42. package/http.d.ts +6 -3
  43. package/http.d.ts.map +1 -1
  44. package/http.js +130 -28
  45. package/http.js.map +1 -1
  46. package/http.mjs +130 -28
  47. package/http.mjs.map +1 -1
  48. package/index.js +17 -12
  49. package/index.js.map +1 -1
  50. package/index.mjs +17 -12
  51. package/index.mjs.map +1 -1
  52. package/instructions.d.mts +5 -0
  53. package/instructions.d.mts.map +1 -0
  54. package/instructions.d.ts +5 -0
  55. package/instructions.d.ts.map +1 -0
  56. package/instructions.js +61 -0
  57. package/instructions.js.map +1 -0
  58. package/instructions.mjs +55 -0
  59. package/instructions.mjs.map +1 -0
  60. package/local-docs-search.d.mts +28 -0
  61. package/local-docs-search.d.mts.map +1 -0
  62. package/local-docs-search.d.ts +28 -0
  63. package/local-docs-search.d.ts.map +1 -0
  64. package/local-docs-search.js +4780 -0
  65. package/local-docs-search.js.map +1 -0
  66. package/local-docs-search.mjs +4740 -0
  67. package/local-docs-search.mjs.map +1 -0
  68. package/logger.d.mts +7 -0
  69. package/logger.d.mts.map +1 -0
  70. package/logger.d.ts +7 -0
  71. package/logger.d.ts.map +1 -0
  72. package/logger.js +29 -0
  73. package/logger.js.map +1 -0
  74. package/logger.mjs +22 -0
  75. package/logger.mjs.map +1 -0
  76. package/methods.d.mts +10 -0
  77. package/methods.d.mts.map +1 -0
  78. package/methods.d.ts +10 -0
  79. package/methods.d.ts.map +1 -0
  80. package/methods.js +767 -0
  81. package/methods.js.map +1 -0
  82. package/methods.mjs +763 -0
  83. package/methods.mjs.map +1 -0
  84. package/options.d.mts +12 -0
  85. package/options.d.mts.map +1 -1
  86. package/options.d.ts +12 -0
  87. package/options.d.ts.map +1 -1
  88. package/options.js +81 -12
  89. package/options.js.map +1 -1
  90. package/options.mjs +81 -12
  91. package/options.mjs.map +1 -1
  92. package/package.json +89 -15
  93. package/server.d.mts +18 -10
  94. package/server.d.mts.map +1 -1
  95. package/server.d.ts +18 -10
  96. package/server.d.ts.map +1 -1
  97. package/server.js +89 -42
  98. package/server.js.map +1 -1
  99. package/server.mjs +88 -39
  100. package/server.mjs.map +1 -1
  101. package/src/{headers.ts → auth.ts} +18 -1
  102. package/src/code-tool-paths.cts +5 -0
  103. package/src/code-tool-types.ts +1 -0
  104. package/src/code-tool-worker.ts +396 -0
  105. package/src/code-tool.ts +337 -49
  106. package/src/docs-search-tool.ts +86 -7
  107. package/src/http.ts +154 -33
  108. package/src/index.ts +19 -13
  109. package/src/instructions.ts +83 -0
  110. package/src/local-docs-search.ts +5674 -0
  111. package/src/logger.ts +28 -0
  112. package/src/methods.ts +788 -0
  113. package/src/options.ts +105 -12
  114. package/src/server.ts +111 -50
  115. package/src/stdio.ts +9 -4
  116. package/src/types.ts +15 -4
  117. package/src/util.ts +25 -0
  118. package/stdio.d.mts +2 -1
  119. package/stdio.d.mts.map +1 -1
  120. package/stdio.d.ts +2 -1
  121. package/stdio.d.ts.map +1 -1
  122. package/stdio.js +8 -4
  123. package/stdio.js.map +1 -1
  124. package/stdio.mjs +8 -4
  125. package/stdio.mjs.map +1 -1
  126. package/types.d.mts +14 -1
  127. package/types.d.mts.map +1 -1
  128. package/types.d.ts +14 -1
  129. package/types.d.ts.map +1 -1
  130. package/types.js.map +1 -1
  131. package/types.mjs.map +1 -1
  132. package/util.d.mts +4 -0
  133. package/util.d.mts.map +1 -0
  134. package/util.d.ts +4 -0
  135. package/util.d.ts.map +1 -0
  136. package/util.js +30 -0
  137. package/util.js.map +1 -0
  138. package/util.mjs +24 -0
  139. package/util.mjs.map +1 -0
  140. package/headers.d.mts +0 -4
  141. package/headers.d.mts.map +0 -1
  142. package/headers.d.ts +0 -4
  143. package/headers.d.ts.map +0 -1
  144. package/headers.js.map +0 -1
  145. package/headers.mjs +0 -18
  146. package/headers.mjs.map +0 -1
package/src/options.ts CHANGED
@@ -1,46 +1,114 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
1
3
  import qs from 'qs';
2
4
  import yargs from 'yargs';
3
5
  import { hideBin } from 'yargs/helpers';
4
6
  import z from 'zod';
7
+ import { readEnv } from './util';
5
8
 
6
9
  export type CLIOptions = McpOptions & {
10
+ debug: boolean;
11
+ logFormat: 'json' | 'pretty';
7
12
  transport: 'stdio' | 'http';
8
13
  port: number | undefined;
9
14
  socket: string | undefined;
10
15
  };
11
16
 
12
17
  export type McpOptions = {
18
+ includeCodeTool?: boolean | undefined;
13
19
  includeDocsTools?: boolean | undefined;
20
+ stainlessApiKey?: string | undefined;
21
+ docsSearchMode?: 'stainless-api' | 'local' | undefined;
22
+ docsDir?: string | undefined;
23
+ codeAllowHttpGets?: boolean | undefined;
24
+ codeAllowedMethods?: string[] | undefined;
25
+ codeBlockedMethods?: string[] | undefined;
26
+ codeExecutionMode: McpCodeExecutionMode;
27
+ customInstructionsPath?: string | undefined;
14
28
  };
15
29
 
30
+ export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
31
+
16
32
  export function parseCLIOptions(): CLIOptions {
17
33
  const opts = yargs(hideBin(process.argv))
18
- .option('tools', {
34
+ .option('code-allow-http-gets', {
35
+ type: 'boolean',
36
+ description:
37
+ 'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
38
+ })
39
+ .option('code-allowed-methods', {
19
40
  type: 'string',
20
41
  array: true,
21
- choices: ['code', 'docs'],
22
- description: 'Use dynamic tools or all tools',
42
+ description:
43
+ 'Methods to explicitly allow for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
23
44
  })
24
- .option('no-tools', {
45
+ .option('code-blocked-methods', {
25
46
  type: 'string',
26
47
  array: true,
27
- choices: ['code', 'docs'],
28
- description: 'Do not use any dynamic or all tools',
48
+ description:
49
+ 'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
29
50
  })
30
- .option('transport', {
51
+ .option('code-execution-mode', {
31
52
  type: 'string',
32
- choices: ['stdio', 'http'],
33
- default: 'stdio',
34
- description: 'What transport to use; stdio for local servers or http for remote servers',
53
+ choices: ['stainless-sandbox', 'local'],
54
+ default: 'stainless-sandbox',
55
+ description:
56
+ "Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.",
57
+ })
58
+ .option('custom-instructions-path', {
59
+ type: 'string',
60
+ description: 'Path to custom instructions for the MCP server',
61
+ })
62
+ .option('debug', { type: 'boolean', description: 'Enable debug logging' })
63
+ .option('docs-dir', {
64
+ type: 'string',
65
+ description:
66
+ 'Path to a directory of local documentation files (markdown/JSON) to include in local docs search.',
67
+ })
68
+ .option('docs-search-mode', {
69
+ type: 'string',
70
+ choices: ['stainless-api', 'local'],
71
+ default: 'stainless-api',
72
+ description:
73
+ "Where to search documentation; 'stainless-api' uses the Stainless-hosted search API whereas 'local' uses an in-memory search index built from embedded SDK method data and optional local docs files.",
74
+ })
75
+ .option('log-format', {
76
+ type: 'string',
77
+ choices: ['json', 'pretty'],
78
+ description: 'Format for log output; defaults to json unless tty is detected',
79
+ })
80
+ .option('no-tools', {
81
+ type: 'string',
82
+ array: true,
83
+ choices: ['code', 'docs'],
84
+ description: 'Tools to explicitly disable',
35
85
  })
36
86
  .option('port', {
37
87
  type: 'number',
88
+ default: 3000,
38
89
  description: 'Port to serve on if using http transport',
39
90
  })
40
- .option('socket', {
91
+ .option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
92
+ .option('stainless-api-key', {
93
+ type: 'string',
94
+ default: readEnv('STAINLESS_API_KEY'),
95
+ description:
96
+ 'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
97
+ })
98
+ .option('tools', {
99
+ type: 'string',
100
+ array: true,
101
+ choices: ['code', 'docs'],
102
+ description: 'Tools to explicitly enable',
103
+ })
104
+ .option('transport', {
41
105
  type: 'string',
42
- description: 'Unix socket to serve on if using http transport',
106
+ choices: ['stdio', 'http'],
107
+ default: 'stdio',
108
+ description: 'What transport to use; stdio for local servers or http for remote servers',
43
109
  })
110
+ .env('MCP_SERVER')
111
+ .version(true)
44
112
  .help();
45
113
 
46
114
  const argv = opts.parseSync();
@@ -50,13 +118,29 @@ export function parseCLIOptions(): CLIOptions {
50
118
  : argv.tools?.includes(toolType) ? true
51
119
  : undefined;
52
120
 
121
+ const includeCodeTool = shouldIncludeToolType('code');
53
122
  const includeDocsTools = shouldIncludeToolType('docs');
54
123
 
55
124
  const transport = argv.transport as 'stdio' | 'http';
125
+ const logFormat =
126
+ argv.logFormat ? (argv.logFormat as 'json' | 'pretty')
127
+ : process.stderr.isTTY ? 'pretty'
128
+ : 'json';
56
129
 
57
130
  return {
131
+ ...(includeCodeTool !== undefined && { includeCodeTool }),
58
132
  ...(includeDocsTools !== undefined && { includeDocsTools }),
133
+ debug: !!argv.debug,
134
+ stainlessApiKey: argv.stainlessApiKey,
135
+ docsSearchMode: argv.docsSearchMode as 'stainless-api' | 'local' | undefined,
136
+ docsDir: argv.docsDir,
137
+ codeAllowHttpGets: argv.codeAllowHttpGets,
138
+ codeAllowedMethods: argv.codeAllowedMethods,
139
+ codeBlockedMethods: argv.codeBlockedMethods,
140
+ codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode,
141
+ customInstructionsPath: argv.customInstructionsPath,
59
142
  transport,
143
+ logFormat,
60
144
  port: argv.port,
61
145
  socket: argv.socket,
62
146
  };
@@ -81,12 +165,21 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
81
165
  const queryObject = typeof query === 'string' ? qs.parse(query) : query;
82
166
  const queryOptions = QueryOptions.parse(queryObject);
83
167
 
168
+ let codeTool: boolean | undefined =
169
+ queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
170
+ : queryOptions.tools?.includes('code') ? true
171
+ : defaultOptions.includeCodeTool;
172
+
84
173
  let docsTools: boolean | undefined =
85
174
  queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
86
175
  : queryOptions.tools?.includes('docs') ? true
87
176
  : defaultOptions.includeDocsTools;
88
177
 
89
178
  return {
179
+ ...(codeTool !== undefined && { includeCodeTool: codeTool }),
90
180
  ...(docsTools !== undefined && { includeDocsTools: docsTools }),
181
+ codeExecutionMode: defaultOptions.codeExecutionMode,
182
+ docsSearchMode: defaultOptions.docsSearchMode,
183
+ docsDir: defaultOptions.docsDir,
91
184
  };
92
185
  }
package/src/server.ts CHANGED
@@ -11,32 +11,43 @@ import { ClientOptions } from '@metronome/sdk';
11
11
  import Metronome from '@metronome/sdk';
12
12
  import { codeTool } from './code-tool';
13
13
  import docsSearchTool from './docs-search-tool';
14
+ import { setLocalSearch } from './docs-search-tool';
15
+ import { LocalDocsSearch } from './local-docs-search';
16
+ import { getInstructions } from './instructions';
14
17
  import { McpOptions } from './options';
15
- import { HandlerFunction, McpTool } from './types';
16
-
17
- export { McpOptions } from './options';
18
- export { ClientOptions } from '@metronome/sdk';
19
-
20
- export const newMcpServer = () =>
18
+ import { blockedMethodsForCodeTool } from './methods';
19
+ import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
20
+
21
+ export const newMcpServer = async ({
22
+ stainlessApiKey,
23
+ customInstructionsPath,
24
+ }: {
25
+ stainlessApiKey?: string | undefined;
26
+ customInstructionsPath?: string | undefined;
27
+ }) =>
21
28
  new McpServer(
22
29
  {
23
30
  name: 'metronome_sdk_api',
24
- version: '3.0.0',
31
+ version: '3.5.0',
32
+ },
33
+ {
34
+ instructions: await getInstructions({ stainlessApiKey, customInstructionsPath }),
35
+ capabilities: { tools: {}, logging: {} },
25
36
  },
26
- { capabilities: { tools: {}, logging: {} } },
27
37
  );
28
38
 
29
- // Create server instance
30
- export const server = newMcpServer();
31
-
32
39
  /**
33
40
  * Initializes the provided MCP Server with the given tools and handlers.
34
41
  * If not provided, the default client, tools and handlers will be used.
35
42
  */
36
- export function initMcpServer(params: {
43
+ export async function initMcpServer(params: {
37
44
  server: Server | McpServer;
38
45
  clientOptions?: ClientOptions;
39
46
  mcpOptions?: McpOptions;
47
+ stainlessApiKey?: string | undefined;
48
+ upstreamClientEnvs?: Record<string, string> | undefined;
49
+ mcpSessionId?: string | undefined;
50
+ mcpClientInfo?: { name: string; version: string } | undefined;
40
51
  }) {
41
52
  const server = params.server instanceof McpServer ? params.server.server : params.server;
42
53
 
@@ -55,14 +66,38 @@ export function initMcpServer(params: {
55
66
  error: logAtLevel('error'),
56
67
  };
57
68
 
58
- let client = new Metronome({
59
- logger,
60
- ...params.clientOptions,
61
- defaultHeaders: {
62
- ...params.clientOptions?.defaultHeaders,
63
- 'X-Stainless-MCP': 'true',
64
- },
65
- });
69
+ if (params.mcpOptions?.docsSearchMode === 'local') {
70
+ const docsDir = params.mcpOptions?.docsDir;
71
+ const localSearch = await LocalDocsSearch.create(docsDir ? { docsDir } : undefined);
72
+ setLocalSearch(localSearch);
73
+ }
74
+
75
+ let _client: Metronome | undefined;
76
+ let _clientError: Error | undefined;
77
+ let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
78
+
79
+ const getClient = (): Metronome => {
80
+ if (_clientError) throw _clientError;
81
+ if (!_client) {
82
+ try {
83
+ _client = new Metronome({
84
+ logger,
85
+ ...params.clientOptions,
86
+ defaultHeaders: {
87
+ ...params.clientOptions?.defaultHeaders,
88
+ 'X-Stainless-MCP': 'true',
89
+ },
90
+ });
91
+ if (_logLevel) {
92
+ _client = _client.withOptions({ logLevel: _logLevel });
93
+ }
94
+ } catch (e) {
95
+ _clientError = e instanceof Error ? e : new Error(String(e));
96
+ throw _clientError;
97
+ }
98
+ }
99
+ return _client;
100
+ };
66
101
 
67
102
  const providedTools = selectTools(params.mcpOptions);
68
103
  const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
@@ -80,29 +115,59 @@ export function initMcpServer(params: {
80
115
  throw new Error(`Unknown tool: ${name}`);
81
116
  }
82
117
 
83
- return executeHandler(mcpTool.handler, client, args);
118
+ let client: Metronome;
119
+ try {
120
+ client = getClient();
121
+ } catch (error) {
122
+ return {
123
+ content: [
124
+ {
125
+ type: 'text' as const,
126
+ text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
127
+ },
128
+ ],
129
+ isError: true,
130
+ };
131
+ }
132
+
133
+ return executeHandler({
134
+ handler: mcpTool.handler,
135
+ reqContext: {
136
+ client,
137
+ stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
138
+ upstreamClientEnvs: params.upstreamClientEnvs,
139
+ mcpSessionId: params.mcpSessionId,
140
+ mcpClientInfo: params.mcpClientInfo,
141
+ },
142
+ args,
143
+ });
84
144
  });
85
145
 
86
146
  server.setRequestHandler(SetLevelRequestSchema, async (request) => {
87
147
  const { level } = request.params;
148
+ let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
88
149
  switch (level) {
89
150
  case 'debug':
90
- client = client.withOptions({ logLevel: 'debug' });
151
+ logLevel = 'debug';
91
152
  break;
92
153
  case 'info':
93
- client = client.withOptions({ logLevel: 'info' });
154
+ logLevel = 'info';
94
155
  break;
95
156
  case 'notice':
96
157
  case 'warning':
97
- client = client.withOptions({ logLevel: 'warn' });
158
+ logLevel = 'warn';
98
159
  break;
99
160
  case 'error':
100
- client = client.withOptions({ logLevel: 'error' });
161
+ logLevel = 'error';
101
162
  break;
102
163
  default:
103
- client = client.withOptions({ logLevel: 'off' });
164
+ logLevel = 'off';
104
165
  break;
105
166
  }
167
+ _logLevel = logLevel;
168
+ if (_client) {
169
+ _client = _client.withOptions({ logLevel });
170
+ }
106
171
  return {};
107
172
  });
108
173
  }
@@ -111,7 +176,16 @@ export function initMcpServer(params: {
111
176
  * Selects the tools to include in the MCP Server based on the provided options.
112
177
  */
113
178
  export function selectTools(options?: McpOptions): McpTool[] {
114
- const includedTools = [codeTool()];
179
+ const includedTools = [];
180
+
181
+ if (options?.includeCodeTool ?? true) {
182
+ includedTools.push(
183
+ codeTool({
184
+ blockedMethods: blockedMethodsForCodeTool(options),
185
+ codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
186
+ }),
187
+ );
188
+ }
115
189
  if (options?.includeDocsTools ?? true) {
116
190
  includedTools.push(docsSearchTool);
117
191
  }
@@ -121,27 +195,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
121
195
  /**
122
196
  * Runs the provided handler with the given client and arguments.
123
197
  */
124
- export async function executeHandler(
125
- handler: HandlerFunction,
126
- client: Metronome,
127
- args: Record<string, unknown> | undefined,
128
- ) {
129
- return await handler(client, args || {});
198
+ export async function executeHandler({
199
+ handler,
200
+ reqContext,
201
+ args,
202
+ }: {
203
+ handler: HandlerFunction;
204
+ reqContext: McpRequestContext;
205
+ args: Record<string, unknown> | undefined;
206
+ }): Promise<ToolCallResult> {
207
+ return await handler({ reqContext, args: args || {} });
130
208
  }
131
-
132
- export const readEnv = (env: string): string | undefined => {
133
- if (typeof (globalThis as any).process !== 'undefined') {
134
- return (globalThis as any).process.env?.[env]?.trim();
135
- } else if (typeof (globalThis as any).Deno !== 'undefined') {
136
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
137
- }
138
- return;
139
- };
140
-
141
- export const readEnvOrError = (env: string): string => {
142
- let envValue = readEnv(env);
143
- if (envValue === undefined) {
144
- throw new Error(`Environment variable ${env} is not set`);
145
- }
146
- return envValue;
147
- };
package/src/stdio.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
+ import { McpOptions } from './options';
2
3
  import { initMcpServer, newMcpServer } from './server';
4
+ import { getLogger } from './logger';
3
5
 
4
- export const launchStdioServer = async () => {
5
- const server = newMcpServer();
6
+ export const launchStdioServer = async (mcpOptions: McpOptions) => {
7
+ const server = await newMcpServer({
8
+ stainlessApiKey: mcpOptions.stainlessApiKey,
9
+ customInstructionsPath: mcpOptions.customInstructionsPath,
10
+ });
6
11
 
7
- initMcpServer({ server });
12
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
8
13
 
9
14
  const transport = new StdioServerTransport();
10
15
  await server.connect(transport);
11
- console.error('MCP Server running on stdio');
16
+ getLogger().info('MCP Server running on stdio');
12
17
  };
package/src/types.ts CHANGED
@@ -42,10 +42,21 @@ export type ToolCallResult = {
42
42
  isError?: boolean;
43
43
  };
44
44
 
45
- export type HandlerFunction = (
46
- client: Metronome,
47
- args: Record<string, unknown> | undefined,
48
- ) => Promise<ToolCallResult>;
45
+ export type McpRequestContext = {
46
+ client: Metronome;
47
+ stainlessApiKey?: string | undefined;
48
+ upstreamClientEnvs?: Record<string, string> | undefined;
49
+ mcpSessionId?: string | undefined;
50
+ mcpClientInfo?: { name: string; version: string } | undefined;
51
+ };
52
+
53
+ export type HandlerFunction = ({
54
+ reqContext,
55
+ args,
56
+ }: {
57
+ reqContext: McpRequestContext;
58
+ args: Record<string, unknown> | undefined;
59
+ }) => Promise<ToolCallResult>;
49
60
 
50
61
  export function asTextContentResult(result: unknown): ToolCallResult {
51
62
  return {
package/src/util.ts ADDED
@@ -0,0 +1,25 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export const readEnv = (env: string): string | undefined => {
4
+ if (typeof (globalThis as any).process !== 'undefined') {
5
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
6
+ } else if (typeof (globalThis as any).Deno !== 'undefined') {
7
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
8
+ }
9
+ return;
10
+ };
11
+
12
+ export const readEnvOrError = (env: string): string => {
13
+ let envValue = readEnv(env);
14
+ if (envValue === undefined) {
15
+ throw new Error(`Environment variable ${env} is not set`);
16
+ }
17
+ return envValue;
18
+ };
19
+
20
+ export const requireValue = <T>(value: T | undefined, description: string): T => {
21
+ if (value === undefined) {
22
+ throw new Error(`Missing required value: ${description}`);
23
+ }
24
+ return value;
25
+ };
package/stdio.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const launchStdioServer: () => Promise<void>;
1
+ import { McpOptions } from "./options.mjs";
2
+ export declare const launchStdioServer: (mcpOptions: McpOptions) => Promise<void>;
2
3
  //# sourceMappingURL=stdio.d.mts.map
package/stdio.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
1
+ {"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAIrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAW7D,CAAC"}
package/stdio.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const launchStdioServer: () => Promise<void>;
1
+ import { McpOptions } from "./options.js";
2
+ export declare const launchStdioServer: (mcpOptions: McpOptions) => Promise<void>;
2
3
  //# sourceMappingURL=stdio.d.ts.map
package/stdio.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,qBAQ7B,CAAC"}
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAIrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAW7D,CAAC"}
package/stdio.js CHANGED
@@ -3,12 +3,16 @@ 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 logger_1 = require("./logger.js");
7
+ const launchStdioServer = async (mcpOptions) => {
8
+ const server = await (0, server_1.newMcpServer)({
9
+ stainlessApiKey: mcpOptions.stainlessApiKey,
10
+ customInstructionsPath: mcpOptions.customInstructionsPath,
11
+ });
12
+ await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
9
13
  const transport = new stdio_js_1.StdioServerTransport();
10
14
  await server.connect(transport);
11
- console.error('MCP Server running on stdio');
15
+ (0, logger_1.getLogger)().info('MCP Server running on stdio');
12
16
  };
13
17
  exports.launchStdioServer = launchStdioServer;
14
18
  //# sourceMappingURL=stdio.js.map
package/stdio.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AACjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAA,qBAAY,GAAE,CAAC;IAE9B,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1B,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"}
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AACvD,wCAAqC;AAE9B,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC;QAChC,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;KAC1D,CAAC,CAAC;IAEH,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,IAAA,kBAAS,GAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
package/stdio.mjs CHANGED
@@ -1,10 +1,14 @@
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
+ import { getLogger } from "./logger.mjs";
4
+ export const launchStdioServer = async (mcpOptions) => {
5
+ const server = await newMcpServer({
6
+ stainlessApiKey: mcpOptions.stainlessApiKey,
7
+ customInstructionsPath: mcpOptions.customInstructionsPath,
8
+ });
9
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
6
10
  const transport = new StdioServerTransport();
7
11
  await server.connect(transport);
8
- console.error('MCP Server running on stdio');
12
+ getLogger().info('MCP Server running on stdio');
9
13
  };
10
14
  //# sourceMappingURL=stdio.mjs.map
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;OACzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE1B,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"}
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;OAC/B,EAAE,SAAS,EAAE;AAEpB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;KAC1D,CAAC,CAAC;IAEH,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC;IAEzF,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,SAAS,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC"}
package/types.d.mts CHANGED
@@ -31,7 +31,20 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: Metronome, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: Metronome;
36
+ stainlessApiKey?: string | undefined;
37
+ upstreamClientEnvs?: Record<string, string> | undefined;
38
+ mcpSessionId?: string | undefined;
39
+ mcpClientInfo?: {
40
+ name: string;
41
+ version: string;
42
+ } | undefined;
43
+ };
44
+ export type HandlerFunction = ({ reqContext, args, }: {
45
+ reqContext: McpRequestContext;
46
+ args: Record<string, unknown> | undefined;
47
+ }) => Promise<ToolCallResult>;
35
48
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
49
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
50
  export declare function asErrorResult(message: string): ToolCallResult;
package/types.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,SAAS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tB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC"}
package/types.d.ts CHANGED
@@ -31,7 +31,20 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: Metronome, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: Metronome;
36
+ stainlessApiKey?: string | undefined;
37
+ upstreamClientEnvs?: Record<string, string> | undefined;
38
+ mcpSessionId?: string | undefined;
39
+ mcpClientInfo?: {
40
+ name: string;
41
+ version: string;
42
+ } | undefined;
43
+ };
44
+ export type HandlerFunction = ({ reqContext, args, }: {
45
+ reqContext: McpRequestContext;
46
+ args: Record<string, unknown> | undefined;
47
+ }) => Promise<ToolCallResult>;
35
48
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
49
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
50
  export declare function asErrorResult(message: string): ToolCallResult;
package/types.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,SAAS,MAAM,gBAAgB;OAC/B,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KA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wBAC/B,QAAQ;wBACR,IAAI,EAAE,IAAI;qBACX;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO;aACd;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
package/util.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const readEnv: (env: string) => string | undefined;
2
+ export declare const readEnvOrError: (env: string) => string;
3
+ export declare const requireValue: <T>(value: T | undefined, description: string) => T;
4
+ //# sourceMappingURL=util.d.mts.map
package/util.d.mts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.mts","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,aAAa,MAAM,KAAG,CAK3E,CAAC"}