feat(mcp): add OAuth authentication support for remote MCP servers (#5014)

This commit is contained in:
André Cruz
2025-12-07 20:47:27 +00:00
committed by GitHub
parent e693192e06
commit 509e43d6f8
14 changed files with 1511 additions and 74 deletions

View File

@@ -325,12 +325,33 @@ export namespace Config {
ref: "McpLocalConfig",
})
export const McpOAuth = z
.object({
clientId: z
.string()
.optional()
.describe("OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted."),
clientSecret: z.string().optional().describe("OAuth client secret (if required by the authorization server)"),
scope: z.string().optional().describe("OAuth scopes to request during authorization"),
})
.strict()
.meta({
ref: "McpOAuthConfig",
})
export type McpOAuth = z.infer<typeof McpOAuth>
export const McpRemote = z
.object({
type: z.literal("remote").describe("Type of MCP server connection"),
url: z.string().describe("URL of the remote MCP server"),
enabled: z.boolean().optional().describe("Enable or disable the MCP server on startup"),
headers: z.record(z.string(), z.string()).optional().describe("Headers to send with the request"),
oauth: z
.union([McpOAuth, z.literal(false)])
.optional()
.describe(
"OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.",
),
timeout: z
.number()
.int()