🔖 fix: Custom Headers for Initial MCP SSE Connection (#7246)

* refactor: add custom  to  as workaround to include custom headers to the initial connection request

* chore: bump MCP client version to 1.2.1 in package-lock and package.json for librechat-mcp
This commit is contained in:
Danny Avila 2025-05-06 10:14:17 -04:00 committed by GitHub
parent 4fbb81c774
commit 7c92cef2b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

2
package-lock.json generated
View file

@ -44008,7 +44008,7 @@
},
"packages/mcp": {
"name": "librechat-mcp",
"version": "1.2.0",
"version": "1.2.1",
"license": "ISC",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.9.0",

View file

@ -1,6 +1,6 @@
{
"name": "librechat-mcp",
"version": "1.2.0",
"version": "1.2.1",
"type": "commonjs",
"description": "MCP services for LibreChat",
"main": "dist/index.js",

View file

@ -68,7 +68,7 @@ export class MCPConnection extends EventEmitter {
this.client = new Client(
{
name: 'librechat-mcp-client',
version: '1.2.0',
version: '1.2.1',
},
{
capabilities: {},
@ -159,6 +159,15 @@ export class MCPConnection extends EventEmitter {
headers: options.headers,
signal: abortController.signal,
},
eventSourceInit: {
fetch: (url, init) => {
const headers = new Headers(Object.assign({}, init?.headers, options.headers));
return fetch(url, {
...init,
headers,
});
},
},
});
transport.onclose = () => {