Closed
Description
@chrisdickinson thank you for this PR
Apologies, but I'm not very strong in JS.
I need to include an API token to access my MCP server, for both the /sse
and /message
endpoints.
I believe the headers are not being used during client.connect()
?
Here’s the code snippet I’m working with:
const customHeaders = { Authorization: `Bearer ${token}` };
const transport = new SSEClientTransport(new URL(SERVER_URL), { requestInit: { headers: customHeaders } });
const client = new Client({ name: 'example-client', version: '1.0.0' }, { capabilities: {} });
await client.connect(transport);
I'm still getting 401.
As far as I can tell, the requestInit
is only being used when a message is sent. Is that correct?
I’d appreciate your help. Thank you.