Files
isphere-ai-bridge/docs/go-mcp-library-decision.md
2026-07-05 19:18:56 +08:00

28 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Go MCP Library Decision
## N6 decision
选择官方 Go MCP SDK
- module`github.com/modelcontextprotocol/go-sdk`,固定版本 `v1.3.1`
- package`github.com/modelcontextprotocol/go-sdk/mcp`
不选择 `v1.6.1` 或 pre-release本机 Go 是 `go1.23.4 windows/amd64``v1.6.1` 的 module `go.mod``go 1.25.0`,当前节点不升级工具链。`v1.3.1` 是稳定版本,`go list -m -json` 显示 `GoVersion: "1.23.0"`,与本机兼容。
## Required decision fields
- package/module name`github.com/modelcontextprotocol/go-sdk/mcp` / `github.com/modelcontextprotocol/go-sdk v1.3.1`
- stdio supportyes。`go doc` 显示 `mcp.StdioTransport` 通过 stdin/stdout newline-delimited JSON 通信。
- tool registration style`mcp.NewServer(...)` 创建 server后续 N8 使用 `mcp.AddTool[In, Out](server, tool, handler)` 注册 typed tool handlerN6 不写 server code不注册工具。
- JSON schema supportyes。`mcp.AddTool` 可从 Go struct/map type 自动推断 input/output JSON schema并支持 `jsonschema` struct tag。
- maintenance risk官方 SDK维护风险低于社区 SDK但 MCP/SDK API 仍在快速演进。通过固定 `v1.3.1` 避免 pre-release 和 Go 1.25 要求,后续升级必须单独审批。
- why enough for four tools第一阶段只需要 stdio MCP server、四个 read-only tool 定义、typed 参数 schema、handler 调用 `internal/helperclient`。官方 SDK 已覆盖这些点,不需要 HTTP server、Python/Node runtime、后台 daemon 或多 MCP 框架。
## Verification notes
- `go list -m -versions github.com/modelcontextprotocol/go-sdk` 可列出 `v1.3.1``v1.6.1``v1.7.0-pre.1` 等版本。
- `go get github.com/modelcontextprotocol/go-sdk@v1.3.1` 成功。
- `go list github.com/modelcontextprotocol/go-sdk/mcp` 成功。
- `go doc github.com/modelcontextprotocol/go-sdk/mcp.StdioTransport``go doc github.com/modelcontextprotocol/go-sdk/mcp.AddTool``go doc github.com/modelcontextprotocol/go-sdk/mcp.NewServer` 成功。
- `go list -m all` 只出现一个 MCP-related dependency`github.com/modelcontextprotocol/go-sdk v1.3.1`