Skip to content

Commit e0dc6aa

Browse files
chore(internal): fix MCP server TS errors that occur with required client options
1 parent c1c15a0 commit e0dc6aa

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

packages/mcp-server/src/code-tool.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,13 @@ const localDenoHandler = async ({
293293

294294
// Strip null/undefined values so that the worker SDK client can fall back to
295295
// reading from environment variables (including any upstreamClientEnvs).
296-
const opts: ClientOptions = Object.fromEntries(
297-
Object.entries({
298-
baseURL: client.baseURL,
299-
apiKey: client.apiKey,
300-
defaultHeaders: {
301-
'X-Stainless-MCP': 'true',
302-
},
303-
}).filter(([_, v]) => v != null),
304-
) as ClientOptions;
296+
const opts = {
297+
...(client.baseURL != null ? { baseURL: client.baseURL } : undefined),
298+
...(client.apiKey != null ? { apiKey: client.apiKey } : undefined),
299+
defaultHeaders: {
300+
'X-Stainless-MCP': 'true',
301+
},
302+
} satisfies Partial<ClientOptions> as ClientOptions;
305303

306304
const req = worker.request(
307305
'http://localhost',

0 commit comments

Comments
 (0)