Skip to content

Commit c834dba

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

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

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

302300
const req = worker.request(
303301
'http://localhost',

0 commit comments

Comments
 (0)