@henrylabs/mcp 0.24.0 → 0.26.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 +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 +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 +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 +277 -40
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +242 -41
- 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 +27 -4
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +27 -4
- 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 +70 -30
- package/http.js.map +1 -1
- package/http.mjs +70 -30
- 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 +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 +56 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +53 -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 +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 +227 -0
- package/methods.js.map +1 -0
- package/methods.mjs +223 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +9 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +9 -0
- package/options.d.ts.map +1 -1
- package/options.js +62 -12
- package/options.js.map +1 -1
- package/options.mjs +62 -12
- package/options.mjs.map +1 -1
- package/package.json +73 -13
- package/server.d.mts +9 -11
- package/server.d.mts.map +1 -1
- package/server.d.ts +9 -11
- package/server.d.ts.map +1 -1
- package/server.js +81 -50
- package/server.js.map +1 -1
- package/server.mjs +80 -46
- package/server.mjs.map +1 -1
- package/src/auth.ts +25 -0
- package/src/code-tool-paths.cts +3 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +297 -0
- package/src/code-tool.ts +327 -52
- package/src/docs-search-tool.ts +46 -6
- package/src/http.ts +86 -33
- package/src/index.ts +19 -13
- package/src/instructions.ts +75 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +248 -0
- package/src/options.ts +81 -12
- package/src/server.ts +92 -57
- package/src/stdio.ts +6 -4
- package/src/types.ts +12 -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 +5 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +5 -4
- 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 +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,32 +11,33 @@ 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
|
-
import {
|
|
16
|
+
import { blockedMethodsForCodeTool } from './methods';
|
|
17
|
+
import { HandlerFunction, McpRequestContext, ToolCallResult, McpTool } from './types';
|
|
18
|
+
import { readEnv } from './util';
|
|
16
19
|
|
|
17
|
-
export
|
|
18
|
-
export { ClientOptions } from '@henrylabs/sdk';
|
|
19
|
-
|
|
20
|
-
export const newMcpServer = () =>
|
|
20
|
+
export const newMcpServer = async (stainlessApiKey: string | undefined) =>
|
|
21
21
|
new McpServer(
|
|
22
22
|
{
|
|
23
23
|
name: 'henrylabs_sdk_api',
|
|
24
|
-
version: '0.
|
|
24
|
+
version: '0.26.0',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
instructions: await getInstructions(stainlessApiKey),
|
|
28
|
+
capabilities: { tools: {}, logging: {} },
|
|
25
29
|
},
|
|
26
|
-
{ capabilities: { tools: {}, logging: {} } },
|
|
27
30
|
);
|
|
28
31
|
|
|
29
|
-
// Create server instance
|
|
30
|
-
export const server = newMcpServer();
|
|
31
|
-
|
|
32
32
|
/**
|
|
33
33
|
* Initializes the provided MCP Server with the given tools and handlers.
|
|
34
34
|
* If not provided, the default client, tools and handlers will be used.
|
|
35
35
|
*/
|
|
36
|
-
export function initMcpServer(params: {
|
|
36
|
+
export async function initMcpServer(params: {
|
|
37
37
|
server: Server | McpServer;
|
|
38
38
|
clientOptions?: ClientOptions;
|
|
39
39
|
mcpOptions?: McpOptions;
|
|
40
|
+
stainlessApiKey?: string | undefined;
|
|
40
41
|
}) {
|
|
41
42
|
const server = params.server instanceof McpServer ? params.server.server : params.server;
|
|
42
43
|
|
|
@@ -55,15 +56,33 @@ export function initMcpServer(params: {
|
|
|
55
56
|
error: logAtLevel('error'),
|
|
56
57
|
};
|
|
57
58
|
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
let _client: HenrySDK | undefined;
|
|
60
|
+
let _clientError: Error | undefined;
|
|
61
|
+
let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;
|
|
62
|
+
|
|
63
|
+
const getClient = (): HenrySDK => {
|
|
64
|
+
if (_clientError) throw _clientError;
|
|
65
|
+
if (!_client) {
|
|
66
|
+
try {
|
|
67
|
+
_client = new HenrySDK({
|
|
68
|
+
...{ environment: (readEnv('HENRY_SDK_ENVIRONMENT') || undefined) as any },
|
|
69
|
+
logger,
|
|
70
|
+
...params.clientOptions,
|
|
71
|
+
defaultHeaders: {
|
|
72
|
+
...params.clientOptions?.defaultHeaders,
|
|
73
|
+
'X-Stainless-MCP': 'true',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if (_logLevel) {
|
|
77
|
+
_client = _client.withOptions({ logLevel: _logLevel });
|
|
78
|
+
}
|
|
79
|
+
} catch (e) {
|
|
80
|
+
_clientError = e instanceof Error ? e : new Error(String(e));
|
|
81
|
+
throw _clientError;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return _client;
|
|
85
|
+
};
|
|
67
86
|
|
|
68
87
|
const providedTools = selectTools(params.mcpOptions);
|
|
69
88
|
const toolMap = Object.fromEntries(providedTools.map((mcpTool) => [mcpTool.tool.name, mcpTool]));
|
|
@@ -81,29 +100,56 @@ export function initMcpServer(params: {
|
|
|
81
100
|
throw new Error(`Unknown tool: ${name}`);
|
|
82
101
|
}
|
|
83
102
|
|
|
84
|
-
|
|
103
|
+
let client: HenrySDK;
|
|
104
|
+
try {
|
|
105
|
+
client = getClient();
|
|
106
|
+
} catch (error) {
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: 'text' as const,
|
|
111
|
+
text: `Failed to initialize client: ${error instanceof Error ? error.message : String(error)}`,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
isError: true,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return executeHandler({
|
|
119
|
+
handler: mcpTool.handler,
|
|
120
|
+
reqContext: {
|
|
121
|
+
client,
|
|
122
|
+
stainlessApiKey: params.stainlessApiKey ?? params.mcpOptions?.stainlessApiKey,
|
|
123
|
+
},
|
|
124
|
+
args,
|
|
125
|
+
});
|
|
85
126
|
});
|
|
86
127
|
|
|
87
128
|
server.setRequestHandler(SetLevelRequestSchema, async (request) => {
|
|
88
129
|
const { level } = request.params;
|
|
130
|
+
let logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
89
131
|
switch (level) {
|
|
90
132
|
case 'debug':
|
|
91
|
-
|
|
133
|
+
logLevel = 'debug';
|
|
92
134
|
break;
|
|
93
135
|
case 'info':
|
|
94
|
-
|
|
136
|
+
logLevel = 'info';
|
|
95
137
|
break;
|
|
96
138
|
case 'notice':
|
|
97
139
|
case 'warning':
|
|
98
|
-
|
|
140
|
+
logLevel = 'warn';
|
|
99
141
|
break;
|
|
100
142
|
case 'error':
|
|
101
|
-
|
|
143
|
+
logLevel = 'error';
|
|
102
144
|
break;
|
|
103
145
|
default:
|
|
104
|
-
|
|
146
|
+
logLevel = 'off';
|
|
105
147
|
break;
|
|
106
148
|
}
|
|
149
|
+
_logLevel = logLevel;
|
|
150
|
+
if (_client) {
|
|
151
|
+
_client = _client.withOptions({ logLevel });
|
|
152
|
+
}
|
|
107
153
|
return {};
|
|
108
154
|
});
|
|
109
155
|
}
|
|
@@ -112,7 +158,16 @@ export function initMcpServer(params: {
|
|
|
112
158
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
113
159
|
*/
|
|
114
160
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
115
|
-
const includedTools = [
|
|
161
|
+
const includedTools = [];
|
|
162
|
+
|
|
163
|
+
if (options?.includeCodeTool ?? true) {
|
|
164
|
+
includedTools.push(
|
|
165
|
+
codeTool({
|
|
166
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
167
|
+
codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox',
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
170
|
+
}
|
|
116
171
|
if (options?.includeDocsTools ?? true) {
|
|
117
172
|
includedTools.push(docsSearchTool);
|
|
118
173
|
}
|
|
@@ -122,34 +177,14 @@ export function selectTools(options?: McpOptions): McpTool[] {
|
|
|
122
177
|
/**
|
|
123
178
|
* Runs the provided handler with the given client and arguments.
|
|
124
179
|
*/
|
|
125
|
-
export async function executeHandler(
|
|
126
|
-
handler
|
|
127
|
-
|
|
128
|
-
args
|
|
129
|
-
|
|
130
|
-
|
|
180
|
+
export async function executeHandler({
|
|
181
|
+
handler,
|
|
182
|
+
reqContext,
|
|
183
|
+
args,
|
|
184
|
+
}: {
|
|
185
|
+
handler: HandlerFunction;
|
|
186
|
+
reqContext: McpRequestContext;
|
|
187
|
+
args: Record<string, unknown> | undefined;
|
|
188
|
+
}): Promise<ToolCallResult> {
|
|
189
|
+
return await handler({ reqContext, args: args || {} });
|
|
131
190
|
}
|
|
132
|
-
|
|
133
|
-
export const readEnv = (env: string): string | undefined => {
|
|
134
|
-
if (typeof (globalThis as any).process !== 'undefined') {
|
|
135
|
-
return (globalThis as any).process.env?.[env]?.trim();
|
|
136
|
-
} else if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
137
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const readEnvOrError = (env: string): string => {
|
|
143
|
-
let envValue = readEnv(env);
|
|
144
|
-
if (envValue === undefined) {
|
|
145
|
-
throw new Error(`Environment variable ${env} is not set`);
|
|
146
|
-
}
|
|
147
|
-
return envValue;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export const requireValue = <T>(value: T | undefined, description: string): T => {
|
|
151
|
-
if (value === undefined) {
|
|
152
|
-
throw new Error(`Missing required value: ${description}`);
|
|
153
|
-
}
|
|
154
|
-
return value;
|
|
155
|
-
};
|
package/src/stdio.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
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(mcpOptions.stainlessApiKey);
|
|
6
8
|
|
|
7
|
-
initMcpServer({ server });
|
|
9
|
+
await initMcpServer({ server, mcpOptions, stainlessApiKey: mcpOptions.stainlessApiKey });
|
|
8
10
|
|
|
9
11
|
const transport = new StdioServerTransport();
|
|
10
12
|
await server.connect(transport);
|
|
11
|
-
|
|
13
|
+
getLogger().info('MCP Server running on stdio');
|
|
12
14
|
};
|
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: HenrySDK
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
export type McpRequestContext = {
|
|
46
|
+
client: HenrySDK;
|
|
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.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,kBAQ7D,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,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
|
|
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)(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;
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { getLogger } from "./logger.mjs";
|
|
4
|
+
export const launchStdioServer = async (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;
|
|
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,14 @@ 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
|
+
};
|
|
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,QAAQ,MAAM,gBAAgB;OAC9B,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.mts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"OAEO,QAAQ,MA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AC,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: HenrySDK;
|
|
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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AO,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,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,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AAC,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,KAAG,OAAO,CAAC,aAAa,CAI5E,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,KAAG,OAAO,CAAC,aAAa,CAI5E,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) => {
|
|
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,EAA0B,EAAE;IAC/E,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) => {
|
|
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,EAA0B,EAAE;IAC/E,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): 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
|
-
};
|