Go代码风格验证服务

一个基于Uber Go风格指南的代码验证服务,用于检查Go代码是否符合规范。

  • by rolopez23
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 rolopez23/uber-style-go-mcp

使用说明

去风格指南MCP服务器

一个MCP服务器,用于验证Go代码是否符合 优步Go风格指南.用 MCP Go SDK.

先决条件

  • 转到1.23+
  • Node.js(用于MCP检查器)

构建

go mod tidy
go build -o go-style-guide

测试

运行所有测试:

go test ./...

对特定包运行测试:

go test ./tools/

按名称运行单个测试:

go test ./tools/ -run TestPing

运行具有详细输出的测试:

go test -v ./tools/

运行基准测试:

go test -bench=. ./...

跑

服务器通过stdio进行通信,并设计为由MCP客户端启动。

MCP检查员

这 MCP检查员 提供了一个用于交互式测试服务器的web UI。

npx @modelcontextprotocol/inspector ./go-style-guide

这将在以下位置打开浏览器 http://localhost:6274 您可以在哪里:

  • 连接到服务器
  • 列出可用工具
  • 使用自定义参数调用工具
  • 检查请求/响应有效载荷

连接到克劳德桌面

添加到您的Claude Desktop配置文件中:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "go-style-guide": {
      "command": "/absolute/path/to/go-mcp/go-style-guide"
    }
  }
}

替换 /absolute/path/to/go-mcp 以及构建二进制文件的实际路径。更新配置后重新启动Claude Desktop。

连接到克劳德代码

将服务器添加到您的Claude Code MCP设置中(~/.claude.json):

{
  "mcpServers": {
    "go-style-guide": {
      "command": "/absolute/path/to/go-mcp/go-style-guide"
    }
  }
}

或者通过CLI添加它:

claude mcp add go-style-guide /absolute/path/to/go-mcp/go-style-guide

手动测试

./go-style-guide

服务器启动并等待stdin上的MCP协议消息。按 Ctrl+C 停止。

发展

看 Claude.md 开发工作流的文件:

  • spec/ -功能规格
  • plan/ -实施计划
  • learnings/ -捕获的见解