Support custom headers in MCP servers

This commit is contained in:
Alex Gleason committed 2025-11-22 00:46:41 -06:00
1 parent 393ed3ebca
commit 30ead01178
5 files changed
+127 -3

No files matched your search

+6 -2
View File
@@ -21,8 +21,12 @@ export class MCPClient {
capabilities: {}
});
// Create HTTP transport
this.transport = new StreamableHTTPClientTransport(new URL(server.url));
// Create HTTP transport with optional custom headers
this.transport = new StreamableHTTPClientTransport(new URL(server.url), {
requestInit: server.headers ? {
headers: server.headers,
} : undefined,
});
}
/**
+1
View File
@@ -45,6 +45,7 @@ const providerModelSchema = z.string().regex(
const mcpServerSchema: z.ZodType<MCPServer> = z.object({
type: z.literal('streamable-http'),
url: z.string().url(),
headers: z.record(z.string(), z.string()).optional(),
});
const aiSettingsSchema = z.object({