Skip to content

feat(mcp): hy3-research-mcp — Hy3-powered research/code-review/document-Q&A MCP server (issue #3) - #212

Open
TPJHtpjh wants to merge 7 commits into
Tencent-Hunyuan:rhinobird2026from
TPJHtpjh:rhinobird2026
Open

feat(mcp): hy3-research-mcp — Hy3-powered research/code-review/document-Q&A MCP server (issue #3)#212
TPJHtpjh wants to merge 7 commits into
Tencent-Hunyuan:rhinobird2026from
TPJHtpjh:rhinobird2026

Conversation

@TPJHtpjh

Copy link
Copy Markdown

概述 / Summary

本 PR 实现 issue #3 要求的 hy3-research-mcp:一个由 Hy3 驱动的 MCP Server(官方 Python SDK / FastMCP / stdio),提供 4 个工具,串成一条完整的研究流水线:

Tool 功能 Hy3 推理
web_search Tavily/博查联网检索,返回标题/URL/摘要 不调用模型(保证“快工具”)
deep_research 检索 + Hy3 分析,输出带 [n] 引用的研究报告 reasoning_effort=high/low
analyze_document 本地文件(txt/md/json/csv/pdf/代码)问答 no_think/low/high
review_code git diff 逐 hunk 审查,按严重级别分组并给出修复建议 high

外部数据源(2 个):web 搜索 API + 本地文件读取,满足“额外接入 1~2 个数据源”要求。

Hy3 接入:OpenAI 兼容端点(vLLM/SGLang/托管 API),reasoning_effortchat_template_kwargs 传入;利用 Hy3 256K 长上下文并做字符预算截断。所有 Key 走 .envmcp.json 零明文密钥。

双客户端验证(真实录屏)

两端均端到端跑通全部 4 个工具;逐工具输入/输出/引用见 hy3_research_demo_summary.md
另由 scripts/validate_clients.py 用「官方 MCP Python SDK 客户端 + 手写 JSON-RPC 客户端」完成协议级双客户端验证(全部 PASS)。

一键安装

uvx --from git+https://github.com/TPJHtpjh/Hy3-MCP.git@rhinobird2026#subdirectory=mcp-server/hy3-research-mcp hy3-research-mcp
# 或 pip install . / install.sh / install.ps1,详见 mcp-server/hy3-research-mcp/README.md

验收对照

  • MCP Python SDK + stdio
  • ≥3 个 tool(提供 4 个),名称/参数/说明清晰
  • 内部调用 Hy3 API 完成核心推理(reasoning_effort 分级)
  • 额外 1~2 个数据源(搜索 API + 本地文件)
  • stdio 本地运行,Key 走环境变量,零硬编码
  • ≥2 个 MCP 客户端验证(WorkBuddy + Trae,含真实录屏)
  • 一键安装(uvx / pip / install 脚本)+ 中英 README
  • demo 视频(assets/demo_*.mp4

请评审,谢谢!

TPJHtpjh added 7 commits July 28, 2026 15:27
Build an MCP Server powered by Hy3 (rhinobird2026):
- 4 stdio tools: web_search, deep_research, analyze_document, review_code
- Hy3 called via OpenAI-compatible API with reasoning_effort control
- 2 external data sources: web search (Tavily/Bocha) + local file parsing
- All secrets via environment variables, no hardcoded keys
- Client configs for CodeBuddy/WorkBuddy, Cursor, Cline
- 20 mocked unit tests + real stdio smoke test, bilingual README
- scripts/validate_clients.py proves the server works end-to-end with two
  distinct MCP clients (official MCP Python SDK + hand-rolled JSON-RPC)
- scripts/demo_session.py, make_demo_gif.py, record_demo.sh + assets/demo.gif
  and DEMO_GUIDE.md document the headless demo runbook
- auto-load .env via python-dotenv so local runs work out-of-the-box
- document two-client validation in README
- build dist/hy3_research_mcp-0.1.0-py3-none-any.whl (one-click install via
  'pip install .' or the wheel)
- examples/local.mcp.json: single-file client config for the local install
  (command 'hy3-research-mcp', keys injected via env) - satisfies issue's
  one-click install + no-hardcoded-keys requirements
- verified the packaged console script starts over stdio and exposes all 4 tools
- server.py now uses find_dotenv(usecwd=True) so .env is discovered from the
  client's launch directory upward; API keys stay out of the MCP config
- add mcp.json (no env block) for use in both WorkBuddy and Trae
- examples/local.mcp.json updated to the secret-free form
- rebuilt wheel (dist/) with the .env loading fix
- Load secrets from .env with resolution order: HY3_ENV_FILE ->
  launch dir (walk-up) -> ~/.config/hy3-research-mcp/.env and
  ~/.hy3-research-mcp.env. Keeps API keys out of mcp.json.
- Validate configuration lazily per tool call instead of at startup,
  so the server still starts and lists tools before credentials are set.
- Promote pypdf to a core dependency (PDF works out of the box).
- Add ready-to-use .workbuddy/mcp.json and .trae/mcp.json (secret-free,
  bare 'hy3-research-mcp' command) for one-click client setup.
- Add scripts/probe_console.py to verify the bare command over stdio.
- Update README accordingly.
- assets/demo_workbuddy.mp4 + assets/demo_trae.mp4: compressed (1600x1000,
  ~5-9MB each) live recordings driving all 4 tools from two real MCP clients.
- hy3_research_demo_summary.md: per-tool inputs/outputs/citations write-up.
- examples/demo_prompt.md: copy-paste demo prompt (comprehensive + per-tool).
- scripts/probe_trae.py: verifies the server launches from a foreign cwd
  with HY3_ENV_FILE (matches how clients invoke it).
- README: add a 'Real-client screen recordings' section.
- .gitignore: exclude local-only artifacts (session memory, task PDF,
  raw screen captures, logs).
@TPJHtpjh

Copy link
Copy Markdown
Author

演示视频直达(可在线播放,均 < 10MB)

逐工具输入/输出/引用hy3_research_demo_summary.md
演示提示词examples/demo_prompt.md

视频均在本 PR 的 mcp-server/hy3-research-mcp/assets/ 目录下。

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