@nirvana-labs/nirvana-mcp 1.46.1 → 1.47.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 (89) hide show
  1. package/auth.d.mts +6 -0
  2. package/auth.d.mts.map +1 -0
  3. package/auth.d.ts +6 -0
  4. package/auth.d.ts.map +1 -0
  5. package/{headers.mjs → auth.js} +18 -2
  6. package/auth.js.map +1 -0
  7. package/{headers.js → auth.mjs} +13 -6
  8. package/auth.mjs.map +1 -0
  9. package/code-tool.d.mts +1 -1
  10. package/code-tool.d.mts.map +1 -1
  11. package/code-tool.d.ts +1 -1
  12. package/code-tool.d.ts.map +1 -1
  13. package/code-tool.js +11 -12
  14. package/code-tool.js.map +1 -1
  15. package/code-tool.mjs +9 -10
  16. package/code-tool.mjs.map +1 -1
  17. package/docs-search-tool.d.mts +9 -3
  18. package/docs-search-tool.d.mts.map +1 -1
  19. package/docs-search-tool.d.ts +9 -3
  20. package/docs-search-tool.d.ts.map +1 -1
  21. package/docs-search-tool.js +6 -2
  22. package/docs-search-tool.js.map +1 -1
  23. package/docs-search-tool.mjs +6 -2
  24. package/docs-search-tool.mjs.map +1 -1
  25. package/http.d.mts +2 -2
  26. package/http.d.mts.map +1 -1
  27. package/http.d.ts +2 -2
  28. package/http.d.ts.map +1 -1
  29. package/http.js +9 -7
  30. package/http.js.map +1 -1
  31. package/http.mjs +9 -7
  32. package/http.mjs.map +1 -1
  33. package/methods.d.mts.map +1 -1
  34. package/methods.d.ts.map +1 -1
  35. package/methods.js +1 -0
  36. package/methods.js.map +1 -1
  37. package/methods.mjs +1 -0
  38. package/methods.mjs.map +1 -1
  39. package/options.d.mts +1 -0
  40. package/options.d.mts.map +1 -1
  41. package/options.d.ts +1 -0
  42. package/options.d.ts.map +1 -1
  43. package/options.js +8 -0
  44. package/options.js.map +1 -1
  45. package/options.mjs +8 -0
  46. package/options.mjs.map +1 -1
  47. package/package.json +22 -12
  48. package/server.d.mts +8 -9
  49. package/server.d.mts.map +1 -1
  50. package/server.d.ts +8 -9
  51. package/server.d.ts.map +1 -1
  52. package/server.js +20 -37
  53. package/server.js.map +1 -1
  54. package/server.mjs +18 -32
  55. package/server.mjs.map +1 -1
  56. package/src/{headers.ts → auth.ts} +16 -1
  57. package/src/code-tool.ts +22 -13
  58. package/src/docs-search-tool.ts +13 -4
  59. package/src/http.ts +16 -8
  60. package/src/methods.ts +2 -0
  61. package/src/options.ts +11 -0
  62. package/src/server.ts +28 -42
  63. package/src/stdio.ts +2 -2
  64. package/src/types.ts +12 -4
  65. package/src/util.ts +25 -0
  66. package/stdio.js +2 -2
  67. package/stdio.js.map +1 -1
  68. package/stdio.mjs +2 -2
  69. package/stdio.mjs.map +1 -1
  70. package/types.d.mts +8 -1
  71. package/types.d.mts.map +1 -1
  72. package/types.d.ts +8 -1
  73. package/types.d.ts.map +1 -1
  74. package/types.js.map +1 -1
  75. package/types.mjs.map +1 -1
  76. package/util.d.mts +4 -0
  77. package/util.d.mts.map +1 -0
  78. package/util.d.ts +4 -0
  79. package/util.d.ts.map +1 -0
  80. package/util.js +30 -0
  81. package/util.js.map +1 -0
  82. package/util.mjs +24 -0
  83. package/util.mjs.map +1 -0
  84. package/headers.d.mts +0 -4
  85. package/headers.d.mts.map +0 -1
  86. package/headers.d.ts +0 -4
  87. package/headers.d.ts.map +0 -1
  88. package/headers.js.map +0 -1
  89. package/headers.mjs.map +0 -1
@@ -2,8 +2,9 @@
2
2
 
3
3
  import { IncomingMessage } from 'node:http';
4
4
  import { ClientOptions } from '@nirvana-labs/nirvana';
5
+ import { McpOptions } from './options';
5
6
 
