diff --git a/web/frontend/src/components/config/config-page.tsx b/web/frontend/src/components/config/config-page.tsx index 071c4d4a0..6fabcb814 100644 --- a/web/frontend/src/components/config/config-page.tsx +++ b/web/frontend/src/components/config/config-page.tsx @@ -291,16 +291,16 @@ export function ConfigPage() { .map((name) => [name, null] as const) const upsertServerEntries = normalizedServers.map((server) => { - if (server.type === "http") { + if (server.type !== "stdio") { if (server.url === "") { - throw new Error(`MCP server ${server.name} requires an HTTP URL.`) + throw new Error(`MCP server ${server.name} requires a URL.`) } return [ server.name, { enabled: server.enabled, - type: "http", + type: server.type, url: server.url, headers: parseJSONObjectField( server.headersText, diff --git a/web/frontend/src/components/config/config-sections.tsx b/web/frontend/src/components/config/config-sections.tsx index 323b1d194..81280e20d 100644 --- a/web/frontend/src/components/config/config-sections.tsx +++ b/web/frontend/src/components/config/config-sections.tsx @@ -380,6 +380,7 @@ export function MCPSection({ stdio + sse http diff --git a/web/frontend/src/components/config/form-model.ts b/web/frontend/src/components/config/form-model.ts index 2314c59ae..50d3d1fea 100644 --- a/web/frontend/src/components/config/form-model.ts +++ b/web/frontend/src/components/config/form-model.ts @@ -34,7 +34,7 @@ export interface CoreConfigForm { mcpServers: MCPServerForm[] } -export type MCPServerType = "http" | "stdio" +export type MCPServerType = "http" | "sse" | "stdio" export interface MCPServerForm { id: string @@ -155,7 +155,10 @@ function asNumberString(value: unknown, fallback: string): string { } function toMCPServerType(value: unknown): MCPServerType { - return value === "http" ? "http" : "stdio" + if (value === "http" || value === "sse") { + return value + } + return "stdio" } function makeMCPServerID(name: string): string { @@ -176,6 +179,8 @@ function mapMCPServers(value: unknown): MCPServerForm[] { const argsList = Array.isArray(cfg.args) ? cfg.args.filter((item): item is string => typeof item === "string") : [] + const url = asString(cfg.url) + const type = cfg.type === undefined ? (url ? "sse" : "stdio") : toMCPServerType(cfg.type) const env = asRecord(cfg.env) const headers = asRecord(cfg.headers) @@ -183,8 +188,8 @@ function mapMCPServers(value: unknown): MCPServerForm[] { id: makeMCPServerID(name), name, enabled: cfg.enabled !== false, - type: toMCPServerType(cfg.type), - url: asString(cfg.url), + type, + url, command: asString(cfg.command), argsText: argsList.join("\n"), envText: JSON.stringify(env, null, 2),