🎏 feat: Add MCP support for Streamable HTTP Transport (#7353)

This commit is contained in:
Ben Verhees 2025-05-13 19:14:15 +02:00 committed by GitHub
parent 502617db24
commit 0b44142383
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 185 additions and 11 deletions

View file

@ -82,10 +82,25 @@ export const SSEOptionsSchema = BaseOptionsSchema.extend({
),
});
export const StreamableHTTPOptionsSchema = BaseOptionsSchema.extend({
type: z.literal('streamable-http'),
headers: z.record(z.string(), z.string()).optional(),
url: z.string().url().refine(
(val) => {
const protocol = new URL(val).protocol;
return protocol !== 'ws:' && protocol !== 'wss:';
},
{
message: 'Streamable HTTP URL must not start with ws:// or wss://',
},
),
});
export const MCPOptionsSchema = z.union([
StdioOptionsSchema,
WebSocketOptionsSchema,
SSEOptionsSchema,
StreamableHTTPOptionsSchema,
]);
export const MCPServersSchema = z.record(z.string(), MCPOptionsSchema);