Skip to content

feat: MCP 支持 Streamable HTTP 传输#82

Merged
weibaohui merged 1 commit into
mainfrom
feature/mcp-streamable-http
Mar 22, 2026
Merged

feat: MCP 支持 Streamable HTTP 传输#82
weibaohui merged 1 commit into
mainfrom
feature/mcp-streamable-http

Conversation

@weibaohui
Copy link
Copy Markdown
Owner

Summary

  • 后端新增 /mcp/streamable 端点,使用 mcp-go 的 StreamableHTTPServer 实现
  • 前端 MCP 页面增加 Streamable HTTP 配置选项,与 SSE 配置并列显示
  • 服务状态页面显示全部三个 MCP 端点(SSE x2 + Streamable HTTP)

Changes

  • backend/cmd/server/main.go: 添加 StreamableHTTPServer 实例和 /mcp/streamable 路由
  • frontend/src/pages/MCPPage.tsx:
    • 新增 getMCPConfigStreamable() 配置模板
    • 服务状态显示全部端点
    • 配置指南 Tab 分别显示 SSE 和 Streamable HTTP 两种配置

Test plan

  • 启动后端服务,验证 /mcp/streamable 端点可访问
  • 访问 MCP 页面,确认三个端点都正确显示
  • 复制 Streamable HTTP 配置,验证 JSON 格式正确

- 后端新增 /mcp/streamable 端点,使用 mcp-go 的 StreamableHTTPServer
- 前端 MCP 页面增加 Streamable HTTP 配置选项
- 服务状态页面显示全部三个 MCP 端点
@weibaohui weibaohui merged commit c5d9d4d into main Mar 22, 2026
1 of 2 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c724b87-af30-4a31-8595-bb59eecd9741

📥 Commits

Reviewing files that changed from the base of the PR and between 346efd6 and b87f7d5.

📒 Files selected for processing (2)
  • backend/cmd/server/main.go
  • frontend/src/pages/MCPPage.tsx

📝 Walkthrough

Summary by CodeRabbit

新功能

  • 新增 Streamable HTTP 传输方式,与现有 SSE 方式共存,提供更多连接选项。
  • 更新 MCP 配置页面,同时展示两种传输方式的端点信息与独立配置文件。
  • 用户可根据需求选择合适的传输方式,每种方式均提供独立的复制功能。

概览

此 PR 向后端 MCP 服务器添加新的 Streamable HTTP 传输端点 /mcp/streamable,并更新前端以独立支持和配置 SSE 和 Streamable HTTP 两种传输方式,包括针对各种传输的 UI 元素和配置指南。

变更

聚合 / 文件 摘要
后端 MCP 路由注册
backend/cmd/server/main.go
创建 streamableServer 实例并注册 /mcp/streamable 路由,转发所有请求至 streamableServer.ServeHTTP;更新启动日志以包含新端点。
前端 MCP 配置页面
frontend/src/pages/MCPPage.tsx
将单一配置模板拆分为两个独立构建器(getMCPConfigSSEgetMCPConfigStreamable);将剪贴板复制状态从布尔值改为字符串以追踪传输类型;重构 handleCopy 函数以处理正确的 JSON 载荷;更新 UI 服务状态部分以显示两种传输的端点信息、标签和行为描述;将配置指南卡拆分为两个独立卡,各自包含传输特定的提醒文本和代码块。

估计代码审查工作量

🎯 3 (中等) | ⏱️ ~20 分钟

可能相关的 PR

诗篇

🐰 溪流弯弯向前流,
两种传输齐聚首,
SSE 与 Streamable 舞,
配置卡儿分两户,
消息流动更自由!🌊

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/mcp-streamable-http

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant