BitFun
BitFun copied to clipboard
[Bug]: MCP JSON 配置拒绝驼峰式 "streamableHttp" 传输类型
问题概述
MCP 服务器 JSON 配置编辑器会拒绝 "type": "streamableHttp"——也就是 Cursor、Cline 等客户端使用的驼峰拼写——但 OpenBitFun 本身是支持 Streamable HTTP 传输的。
校验器目前只识别 http、streamable_http、streamable-http、streamablehttp 四种写法。除此之外的拼写(包括生态里很常见的驼峰形式)会在校验阶段直接失败,服务器根本不会被添加,也不会发起连接。
影响区域
Web UI
复现步骤 / 证据
- 打开 MCP 设置里的 JSON 编辑器,粘贴使用驼峰拼写的配置:
{
"mcpServers": {
"exa": {
"type": "streamableHttp",
"url": "https://mcp.exa.ai/mcp",
"headers": { "x-api-key": "<已脱敏>" }
}
}
}
- 保存,配置被拒绝并报错:
Server 'exa' has unsupported 'type' value: 'streamableHttp'
只把 "streamableHttp" 改成 "streamable-http"(或者干脆删掉 type 字段、只保留 url),同一份配置就能保存并正常连接。这说明传输本身是受支持的,被拒绝的只是 token 的拼写。
"type": "streamableHttp" 是 Cline 的官方文档写法(https://docs.cline.bot),Cursor 等客户端也在使用。用户会直接把其他工具里的配置片段复制到 OpenBitFun,因此驼峰形式应当被接受。
根因
传输 / type token 是按大小写敏感方式匹配的,且所有匹配点都没有列出驼峰别名:
src/crates/services/services-integrations/src/mcp/config/json_config.rs——normalize_transport、normalize_legacy_type(validate_mcp_json_config的底层实现)src/crates/services/services-integrations/src/mcp/config/cursor_format.rs——parse_transport、parse_legacy_type(parse_cursor_format的底层实现)src/web-ui/src/infrastructure/config/components/mcpConfigForm.ts——transportFromConfigsrc/apps/cli/src/modes/chat/mcp.rs—— CLI 的type匹配
期望行为
streamableHttp(以及 StreamableHTTP 等其他大小写形式)应被当作 Streamable HTTP 传输的别名接受,让从其他 MCP 客户端复制来的配置无需手工修改即可使用。
环境信息(如相关)
OpenBitFun 版本/提交:main (ea2c534) 操作系统:任意