@henrylabs/mcp 0.25.0 → 1.0.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/auth.js +22 -0
- package/auth.js.map +1 -0
- package/auth.mjs +17 -0
- 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 +251 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +246 -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 +272 -44
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +240 -45
- 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 +28 -5
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +28 -5
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +3 -5
- package/http.d.mts.map +1 -1
- package/http.d.ts +3 -5
- package/http.d.ts.map +1 -1
- package/http.js +103 -41
- package/http.js.map +1 -1
- package/http.mjs +103 -41
- package/http.mjs.map +1 -1
- package/index.js +13 -12
- package/index.js.map +1 -1
- package/index.mjs +13 -12
- 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 +42 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +39 -0
- package/instructions.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.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 +5 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +5 -0
- package/options.d.ts.map +1 -1
- package/options.js +31 -0
- package/options.js.map +1 -1
- package/options.mjs +31 -0
- package/options.mjs.map +1 -1
- package/package.json +67 -17
- package/server.d.mts +9 -9
- package/server.d.mts.map +1 -1
- package/server.d.ts +9 -9
- package/server.d.ts.map +1 -1
- package/server.js +76 -76
- package/server.js.map +1 -1
- package/server.mjs +75 -72
- package/server.mjs.map +1 -1
- package/src/auth.ts +25 -0
- package/src/code-tool-paths.cts +5 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +297 -0
- package/src/code-tool.ts +325 -59
- package/src/docs-search-tool.ts +48 -7
- package/src/http.ts +116 -45
- package/src/index.ts +15 -13
- package/src/instructions.ts +60 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +2 -0
- package/src/options.ts +43 -0
- package/src/server.ts +89 -93
- package/src/stdio.ts +4 -3
- package/src/types.ts +13 -4
- package/src/util.ts +25 -0
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +4 -3
- package/stdio.js.map +1 -1
- package/stdio.mjs +4 -3
- package/stdio.mjs.map +1 -1
- package/types.d.mts +9 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts +9 -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 +0 -10
- package/headers.js.map +0 -1
- package/headers.mjs +0 -6
- package/headers.mjs.map +0 -1
- package/src/headers.ts +0 -10
package/src/server.ts
CHANGED
|
@@ -11,57 +11,20 @@ import { ClientOptions } from '@henrylabs/sdk';
|
|
|
11
11
|
import HenrySDK from '@henrylabs/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';
|
|
18
|
+
import { readEnv } from './util';
|
|
17
19
|
|
|
18
|
-
export
|
|
19
|
-
export { ClientOptions } from '@henrylabs/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/henry-sdk',
|
|
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 henry-sdk 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 () =>
|
|
20
|
+
export const newMcpServer = async (stainlessApiKey: string | undefined) =>
|
|
58
21
|
new McpServer(
|
|
59
22
|
{
|
|
60
23
|
name: 'henrylabs_sdk_api',
|
|
61
|
-
version: '0.
|
|
24
|
+
version: '1.0.0',
|
|
62
25
|
},
|
|
63
26
|
{
|
|
64
|
-
instructions: await getInstructions(),
|
|
27
|
+
instructions: await getInstructions(stainlessApiKey),
|
|
65
28
|
capabilities: { tools: {}, logging: {} },
|
|
66
29
|
},
|
|
67
30
|
);
|
|
@@ -74,6 +37,8 @@ export async function initMcpServer(params: {
|
|
|
74
37
|
server: Server | McpServer;
|
|
75
38
|
clientOptions?: ClientOptions;
|
|
76
39
|
mcpOptions?: McpOptions;
|
|
40
|
+
stainlessApiKey?: string | undefined;
|
|
41
|
+
upstreamClientEnvs?: Record<string, string> | undefined;
|
|
77
42
|
}) {
|
|
78
43
|
const server = params.server instanceof McpServer ? params.server.server : params.server;
|
|
79
44
|
|
|
@@ -92,15 +57,33 @@ export async function initMcpServer(params: {
|
|
|
92
57
|
error: logAtLevel('error'),
|
|
93
58
|
};
|
|
94
59
|
|
|
95
|
-
let
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
60
|
+
let _client: HenrySDK | undefined;
|
|
61
|
+
let _clientError: Error | undefined;
|
|
62
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
63
|
+
|
|
64
|
+
const getClient = (): HenrySDK => {
|
|
65
|
+
if (_clientError) throw _clientError;
|
|
66
|
+
if (!_client) {
|
|
67
|
+
try {
|
|
68
|
+
_client = new HenrySDK({
|
|
69
|
+
...{ environment: (readEnv('HENRY_SDK_ENVIRONMENT') || undefined) as any },
|
|
70
|
+
logger,
|
|
71
|
+
...params.clientOptions,
|
|
72
|
+
defaultHeaders: {
|
|
73
|
+
...params.clientOptions?.defaultHeaders,
|
|
74
|
+
'X-Stainless-MCP': 'true',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (_logLevel) {
|
|
78
|
+
_client = _client.withOptions({ logLevel: _logLevel });
|
|
79
|
+
}
|
|
80
|
+
} catch (e) {
|
|
81
|
+
_clientError = e instanceof Error ? e : new Error(String(e));
|
|
82
|
+
throw _clientError;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return _client;
|
|
86
|
+
};
|
|
104
87
|
|
|
105
88
|
const providedTools = selectTools(params.mcpOptions);
|
|
106
89
|
const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
|
|
@@ -118,29 +101,57 @@ export async function initMcpServer(params: {
|
|
|
118
101
|
throw new Error(`Unknown tool: ${name}`);
|
|
119
102
|
}
|
|
120
103
|
|
|
121
|
-
|
|
104
|
+
let client: HenrySDK;
|
|
105
|
+
try {
|
|
106
|
+
client = getClient();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
return {
|
|
109
|
+
content: [
|
|
110
|
+
{
|
|
111
|
+
type: 'text' as const,
|
|
112
|
+
text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
isError: true,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return executeHandler({
|
|
120
|
+
handler: mcpTool.handler,
|
|
121
|
+
reqContext: {
|
|
122
|
+
client,
|
|
123
|
+
stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
|
|
124
|
+
upstreamClientEnvs: params.upstreamClientEnvs,
|
|
125
|
+
},
|
|
126
|
+
args,
|
|
127
|
+
});
|
|
122
128
|
});
|
|
123
129
|
|
|
124
130
|
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
125
131
|
const { level } = request.params;
|
|
132
|
+
let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
126
133
|
switch (level) {
|
|
127
134
|
case 'debug':
|
|
128
|
-
|
|
135
|
+
logLevel = 'debug';
|
|
129
136
|
break;
|
|
130
137
|
case 'info':
|
|
131
|
-
|
|
138
|
+
logLevel = 'info';
|
|
132
139
|
break;
|
|
133
140
|
case 'notice':
|
|
134
141
|
case 'warning':
|
|
135
|
-
|
|
142
|
+
logLevel = 'warn';
|
|
136
143
|
break;
|
|
137
144
|
case 'error':
|
|
138
|
-
|
|
145
|
+
logLevel = 'error';
|
|
139
146
|
break;
|
|
140
147
|
default:
|
|
141
|
-
|
|
148
|
+
logLevel = 'off';
|
|
142
149
|
break;
|
|
143
150
|
}
|
|
151
|
+
_logLevel = logLevel;
|
|
152
|
+
if (_client) {
|
|
153
|
+
_client = _client.withOptions({ logLevel });
|
|
154
|
+
}
|
|
144
155
|
return {};
|
|
145
156
|
});
|
|
146
157
|
}
|
|
@@ -149,11 +160,16 @@ export async function initMcpServer(params: {
|
|
|
149
160
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
150
161
|
*/
|
|
151
162
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
152
|
-
const includedTools = [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
const includedTools = [];
|
|
164
|
+
|
|
165
|
+
if (options?.includeCodeTool ?? true) {
|
|
166
|
+
includedTools.push(
|
|
167
|
+
codeTool({
|
|
168
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
169
|
+
codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
|
|
170
|
+
}),
|
|
171
|
+
);
|
|
172
|
+
}
|
|
157
173
|
if (options?.includeDocsTools ?? true) {
|
|
158
174
|
includedTools.push(docsSearchTool);
|
|
159
175
|
}
|
|
@@ -163,34 +179,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
|
|
|
163
179
|
/**
|
|
164
180
|
* Runs the provided handler with the given client and arguments.
|
|
165
181
|
*/
|
|
166
|
-
export async function executeHandler(
|
|
167
|
-
handler
|
|
168
|
-
|
|
169
|
-
args
|
|
170
|
-
|
|
171
|
-
|
|
182
|
+
export async function executeHandler({
|
|
183
|
+
handler,
|
|
184
|
+
reqContext,
|
|
185
|
+
args,
|
|
186
|
+
}: {
|
|
187
|
+
handler: HandlerFunction;
|
|
188
|
+
reqContext: McpRequestContext;
|
|
189
|
+
args: Record<string, unknown> | undefined;
|
|
190
|
+
}): Promise<ToolCallResult> {
|
|
191
|
+
return await handler({ reqContext, args: args || {} });
|
|
172
192
|
}
|
|
173
|
-
|
|
174
|
-
export const readEnv = (env: string): string | undefined => {
|
|
175
|
-
if (typeof (globalThis as any).process !== 'undefined') {
|
|
176
|
-
return (globalThis as any).process.env?.[env]?.trim();
|
|
177
|
-
} else if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
178
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
179
|
-
}
|
|
180
|
-
return;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export const readEnvOrError = (env: string): string => {
|
|
184
|
-
let envValue = readEnv(env);
|
|
185
|
-
if (envValue === undefined) {
|
|
186
|
-
throw new Error(`Environment variable ${env} is not set`);
|
|
187
|
-
}
|
|
188
|
-
return envValue;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export const requireValue = <T>(value: T | undefined, description: string): T => {
|
|
192
|
-
if (value === undefined) {
|
|
193
|
-
throw new Error(`Missing required value: ${description}`);
|
|
194
|
-
}
|
|
195
|
-
return value;
|
|
196
|
-
};
|
package/src/stdio.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { McpOptions } from './options';
|
|
3
3
|
import { initMcpServer, newMcpServer } from './server';
|
|
4
|
+
import { getLogger } from './logger';
|
|
4
5
|
|
|
5
6
|
export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
6
|
-
const server = await newMcpServer();
|
|
7
|
+
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
7
8
|
|
|
8
|
-
await initMcpServer({ server, mcpOptions });
|
|
9
|
+
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
9
10
|
|
|
10
11
|
const transport = new StdioServerTransport();
|
|
11
12
|
await server.connect(transport);
|
|
12
|
-
|
|
13
|
+
getLogger().info('MCP Server running on stdio');
|
|
13
14
|
};
|
package/src/types.ts
CHANGED
|
@@ -42,10 +42,19 @@ export type ToolCallResult = {
|
|
|
42
42
|
isError?: boolean;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export type
|
|
46
|
-
client: HenrySDK
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
export type McpRequestContext = {
|
|
46
|
+
client: HenrySDK;
|
|
47
|
+
stainlessApiKey?: string | undefined;
|
|
48
|
+
upstreamClientEnvs?: Record<string, string> | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type HandlerFunction = ({
|
|
52
|
+
reqContext,
|
|
53
|
+
args,
|
|
54
|
+
}: {
|
|
55
|
+
reqContext: McpRequestContext;
|
|
56
|
+
args: Record<string, unknown> | undefined;
|
|
57
|
+
}) => Promise<ToolCallResult>;
|
|
49
58
|
|
|
50
59
|
export function asTextContentResult(result: unknown): ToolCallResult {
|
|
51
60
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;
|
|
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,kBAQ7D,CAAC"}
|
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;
|
|
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,kBAQ7D,CAAC"}
|
package/stdio.js
CHANGED
|
@@ -3,12 +3,13 @@ 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 logger_1 = require("./logger.js");
|
|
6
7
|
const launchStdioServer = async (mcpOptions) => {
|
|
7
|
-
const server = await (0, server_1.newMcpServer)();
|
|
8
|
-
await (0, server_1.initMcpServer)({ server, mcpOptions });
|
|
8
|
+
const server = await (0, server_1.newMcpServer)(mcpOptions.stainlessApiKey);
|
|
9
|
+
await (0, server_1.initMcpServer)({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
9
10
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
11
|
await server.connect(transport);
|
|
11
|
-
|
|
12
|
+
(0, logger_1.getLogger)().info('MCP Server running on stdio');
|
|
12
13
|
};
|
|
13
14
|
exports.launchStdioServer = launchStdioServer;
|
|
14
15
|
//# 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;AAEjF,wCAAuD;
|
|
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,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,IAAA,kBAAS,GAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
package/stdio.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
|
+
import { getLogger } from "./logger.mjs";
|
|
3
4
|
export const launchStdioServer = async (mcpOptions) => {
|
|
4
|
-
const server = await newMcpServer();
|
|
5
|
-
await initMcpServer({ server, mcpOptions });
|
|
5
|
+
const server = await newMcpServer(mcpOptions.stainlessApiKey);
|
|
6
|
+
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
6
7
|
const transport = new StdioServerTransport();
|
|
7
8
|
await server.connect(transport);
|
|
8
|
-
|
|
9
|
+
getLogger().info('MCP Server running on stdio');
|
|
9
10
|
};
|
|
10
11
|
//# 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;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;
|
|
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,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,SAAS,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
package/types.d.mts
CHANGED
|
@@ -31,7 +31,15 @@ export type ToolCallResult = {
|
|
|
31
31
|
content: ContentBlock[];
|
|
32
32
|
isError?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: HenrySDK;
|
|
36
|
+
stainlessApiKey?: string | undefined;
|
|
37
|
+
upstreamClientEnvs?: Record<string, string> | undefined;
|
|
38
|
+
};
|
|
39
|
+
export type HandlerFunction = ({ reqContext, args, }: {
|
|
40
|
+
reqContext: McpRequestContext;
|
|
41
|
+
args: Record<string, unknown> | undefined;
|
|
42
|
+
}) => Promise<ToolCallResult>;
|
|
35
43
|
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
44
|
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
45
|
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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AAC,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,15 @@ export type ToolCallResult = {
|
|
|
31
31
|
content: ContentBlock[];
|
|
32
32
|
isError?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export type
|
|
34
|
+
export type McpRequestContext = {
|
|
35
|
+
client: HenrySDK;
|
|
36
|
+
stainlessApiKey?: string | undefined;
|
|
37
|
+
upstreamClientEnvs?: Record<string, string> | undefined;
|
|
38
|
+
};
|
|
39
|
+
export type HandlerFunction = ({ reqContext, args, }: {
|
|
40
|
+
reqContext: McpRequestContext;
|
|
41
|
+
args: Record<string, unknown> | undefined;
|
|
42
|
+
}) => Promise<ToolCallResult>;
|
|
35
43
|
export declare function asTextContentResult(result: unknown): ToolCallResult;
|
|
36
44
|
export declare function asBinaryContentResult(response: Response): Promise<ToolCallResult>;
|
|
37
45
|
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,gBAAgB;OAC9B,EAAE,IAAI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,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;;AA0DtF,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;AA0DtF,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,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AAO,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,gBAAgB;AAE9C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAIhG,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,gBAAgB;AAE9C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAIhG,CAAC"}
|
package/headers.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.parseAuthHeaders = void 0;
|
|
5
|
-
const parseAuthHeaders = (req, required) => {
|
|
6
|
-
const apiKey = Array.isArray(req.headers['x-api-key']) ? req.headers['x-api-key'][0] : req.headers['x-api-key'];
|
|
7
|
-
return { apiKey };
|
|
8
|
-
};
|
|
9
|
-
exports.parseAuthHeaders = parseAuthHeaders;
|
|
10
|
-
//# sourceMappingURL=headers.js.map
|
package/headers.js.map
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,EAAE,QAAkB,EAA0B,EAAE;IACnG,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnG,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
|
package/headers.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
export const parseAuthHeaders = (req, required) => {
|
|
3
|
-
const apiKey = Array.isArray(req.headers['x-api-key']) ? req.headers['x-api-key'][0] : req.headers['x-api-key'];
|
|
4
|
-
return { apiKey };
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=headers.mjs.map
|
package/headers.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.mjs","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAKtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAAE,QAAkB,EAA0B,EAAE;IACnG,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnG,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC"}
|
package/src/headers.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { IncomingMessage } from 'node:http';
|
|
4
|
-
import { ClientOptions } from '@henrylabs/sdk';
|
|
5
|
-
|
|
6
|
-
export const parseAuthHeaders = (req: IncomingMessage, required?: boolean): Partial<ClientOptions> => {
|
|
7
|
-
const apiKey =
|
|
8
|
-
Array.isArray(req.headers['x-api-key']) ? req.headers['x-api-key'][0] : req.headers['x-api-key'];
|
|
9
|
-
return { apiKey };
|
|
10
|
-
};
|