6
- export const parseAuthHeaders = (req: IncomingMessage, required?: boolean): Partial<ClientOptions> => {
7
+ export const parseClientAuthHeaders = (req: IncomingMessage, required?: boolean): Partial<ClientOptions> => {
7
8
  if (req.headers.authorization) {
8
9
  const scheme = req.headers.authorization.split(' ')[0]!;
9
10
  const value = req.headers.authorization.slice(scheme.length + 1);
@@ -25,3 +26,17 @@ export const parseAuthHeaders = (req: IncomingMessage, required?: boolean): Part
25
26
  : req.headers['x-nirvana-labs-api-key'];
26
27
  return { apiKey };
27
28
  };
29
+
30
+ export const getStainlessApiKey = (req: IncomingMessage, mcpOptions: McpOptions): string | undefined => {
31
+ // Try to get the key from the x-stainless-api-key header
32
+ const headerKey =
33
+ Array.isArray(req.headers['x-stainless-api-key']) ?
34
+ req.headers['x-stainless-api-key'][0]
35
+ : req.headers['x-stainless-api-key'];
36
+ if (headerKey && typeof headerKey === 'string') {
37
+ return headerKey;
38
+ }
39
+
40
+ // Fall back to value set in the mcpOptions (e.g. from environment variable), if provided
41
+ return mcpOptions.stainlessApiKey;
42
+ };
package/src/code-tool.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { McpTool, Metadata, ToolCallResult, asErrorResult, asTextContentResult } from './types';
3
+ import {
4
+ McpRequestContext,
5
+ McpTool,
6
+ Metadata,
7
+ ToolCallResult,
8
+ asErrorResult,
9
+ asTextContentResult,
10
+ } from './types';
4
11
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
5
- import { readEnv, requireValue } from './server';
12
+ import { readEnv, requireValue } from './util';
6
13
  import { WorkerInput, WorkerOutput } from './code-tool-types';
7
14
  import { SdkMethod } from './methods';
8
- import { NirvanaLabs } from '@nirvana-labs/nirvana';
9
15
 
10
16
  const prompt = `Runs JavaScript code to interact with the Nirvana Labs API.
11
17
 
@@ -47,7 +53,7 @@ Variables will not persist between calls, so make sure to return or log any data
47
53
  *
48
54
  * @param endpoints - The endpoints to include in the list.
49
55
  */
50
- export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): McpTool {
56
+ export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | undefined }): McpTool {
51
57
  const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
52
58
  const tool: Tool = {
53
59
  name: 'execute',
@@ -67,19 +73,24 @@ export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): M
67
73
  required: ['code'],
68
74
  },
69
75
  };
70
- const handler = async (client: NirvanaLabs, args: any): Promise<ToolCallResult> => {
76
+ const handler = async ({
77
+ reqContext,
78
+ args,
79
+ }: {
80
+ reqContext: McpRequestContext;
81
+ args: any;
82
+ }): Promise<ToolCallResult> => {
71
83
  const code = args.code as string;
72
84
  const intent = args.intent as string | undefined;
85
+ const client = reqContext.client;
73
86
 
74
87
  // Do very basic blocking of code that includes forbidden method names.
75
88
  //
76
89
  // WARNING: This is not secure against obfuscation and other evasion methods. If
77
90
  // stronger security blocks are required, then these should be enforced in the downstream
78
91
  // API (e.g., by having users call the MCP server with API keys with limited permissions).
79
- if (params.blockedMethods) {
80
- const blockedMatches = params.blockedMethods.filter((method) =>
81
- code.includes(method.fullyQualifiedName),
82
- );
92
+ if (blockedMethods) {
93
+ const blockedMatches = blockedMethods.filter((method) => code.includes(method.fullyQualifiedName));
83
94
  if (blockedMatches.length > 0) {
84
95
  return asErrorResult(
85
96
  `The following methods have been blocked by the MCP server and cannot be used in code execution: ${blockedMatches
@@ -89,16 +100,14 @@ export function codeTool(params: { blockedMethods: SdkMethod[] | undefined }): M
89
100
  }
90
101
  }
91
102
 
92
- // this is not required, but passing a Stainless API key for the matching project_name
93
- // will allow you to run code-mode queries against non-published versions of your SDK.
94
- const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
95
103
  const codeModeEndpoint =
96
104
  readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
97
105
 
106
+ // Setting a Stainless API key authenticates requests to the code tool endpoint.
98
107
  const res = await fetch(codeModeEndpoint, {
99
108
  method: 'POST',
100
109
  headers: {
101
- ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
110
+ ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
102
111
  'Content-Type': 'application/json',
103
112
  client_envs: JSON.stringify({
104
113
  NIRVANA_LABS_API_KEY: requireValue(
@@ -1,7 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { Metadata, asTextContentResult } from './types';
4
-
3
+ import { Metadata, McpRequestContext, asTextContentResult } from './types';
5
4
  import { Tool } from '@modelcontextprotocol/sdk/types.js';
6
5
 
7
6
  export const metadata: Metadata = {
@@ -42,10 +41,20 @@ export const tool: Tool = {
42
41
  const docsSearchURL =
43
42
  process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/nirvana/docs/search';
44
43
 
45
- export const handler = async (_: unknown, args: Record<string, unknown> | undefined) => {
44
+ export const handler = async ({
45
+ reqContext,
46
+ args,
47
+ }: {
48
+ reqContext: McpRequestContext;
49
+ args: Record<string, unknown> | undefined;
50
+ }) => {
46
51
  const body = args as any;
47
52
  const query = new URLSearchParams(body).toString();
48
- const result = await fetch(`${docsSearchURL}?${query}`);
53
+ const result = await fetch(`${docsSearchURL}?${query}`, {
54
+ headers: {
55
+ ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
56
+ },
57
+ });
49
58
 
50
59
  if (!result.ok) {
51
60
  throw new Error(
package/src/http.ts CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
4
4
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
5
+ import { ClientOptions } from '@nirvana-labs/nirvana';
5
6
  import express from 'express';
6
7
  import morgan from 'morgan';
7
8
  import morganBody from 'morgan-body';
9
+ import { getStainlessApiKey, parseClientAuthHeaders } from './auth';
8
10
  import { McpOptions } from './options';
9
- import { ClientOptions, initMcpServer, newMcpServer } from './server';
10
- import { parseAuthHeaders } from './headers';
11
+ import { initMcpServer, newMcpServer } from './server';
11
12
 
12
13
  const newServer = async ({
13
14
  clientOptions,
@@ -20,10 +21,12 @@ const newServer = async ({
20
21
  req: express.Request;
21
22
  res: express.Response;
22
23
  }): Promise<McpServer | null> => {
23
- const server = await newMcpServer();
24
+ const stainlessApiKey = getStainlessApiKey(req, mcpOptions);
25
+ const server = await newMcpServer(stainlessApiKey);
24
26
 
25
27
  try {
26
- const authOptions = parseAuthHeaders(req, false);
28
+ const authOptions = parseClientAuthHeaders(req, false);
29
+
27
30
  await initMcpServer({
28
31
  server: server,
29
32
  mcpOptions: mcpOptions,
@@ -31,6 +34,7 @@ const newServer = async ({
31
34
  ...clientOptions,
32
35
  ...authOptions,
33
36
  },
37
+ stainlessApiKey: stainlessApiKey,
34
38
  });
35
39
  } catch (error) {
36
40
  res.status(401).json({
@@ -111,13 +115,17 @@ export const streamableHTTPApp = ({
111
115
  return app;
112
116
  };
113
117
 
114
- export const launchStreamableHTTPServer = async (params: {
118
+ export const launchStreamableHTTPServer = async ({
119
+ mcpOptions,
120
+ debug,
121
+ port,
122
+ }: {
115
123
  mcpOptions: McpOptions;
116
124
  debug: boolean;
117
125
  port: number | string | undefined;
118
126
  }) => {
119
- const app = streamableHTTPApp({ mcpOptions: params.mcpOptions, debug: params.debug });
120
- const server = app.listen(params.port);
127
+ const app = streamableHTTPApp({ mcpOptions, debug });
128
+ const server = app.listen(port);
121
129
  const address = server.address();
122
130
 
123
131
  if (typeof address === 'string') {
@@ -125,6 +133,6 @@ export const launchStreamableHTTPServer = async (params: {
125
133
  } else if (address !== null) {
126
134
  console.error(`MCP Server running on streamable HTTP on port ${address.port}`);
127
135
  } else {
128
- console.error(`MCP Server running on streamable HTTP on port ${params.port}`);
136
+ console.error(`MCP Server running on streamable HTTP on port ${port}`);
129
137
  }
130
138
  };
package/src/methods.ts CHANGED
@@ -1,3 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
1
3
  import { McpOptions } from './options';
2
4
 
3
5
  export type SdkMethod = {
package/src/options.ts CHANGED
@@ -1,7 +1,10 @@
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 & {
7
10
  debug: boolean;
@@ -12,6 +15,7 @@ export type CLIOptions = McpOptions & {
12
15
 
13
16
  export type McpOptions = {
14
17
  includeDocsTools?: boolean | undefined;
18
+ stainlessApiKey?: string | undefined;
15
19
  codeAllowHttpGets?: boolean | undefined;
16
20
  codeAllowedMethods?: string[] | undefined;
17
21
  codeBlockedMethods?: string[] | undefined;
@@ -49,6 +53,12 @@ export function parseCLIOptions(): CLIOptions {
49
53
  description: 'Port to serve on if using http transport',
50
54
  })
51
55
  .option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
56
+ .option('stainless-api-key', {
57
+ type: 'string',
58
+ default: readEnv('STAINLESS_API_KEY'),
59
+ description:
60
+ 'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
61
+ })
52
62
  .option('tools', {
53
63
  type: 'string',
54
64
  array: true,
@@ -79,6 +89,7 @@ export function parseCLIOptions(): CLIOptions {
79
89
  return {
80
90
  ...(includeDocsTools !== undefined && { includeDocsTools }),
81
91
  debug: !!argv.debug,
92
+ stainlessApiKey: argv.stainlessApiKey,
82
93
  codeAllowHttpGets: argv.codeAllowHttpGets,
83
94
  codeAllowedMethods: argv.codeAllowedMethods,
84
95
  codeBlockedMethods: argv.codeBlockedMethods,
package/src/server.ts CHANGED
@@ -13,19 +13,17 @@ import { codeTool } from './code-tool';
13
13
  import docsSearchTool from './docs-search-tool';
14
14
  import { McpOptions } from './options';
15
15
  import { blockedMethodsForCodeTool } from './methods';
16
- import { HandlerFunction, McpTool } from './types';
16
+ import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
17
+ import { readEnv } from './util';
17
18
 
18
- export { McpOptions } from './options';
19
- export { ClientOptions } from '@nirvana-labs/nirvana';
20
-
21
- async function getInstructions() {
22
- // This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
23
- const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
19
+ async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
20
+ // Setting the stainless API key is optional, but may be required
21
+ // to authenticate requests to the Stainless API.
24
22
  const response = await fetch(
25
23
  readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/nirvana',
26
24
  {
27
25
  method: 'GET',
28
- headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
26
+ headers: { ...(stainlessApiKey && { Authorization: stainlessApiKey }) },
29
27
  },
30
28
  );
31
29
 
@@ -54,14 +52,14 @@ async function getInstructions() {
54
52
  return instructions;
55
53
  }
56
54
 
57
- export const newMcpServer = async () =>
55
+ export const newMcpServer = async (stainlessApiKey: string | undefined) =>
58
56
  new McpServer(
59
57
  {
60
58
  name: 'nirvana_labs_nirvana_api',
61
- version: '1.46.1',
59
+ version: '1.47.0',
62
60
  },
63
61
  {
64
- instructions: await getInstructions(),
62
+ instructions: await getInstructions(stainlessApiKey),
65
63
  capabilities: { tools: {}, logging: {} },
66
64
  },
67
65
  );
@@ -74,6 +72,7 @@ export async function initMcpServer(params: {
74
72
  server: Server | McpServer;
75
73
  clientOptions?: ClientOptions;
76
74
  mcpOptions?: McpOptions;
75
+ stainlessApiKey?: string | undefined;
77
76
  }) {
78
77
  const server = params.server instanceof McpServer ? params.server.server : params.server;
79
78
 
@@ -117,7 +116,14 @@ export async function initMcpServer(params: {
117
116
  throw new Error(`Unknown tool: ${name}`);
118
117
  }
119
118
 
120
- return executeHandler(mcpTool.handler, client, args);
119
+ return executeHandler({
120
+ handler: mcpTool.handler,
121
+ reqContext: {
122
+ client,
123
+ stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
124
+ },
125
+ args,
126
+ });
121
127
  });
122
128
 
123
129
  server.setRequestHandler(SetLevelRequestSchema, async (request) => {
@@ -162,34 +168,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
162
168
  /**
163
169
  * Runs the provided handler with the given client and arguments.
164
170
  */
165
- export async function executeHandler(
166
- handler: HandlerFunction,
167
- client: NirvanaLabs,
168
- args: Record<string, unknown> | undefined,
169
- ) {
170
- return await handler(client, args || {});
171
+ export async function executeHandler({
172
+ handler,
173
+ reqContext,
174
+ args,
175
+ }: {
176
+ handler: HandlerFunction;
177
+ reqContext: McpRequestContext;
178
+ args: Record<string, unknown> | undefined;
179
+ }): Promise<ToolCallResult> {
180
+ return await handler({ reqContext, args: args || {} });
171
181
  }
172
-
173
- export const readEnv = (env: string): string | undefined => {
174
- if (typeof (globalThis as any).process !== 'undefined') {
175
- return (globalThis as any).process.env?.[env]?.trim();
176
- } else if (typeof (globalThis as any).Deno !== 'undefined') {
177
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
178
- }
179
- return;
180
- };
181
-
182
- export const readEnvOrError = (env: string): string => {
183
- let envValue = readEnv(env);
184
- if (envValue === undefined) {
185
- throw new Error(`Environment variable ${env} is not set`);
186
- }
187
- return envValue;
188
- };
189
-
190
- export const requireValue = <T>(value: T | undefined, description: string): T => {
191
- if (value === undefined) {
192
- throw new Error(`Missing required value: ${description}`);
193
- }
194
- return value;
195
- };
package/src/stdio.ts CHANGED
@@ -3,9 +3,9 @@ import { McpOptions } from './options';
3
3
  import { initMcpServer, newMcpServer } from './server';
4
4
 
5
5
  export const launchStdioServer = async (mcpOptions: McpOptions) => {
6
- const server = await newMcpServer();
6
+ const server = await newMcpServer(mcpOptions.stainlessApiKey);
7
7
 
8
- await initMcpServer({ server, mcpOptions });
8
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
9
9
 
10
10
  const transport = new StdioServerTransport();
11
11
  await server.connect(transport);
package/src/types.ts CHANGED
@@ -42,10 +42,18 @@ export type ToolCallResult = {
42
42
  isError?: boolean;
43
43
  };
44
44
 
45
- export type HandlerFunction = (
46
- client: NirvanaLabs,
47
- args: Record<string, unknown> | undefined,
48
- ) => Promise<ToolCallResult>;
45
+ export type McpRequestContext = {
46
+ client: NirvanaLabs;
47
+ stainlessApiKey?: string | undefined;
48
+ };
49
+
50
+ export type HandlerFunction = ({
51
+ reqContext,
52
+ args,
53
+ }: {
54
+ reqContext: McpRequestContext;
55
+ args: Record<string, unknown> | undefined;
56
+ }) => Promise<ToolCallResult>;
49
57
 
50
58
  export function asTextContentResult(result: unknown): ToolCallResult {
51
59
  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();
6
+ } else if (typeof (globalThis as any).Deno !== 'undefined') {
7
+ return (globalThis as any).Deno.env?.get?.(env)?.trim();
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.js CHANGED
@@ -4,8 +4,8 @@ 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
6
  const launchStdioServer = async (mcpOptions) => {
7
- const server = await (0, server_1.newMcpServer)();
8
- await (0, server_1.initMcpServer)({ server, mcpOptions });
7
+ const server = await (0, server_1.newMcpServer)(mcpOptions.stainlessApiKey);
8
+ await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
9
9
  const transport = new stdio_js_1.StdioServerTransport();
10
10
  await server.connect(transport);
11
11
  console.error('MCP Server running on stdio');
package/stdio.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IAEpC,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,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,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
package/stdio.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
2
  import { initMcpServer, newMcpServer } from "./server.mjs";
3
3
  export const launchStdioServer = async (mcpOptions) => {
4
- const server = await newMcpServer();
5
- await initMcpServer({ server, mcpOptions });
4
+ const server = await newMcpServer(mcpOptions.stainlessApiKey);
5
+ await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
6
6
  const transport = new StdioServerTransport();
7
7
  await server.connect(transport);
8
8
  console.error('MCP Server running on stdio');
package/stdio.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IAEpC,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
1
+ {"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE9D,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,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
package/types.d.mts CHANGED
@@ -31,7 +31,14 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: NirvanaLabs, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: NirvanaLabs;
36
+ stainlessApiKey?: string | undefined;
37
+ };
38
+ export type HandlerFunction = ({ reqContext, args, }: {
39
+ reqContext: McpRequestContext;
40
+ args: Record<string, unknown> | undefined;
41
+ }) => Promise<ToolCallResult>;
35
42
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
43
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
44
  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,WAAW,MAAM,uBAAuB;OACxC,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,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EACJ;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,GACD;QACE,GAAG,EAA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AAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA2BvF;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAU7D;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,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,14 @@ export type ToolCallResult = {
31
31
  content: ContentBlock[];
32
32
  isError?: boolean;
33
33
  };
34
- export type HandlerFunction = (client: NirvanaLabs, args: Record<string, unknown> | undefined) => Promise<ToolCallResult>;
34
+ export type McpRequestContext = {
35
+ client: NirvanaLabs;
36
+ stainlessApiKey?: string | undefined;
37
+ };
38
+ export type HandlerFunction = ({ reqContext, args, }: {
39
+ reqContext: McpRequestContext;
40
+ args: Record<string, unknown> | undefined;
41
+ }) => Promise<ToolCallResult>;
35
42
  export declare function asTextContentResult(result: unknown): ToolCallResult;
36
43
  export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
37
44
  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,WAAW,MAAM,uBAAuB;OACxC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAA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,EAAE;wBACR,uEAAuE;wBACvE,GAAG,EAAE,0BAA0B;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"}
package/util.d.ts 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.ts.map
package/util.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","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"}
package/util.js ADDED
@@ -0,0 +1,30 @@
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.requireValue = exports.readEnvOrError = exports.readEnv = void 0;
5
+ const readEnv = (env) => {
6
+ if (typeof globalThis.process !== 'undefined') {
7
+ return globalThis.process.env?.[env]?.trim();
8
+ }
9
+ else if (typeof globalThis.Deno !== 'undefined') {
10
+ return globalThis.Deno.env?.get?.(env)?.trim();
11
+ }
12
+ return;
13
+ };
14
+ exports.readEnv = readEnv;
15
+ const readEnvOrError = (env) => {
16
+ let envValue = (0, exports.readEnv)(env);
17
+ if (envValue === undefined) {
18
+ throw new Error(`Environment variable ${env} is not set`);
19
+ }
20
+ return envValue;
21
+ };
22
+ exports.readEnvOrError = readEnvOrError;
23
+ const requireValue = (value, description) => {
24
+ if (value === undefined) {
25
+ throw new Error(`Missing required value: ${description}`);
26
+ }
27
+ return value;
28
+ };
29
+ exports.requireValue = requireValue;
30
+ //# sourceMappingURL=util.js.map
package/util.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAE/E,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAPW,QAAA,OAAO,WAOlB;AAEK,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,MAAM,YAAY,GAAG,CAAI,KAAoB,EAAE,WAAmB,EAAK,EAAE;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB"}
package/util.mjs ADDED
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export const readEnv = (env) => {
3
+ if (typeof globalThis.process !== 'undefined') {
4
+ return globalThis.process.env?.[env]?.trim();
5
+ }
6
+ else if (typeof globalThis.Deno !== 'undefined') {
7
+ return globalThis.Deno.env?.get?.(env)?.trim();
8
+ }
9
+ return;
10
+ };
11
+ export const readEnvOrError = (env) => {
12
+ let envValue = readEnv(env);
13
+ if (envValue === undefined) {
14
+ throw new Error(`Environment variable ${env} is not set`);
15
+ }
16
+ return envValue;
17
+ };
18
+ export const requireValue = (value, description) => {
19
+ if (value === undefined) {
20
+ throw new Error(`Missing required value: ${description}`);
21
+ }
22
+ return value;
23
+ };
24
+ //# sourceMappingURL=util.mjs.map
package/util.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.mjs","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,KAAoB,EAAE,WAAmB,EAAK,EAAE;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
package/headers.d.mts DELETED
@@ -1,4 +0,0 @@
1
- import { IncomingMessage } from 'node:http';
2
- import { ClientOptions } from '@nirvana-labs/nirvana';
3
- export declare const parseAuthHeaders: (req: IncomingMessage, required?: boolean) => Partial<ClientOptions>;
4
- //# sourceMappingURL=headers.d.mts.map
package/headers.d.mts.map DELETED
@@ -1 +0,0 @@
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,uBAAuB;AAErD,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAqBhG,CAAC"}
package/headers.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { IncomingMessage } from 'node:http';
2
- import { ClientOptions } from '@nirvana-labs/nirvana';
3
- export declare const parseAuthHeaders: (req: IncomingMessage, required?: boolean) => Partial<ClientOptions>;
4
- //# sourceMappingURL=headers.d.ts.map
package/headers.d.ts.map DELETED
@@ -1 +0,0 @@
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,uBAAuB;AAErD,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAqBhG,CAAC"}