去风格指南MCP服务器
先决条件
- 转到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/-捕获的见解
