@imagekit/api-mcp 7.3.0 → 7.4.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} +21 -2
- package/auth.js.map +1 -0
- package/{headers.js → auth.mjs} +16 -6
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +8 -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 +314 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +276 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +11 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +11 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +285 -42
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +253 -43
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +11 -3
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +11 -3
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +58 -5
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +57 -5
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +6 -3
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -3
- package/http.d.ts.map +1 -1
- package/http.js +130 -28
- package/http.js.map +1 -1
- package/http.mjs +130 -28
- package/http.mjs.map +1 -1
- package/index.js +17 -12
- package/index.js.map +1 -1
- package/index.mjs +17 -12
- package/index.mjs.map +1 -1
- package/instructions.d.mts +5 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +5 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +61 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +55 -0
- package/instructions.mjs.map +1 -0
- package/local-docs-search.d.mts +28 -0
- package/local-docs-search.d.mts.map +1 -0
- package/local-docs-search.d.ts +28 -0
- package/local-docs-search.d.ts.map +1 -0
- package/local-docs-search.js +2807 -0
- package/local-docs-search.js.map +1 -0
- package/local-docs-search.mjs +2767 -0
- package/local-docs-search.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +349 -0
- package/methods.js.map +1 -0
- package/methods.mjs +345 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +12 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +12 -0
- package/options.d.ts.map +1 -1
- package/options.js +81 -12
- package/options.js.map +1 -1
- package/options.mjs +81 -12
- package/options.mjs.map +1 -1
- package/package.json +89 -15
- package/server.d.mts +18 -11
- package/server.d.mts.map +1 -1
- package/server.d.ts +18 -11
- package/server.d.ts.map +1 -1
- package/server.js +89 -49
- package/server.js.map +1 -1
- package/server.mjs +88 -45
- package/server.mjs.map +1 -1
- package/src/{headers.ts → auth.ts} +18 -1
- package/src/code-tool-paths.cts +5 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +327 -0
- package/src/code-tool.ts +339 -55
- package/src/docs-search-tool.ts +86 -7
- package/src/http.ts +154 -33
- package/src/index.ts +19 -13
- package/src/instructions.ts +83 -0
- package/src/local-docs-search.ts +3380 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +370 -0
- package/src/options.ts +105 -12
- package/src/server.ts +111 -57
- package/src/stdio.ts +9 -4
- package/src/types.ts +15 -4
- package/src/util.ts +25 -0
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +8 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +8 -4
- package/stdio.mjs.map +1 -1
- package/types.d.mts +14 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts +14 -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/server.ts
CHANGED
|
@@ -11,32 +11,43 @@ import { ClientOptions } from '@imagekit/nodejs';
|
|
|
11
11
|
import ImageKit from '@imagekit/nodejs';
|
|
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 {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
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: 'imagekit_nodejs_api',
|
|
24
|
-
version: '7.
|
|
31
|
+
version: '7.4.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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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: ImageKit | undefined;
|
|
76
|
+
let _clientError: Error | undefined;
|
|
77
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
78
|
+
|
|
79
|
+
const getClient = (): ImageKit => {
|
|
80
|
+
if (_clientError) throw _clientError;
|
|
81
|
+
if (!_client) {
|
|
82
|
+
try {
|
|
83
|
+
_client = new ImageKit({
|
|
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
|
-
|
|
118
|
+
let client: ImageKit;
|
|
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
|
-
|
|
151
|
+
logLevel = 'debug';
|
|
91
152
|
break;
|
|
92
153
|
case 'info':
|
|
93
|
-
|
|
154
|
+
logLevel = 'info';
|
|
94
155
|
break;
|
|
95
156
|
case 'notice':
|
|
96
157
|
case 'warning':
|
|
97
|
-
|
|
158
|
+
logLevel = 'warn';
|
|
98
159
|
break;
|
|
99
160
|
case 'error':
|
|
100
|
-
|
|
161
|
+
logLevel = 'error';
|
|
101
162
|
break;
|
|
102
163
|
default:
|
|
103
|
-
|
|
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 = [
|
|
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,34 +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
|
|
126
|
-
|
|
127
|
-
args
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
};
|
|
148
|
-
|
|
149
|
-
export const requireValue = <T>(value: T | undefined, description: string): T => {
|
|
150
|
-
if (value === undefined) {
|
|
151
|
-
throw new Error(`Missing required value: ${description}`);
|
|
152
|
-
}
|
|
153
|
-
return value;
|
|
154
|
-
};
|
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
|
-
|
|
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
|
|
46
|
-
client: ImageKit
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
export type McpRequestContext = {
|
|
46
|
+
client: ImageKit;
|
|
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();
|
|
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.d.mts
CHANGED
package/stdio.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
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
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
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
|
|
7
|
-
|
|
8
|
-
(0, server_1.
|
|
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
|
-
|
|
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;
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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;
|
|
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
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: ImageKit;
|
|
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,QAAQ,MAAM,kBAAkB;OAChC,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,M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AAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CAC/D,CAAC;AAEF,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,20 @@ export type ToolCallResult = {
|
|
|
31
31
|
content: ContentBlock[];
|
|
32
32
|
isError?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: ImageKit;
|
|
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,QAAQ,MAAM,kBAAkB;OAChC,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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":"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;;AA4DtF,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;AA4DtF,MAAM,UAAU,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;AAED,MAAM,CAAC,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,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
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
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,kBAAkB;AAEhD,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,KAAG,OAAO,CAAC,aAAa,CA2B5E,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,MAAM,kBAAkB;AAEhD,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,KAAG,OAAO,CAAC,aAAa,CA2B5E,CAAC"}
|
package/headers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAK/E,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAA0B,EAAE;IAC/E,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;QACxD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjE,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,OAAO;gBACV,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CA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