Skip to content

Commit 2991a6d

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

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
@@ -283,15 +283,13 @@ const localDenoHandler = async ({
283283

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

296294
const req = worker.request(
297295
'http://localhost',

0 commit comments

Comments
 (0)