@zavudev/sdk-mcp 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/{headers.mjs → auth.js} +18 -2
- package/auth.js.map +1 -0
- package/{headers.js → auth.mjs} +13 -6
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +6 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +301 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +296 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +8 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +8 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +248 -42
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +213 -43
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +9 -3
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +9 -3
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +6 -2
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +6 -2
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +2 -2
- package/http.d.mts.map +1 -1
- package/http.d.ts +2 -2
- package/http.d.ts.map +1 -1
- package/http.js +17 -27
- package/http.js.map +1 -1
- package/http.mjs +17 -27
- package/http.mjs.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +55 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +52 -0
- package/instructions.mjs.map +1 -0
- package/methods.d.mts.map +1 -1
- package/methods.d.ts.map +1 -1
- package/methods.js +1 -0
- package/methods.js.map +1 -1
- package/methods.mjs +1 -0
- package/methods.mjs.map +1 -1
- package/options.d.mts +4 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +4 -0
- package/options.d.ts.map +1 -1
- package/options.js +22 -0
- package/options.js.map +1 -1
- package/options.mjs +22 -0
- package/options.mjs.map +1 -1
- package/package.json +49 -13
- package/server.d.mts +8 -9
- package/server.d.mts.map +1 -1
- package/server.d.ts +8 -9
- package/server.d.ts.map +1 -1
- package/server.js +73 -75
- package/server.js.map +1 -1
- package/server.mjs +72 -71
- package/server.mjs.map +1 -1
- package/src/{headers.ts → auth.ts} +16 -1
- package/src/code-tool-paths.cts +3 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +347 -0
- package/src/code-tool.ts +287 -58
- package/src/docs-search-tool.ts +13 -4
- package/src/http.ts +24 -27
- package/src/index.ts +1 -1
- package/src/instructions.ts +74 -0
- package/src/methods.ts +2 -0
- package/src/options.ts +32 -0
- package/src/server.ts +85 -92
- package/src/stdio.ts +2 -2
- package/src/types.ts +12 -4
- package/src/util.ts +25 -0
- package/stdio.js +2 -2
- package/stdio.js.map +1 -1
- package/stdio.mjs +2 -2
- package/stdio.mjs.map +1 -1
- package/types.d.mts +8 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts +8 -1
- package/types.d.ts.map +1 -1
- package/types.js.map +1 -1
- package/types.mjs.map +1 -1
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/headers.d.mts +0 -4
- package/headers.d.mts.map +0 -1
- package/headers.d.ts +0 -4
- package/headers.d.ts.map +0 -1
- package/headers.js.map +0 -1
- package/headers.mjs.map +0 -1
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;
|
|
@@ -11,12 +14,17 @@ export type CLIOptions = McpOptions & {
|
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
export type McpOptions = {
|
|
17
|
+
includeCodeTool?: boolean | undefined;
|
|
14
18
|
includeDocsTools?: boolean | undefined;
|
|
19
|
+
stainlessApiKey?: string | undefined;
|
|
15
20
|
codeAllowHttpGets?: boolean | undefined;
|
|
16
21
|
codeAllowedMethods?: string[] | undefined;
|
|
17
22
|
codeBlockedMethods?: string[] | undefined;
|
|
23
|
+
codeExecutionMode: McpCodeExecutionMode;
|
|
18
24
|
};
|
|
19
25
|
|
|
26
|
+
export type McpCodeExecutionMode = 'stainless-sandbox' | 'local';
|
|
27
|
+
|
|
20
28
|
export function parseCLIOptions(): CLIOptions {
|
|
21
29
|
const opts = yargs(hideBin(process.argv))
|
|
22
30
|
.option('code-allow-http-gets', {
|
|
@@ -36,6 +44,13 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
36
44
|
description:
|
|
37
45
|
'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.',
|
|
38
46
|
})
|
|
47
|
+
.option('code-execution-mode', {
|
|
48
|
+
type: 'string',
|
|
49
|
+
choices: ['stainless-sandbox', 'local'],
|
|
50
|
+
default: 'stainless-sandbox',
|
|
51
|
+
description:
|
|
52
|
+
"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.",
|
|
53
|
+
})
|
|
39
54
|
.option('debug', { type: 'boolean', description: 'Enable debug logging' })
|
|
40
55
|
.option('no-tools', {
|
|
41
56
|
type: 'string',
|
|
@@ -49,6 +64,12 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
49
64
|
description: 'Port to serve on if using http transport',
|
|
50
65
|
})
|
|
51
66
|
.option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
|
|
67
|
+
.option('stainless-api-key', {
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: readEnv('STAINLESS_API_KEY'),
|
|
70
|
+
description:
|
|
71
|
+
'API key for Stainless. Used to authenticate requests to Stainless-hosted tools endpoints.',
|
|
72
|
+
})
|
|
52
73
|
.option('tools', {
|
|
53
74
|
type: 'string',
|
|
54
75
|
array: true,
|
|
@@ -72,16 +93,20 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
72
93
|
: argv.tools?.includes(toolType) ? true
|
|
73
94
|
: undefined;
|
|
74
95
|
|
|
96
|
+
const includeCodeTool = shouldIncludeToolType('code');
|
|
75
97
|
const includeDocsTools = shouldIncludeToolType('docs');
|
|
76
98
|
|
|
77
99
|
const transport = argv.transport as 'stdio' | 'http';
|
|
78
100
|
|
|
79
101
|
return {
|
|
102
|
+
...(includeCodeTool !== undefined && { includeCodeTool }),
|
|
80
103
|
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
81
104
|
debug: !!argv.debug,
|
|
105
|
+
stainlessApiKey: argv.stainlessApiKey,
|
|
82
106
|
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
83
107
|
codeAllowedMethods: argv.codeAllowedMethods,
|
|
84
108
|
codeBlockedMethods: argv.codeBlockedMethods,
|
|
109
|
+
codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode,
|
|
85
110
|
transport,
|
|
86
111
|
port: argv.port,
|
|
87
112
|
socket: argv.socket,
|
|
@@ -107,12 +132,19 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
|
|
|
107
132
|
const queryObject = typeof query === 'string' ? qs.parse(query) : query;
|
|
108
133
|
const queryOptions = QueryOptions.parse(queryObject);
|
|
109
134
|
|
|
135
|
+
let codeTool: boolean | undefined =
|
|
136
|
+
queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false
|
|
137
|
+
: queryOptions.tools?.includes('code') ? true
|
|
138
|
+
: defaultOptions.includeCodeTool;
|
|
139
|
+
|
|
110
140
|
let docsTools: boolean | undefined =
|
|
111
141
|
queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false
|
|
112
142
|
: queryOptions.tools?.includes('docs') ? true
|
|
113
143
|
: defaultOptions.includeDocsTools;
|
|
114
144
|
|
|
115
145
|
return {
|
|
146
|
+
...(codeTool !== undefined && { includeCodeTool: codeTool }),
|
|
116
147
|
...(docsTools !== undefined && { includeDocsTools: docsTools }),
|
|
148
|
+
codeExecutionMode: defaultOptions.codeExecutionMode,
|
|
117
149
|
};
|
|
118
150
|
}
|
package/src/server.ts
CHANGED
|
@@ -11,57 +11,19 @@ import { ClientOptions } from '@zavudev/sdk';
|
|
|
11
11
|
import Zavudev from '@zavudev/sdk';
|
|
12
12
|
import { codeTool } from './code-tool';
|
|
13
13
|
import docsSearchTool from './docs-search-tool';
|
|
14
|
+
import { getInstructions } from './instructions';
|
|
14
15
|
import { McpOptions } from './options';
|
|
15
16
|
import { blockedMethodsForCodeTool } from './methods';
|
|
16
|
-
import { HandlerFunction, McpTool } from './types';
|
|
17
|
+
import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
|
|
17
18
|
|
|
18
|
-
export
|
|
19
|
-
export { ClientOptions } from '@zavudev/sdk';
|
|
20
|
-
|
|
21
|
-
async function getInstructions() {
|
|
22
|
-
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
23
|
-
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
24
|
-
const response = await fetch(
|
|
25
|
-
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/zavudev',
|
|
26
|
-
{
|
|
27
|
-
method: 'GET',
|
|
28
|
-
headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
|
|
29
|
-
},
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
let instructions: string | undefined;
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
console.warn(
|
|
35
|
-
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
instructions = `
|
|
39
|
-
This is the zavudev MCP server. You will use Code Mode to help the user perform
|
|
40
|
-
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
41
|
-
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
42
|
-
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
43
|
-
block: it can be as long as you need to get the job done!
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
48
|
-
instructions = `
|
|
49
|
-
The current time in Unix timestamps is ${Date.now()}.
|
|
50
|
-
|
|
51
|
-
${instructions}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
return instructions;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const newMcpServer = async () =>
|
|
19
|
+
export const newMcpServer = async (stainlessApiKey: string | undefined) =>
|
|
58
20
|
new McpServer(
|
|
59
21
|
{
|
|
60
22
|
name: 'zavudev_sdk_api',
|
|
61
|
-
version: '0.
|
|
23
|
+
version: '0.27.0',
|
|
62
24
|
},
|
|
63
25
|
{
|
|
64
|
-
instructions: await getInstructions(),
|
|
26
|
+
instructions: await getInstructions(stainlessApiKey),
|
|
65
27
|
capabilities: { tools: {}, logging: {} },
|
|
66
28
|
},
|
|
67
29
|
);
|
|
@@ -74,6 +36,7 @@ export async function initMcpServer(params: {
|
|
|
74
36
|
server: Server | McpServer;
|
|
75
37
|
clientOptions?: ClientOptions;
|
|
76
38
|
mcpOptions?: McpOptions;
|
|
39
|
+
stainlessApiKey?: string | undefined;
|
|
77
40
|
}) {
|
|
78
41
|
const server = params.server instanceof McpServer ? params.server.server : params.server;
|
|
79
42
|
|
|
@@ -92,14 +55,32 @@ export async function initMcpServer(params: {
|
|
|
92
55
|
error: logAtLevel('error'),
|
|
93
56
|
};
|
|
94
57
|
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
58
|
+
let _client: Zavudev | undefined;
|
|
59
|
+
let _clientError: Error | undefined;
|
|
60
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
61
|
+
|
|
62
|
+
const getClient = (): Zavudev => {
|
|
63
|
+
if (_clientError) throw _clientError;
|
|
64
|
+
if (!_client) {
|
|
65
|
+
try {
|
|
66
|
+
_client = new Zavudev({
|
|
67
|
+
logger,
|
|
68
|
+
...params.clientOptions,
|
|
69
|
+
defaultHeaders: {
|
|
70
|
+
...params.clientOptions?.defaultHeaders,
|
|
71
|
+
'X-Stainless-MCP': 'true',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (_logLevel) {
|
|
75
|
+
_client = _client.withOptions({ logLevel: _logLevel });
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
_clientError = e instanceof Error ? e : new Error(String(e));
|
|
79
|
+
throw _clientError;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return _client;
|
|
83
|
+
};
|
|
103
84
|
|
|
104
85
|
const providedTools = selectTools(params.mcpOptions);
|
|
105
86
|
const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
|
|
@@ -117,29 +98,56 @@ export async function initMcpServer(params: {
|
|
|
117
98
|
throw new Error(`Unknown tool: ${name}`);
|
|
118
99
|
}
|
|
119
100
|
|
|
120
|
-
|
|
101
|
+
let client: Zavudev;
|
|
102
|
+
try {
|
|
103
|
+
client = getClient();
|
|
104
|
+
} catch (error) {
|
|
105
|
+
return {
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: 'text' as const,
|
|
109
|
+
text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
isError: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return executeHandler({
|
|
117
|
+
handler: mcpTool.handler,
|
|
118
|
+
reqContext: {
|
|
119
|
+
client,
|
|
120
|
+
stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
|
|
121
|
+
},
|
|
122
|
+
args,
|
|
123
|
+
});
|
|
121
124
|
});
|
|
122
125
|
|
|
123
126
|
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
124
127
|
const { level } = request.params;
|
|
128
|
+
let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
125
129
|
switch (level) {
|
|
126
130
|
case 'debug':
|
|
127
|
-
|
|
131
|
+
logLevel = 'debug';
|
|
128
132
|
break;
|
|
129
133
|
case 'info':
|
|
130
|
-
|
|
134
|
+
logLevel = 'info';
|
|
131
135
|
break;
|
|
132
136
|
case 'notice':
|
|
133
137
|
case 'warning':
|
|
134
|
-
|
|
138
|
+
logLevel = 'warn';
|
|
135
139
|
break;
|
|
136
140
|
case 'error':
|
|
137
|
-
|
|
141
|
+
logLevel = 'error';
|
|
138
142
|
break;
|
|
139
143
|
default:
|
|
140
|
-
|
|
144
|
+
logLevel = 'off';
|
|
141
145
|
break;
|
|
142
146
|
}
|
|
147
|
+
_logLevel = logLevel;
|
|
148
|
+
if (_client) {
|
|
149
|
+
_client = _client.withOptions({ logLevel });
|
|
150
|
+
}
|
|
143
151
|
return {};
|
|
144
152
|
});
|
|
145
153
|
}
|
|
@@ -148,11 +156,16 @@ export async function initMcpServer(params: {
|
|
|
148
156
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
149
157
|
*/
|
|
150
158
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
151
|
-
const includedTools = [
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
const includedTools = [];
|
|
160
|
+
|
|
161
|
+
if (options?.includeCodeTool ?? true) {
|
|
162
|
+
includedTools.push(
|
|
163
|
+
codeTool({
|
|
164
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
165
|
+
codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
156
169
|
if (options?.includeDocsTools ?? true) {
|
|
157
170
|
includedTools.push(docsSearchTool);
|
|
158
171
|
}
|
|
@@ -162,34 +175,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
|
|
|
162
175
|
/**
|
|
163
176
|
* Runs the provided handler with the given client and arguments.
|
|
164
177
|
*/
|
|
165
|
-
export async function executeHandler(
|
|
166
|
-
handler
|
|
167
|
-
|
|
168
|
-
args
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
export async function executeHandler({
|
|
179
|
+
handler,
|
|
180
|
+
reqContext,
|
|
181
|
+
args,
|
|
182
|
+
}: {
|
|
183
|
+
handler: HandlerFunction;
|
|
184
|
+
reqContext: McpRequestContext;
|
|
185
|
+
args: Record<string, unknown> | undefined;
|
|
186
|
+
}): Promise<ToolCallResult> {
|
|
187
|
+
return await handler({ reqContext, args: args || {} });
|
|
171
188
|
}
|
|
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
|
|
46
|
-
client: Zavudev
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
export type McpRequestContext = {
|
|
46
|
+
client: Zavudev;
|
|
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,
|
|
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,
|
|
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
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: Zavudev;
|
|
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,OAAO,MAAM,cAAc;OAC3B,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,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE3G,MAAM,MAAM,cAAc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F,MAAM,MAAM,eAAe,GAAG,CAAC,EAC7B,UAAU,EACV,IAAI,GACL,EAAE;IACD,UAAU,EAAE,iBAAiB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAC3C,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CASnE;AAED,wBAAsB,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
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: Zavudev;
|
|
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,OAAO,MAAM,cAAc;OAC3B,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,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAE3G,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO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Ac,CAAC,CAAC;AAE9B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CASnE;AAED,wBAAsB,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.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;AAyDtF,kDASC;AAED,sDA2BC;AAED,sCAUC;AAlDD,SAAgB,mBAAmB,CAAC,MAAe;IACjD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,QAAkB;IAC5D,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE;wBACR,uEAAuE;wBACvE,GAAG,EAAE,0BAA0B;wBAC/B,QAAQ;wBACR,IAAI,EAAE,IAAI;qBACX;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,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/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAyDtF,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS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"","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
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
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,cAAc;AAE5C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAqBhG,CAAC"}
|
package/headers.d.ts
DELETED
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,M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