Skip to content

Commit 14154e2

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

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,15 @@ const localDenoHandler = async ({
287287

288288
// Strip null/undefined values so that the worker SDK client can fall back to
289289
// reading from environment variables (including any upstreamClientEnvs).
290-
const opts: ClientOptions = Object.fromEntries(
291-
Object.entries({
292-
baseURL: client.baseURL,
293-
privateKey: client.privateKey,
294-
password: client.password,
295-
webhookSecret: client.webhookSecret,
296-
defaultHeaders: {
297-
'X-Stainless-MCP': 'true',
298-
},
299-
}).filter(([_, v]) => v != null),
300-
) as ClientOptions;
290+
const opts = {
291+
...(client.baseURL != null ? { baseURL: client.baseURL } : undefined),
292+
...(client.privateKey != null ? { privateKey: client.privateKey } : undefined),
293+
...(client.password != null ? { password: client.password } : undefined),
294+
...(client.webhookSecret != null ? { webhookSecret: client.webhookSecret } : 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)