Feature(Go): verify_tools --subset and MCP deployment docs

Add a third mode to verify_tools.py that validates the Go server end to
end: it fetches /mcp tools/list and requires the name set to equal the
nine implemented tools exactly (seven in readonly mode), compares
description / inputSchema / outputSchema field by field against
mcp/tools.json, and also checks the published order. Unlike --live,
extra or missing tools are failures, not notes.

The field-comparison loop is factored into report_field_diffs so
--offline / --live and --subset share one comparison, diff printer and
FIELDS tuple.

Document and deploy the endpoint: the systemd env example gains
YAMA_MCP_TOKEN / READONLY / TERM_IDLE / MAX_CONCURRENCY / READ_MAX,
the design doc moves to implemented and its section 10 now matches the
code (embedded tools_minimal.json, the three packet dispatch groups).
The tools README explains gen_go_tools.py --check and --subset.

Verified against a freshly built debug Go server on 16543/18090:
read-write mode passes with 9 tools, YAMA_MCP_READONLY=1 passes with 7,
and both mismatch directions (extra tools, missing tools) fail with
exit 1. gen_go_tools.py --check stays clean; no Go code changed.

Co-Authored-By: deepseek-flash
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-11-12 23:09:33 +01:00
1 parent 9ce1a58bc3
commit d4f10db1f2
4 files changed
+192 -39

No files matched your search

+19
View File
@@ -33,6 +33,25 @@ YAMA_WEB_TRUST_PROXY=1
# WebSocket Origin 白名单(逗号分隔)。空 = 仅允许同源
#YAMA_WEB_ALLOWED_ORIGINS=https://你的域名
# ---------- MCP 端点(可选)----------
# 设计见 docs/Mcp_Go_Minimal_Design.md;启用后挂在同一个 Web 端口的 /mcp。
# 静态 Bearer Token(客户端填同一个值)。空 = 不注册 /mcp(404)。
# 不会自动生成:只出现在日志里的秘密不算秘密
#YAMA_MCP_TOKEN=
# "1" = 只读模式:隐藏并拒收 terminal_exec / terminal_close(会创建/关闭会话)
#YAMA_MCP_READONLY=1
# 终端会话空闲回收(秒,默认 180)
#YAMA_MCP_TERM_IDLE=180
# 全球在途 tools/call 上限(默认 16,超出返回 -32003)
#YAMA_MCP_MAX_CONCURRENCY=16
# read_file 单文件上限(字节,默认 2 MiB;超限提示改用 download_file)
#YAMA_MCP_READ_MAX=2097152
# ---------- SSO(单点登录,可选)----------
# 共享的 HS256 签名密钥。设置后启用 SSO:YAMA 校验父域名(如 FMS 网关)下发的