Skip to content

Commit a284756

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

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

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

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

286286
// Strip null/undefined values so that the worker SDK client can fall back to
287287
// reading from environment variables (including any upstreamClientEnvs).
288-
const opts: ClientOptions = Object.fromEntries(
289-
Object.entries({
290-
baseURL: client.baseURL,
291-
apiKey: client.apiKey,
292-
defaultHeaders: {
293-
'X-Stainless-MCP': 'true',
294-
},
295-
}).filter(([_, v]) => v != null),
296-
) as ClientOptions;
288+
const opts = {
289+
...(client.baseURL != null ? { baseURL: client.baseURL } : undefined),
290+
...(client.apiKey != null ? { apiKey: client.apiKey } : undefined),
291+
defaultHeaders: {
292+
'X-Stainless-MCP': 'true',
293+
},
294+
} satisfies Partial<ClientOptions> as ClientOptions;
297295

298296
const req = worker.request(
299297
'http://localhost',

0 commit comments

Comments
 (0)