refactor: 迁移到官方 MCP SDK (#167)

- 添加官方 SDK 依赖 github.com/modelcontextprotocol/go-sdk v0.7.0
- 新增 mcp_server.go 使用官方 SDK 注册 8 个 MCP 工具
- 删除自实现的 streamable_http.go(约 400 行)
- 更新 routes.go 使用 mcp.NewStreamableHTTPHandler
- 优化服务器优雅关闭逻辑(5秒超时 + 警告日志)
- 清理 types.go 中的 JSON-RPC 相关类型

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
zy
2025-09-27 01:44:02 +08:00
committed by GitHub
parent 529ee71144
commit 53ea832773
8 changed files with 270 additions and 459 deletions

View File

@@ -12,9 +12,11 @@ func main() {
var (
headless bool
binPath string // 浏览器二进制文件路径
port string
)
flag.BoolVar(&headless, "headless", true, "是否无头模式")
flag.StringVar(&binPath, "bin", "", "浏览器二进制文件路径")
flag.StringVar(&port, "port", ":18060", "端口")
flag.Parse()
if len(binPath) == 0 {
@@ -29,7 +31,7 @@ func main() {
// 创建并启动应用服务器
appServer := NewAppServer(xiaohongshuService)
if err := appServer.Start(":18060"); err != nil {
if err := appServer.Start(port); err != nil {
logrus.Fatalf("failed to run server: %v", err)
}
}