go-mcp実験場

A Go-based MCP server example demonstrating correct usage of go.mod and build/run commands.

go-mcp実験場

MEMO

MCPの指定方法(main.go)

NG: go.modが見つからずに依存解決失敗でエラーになる

{
  "mcpServers": {
    "go-mcp-abc": {
      "command": "go",
      "args": ["run", "/path/to/go-mcp-abc/main.go"]
    }
  }
}

OK: go.modが見つかる方法

{
  "mcpServers": {
    "go-mcp-abc": {
      "command": "go",
      "args": ["-C", "/path/to/go-mcp-abc", "run", "main.go"]
    }
  }
}

OK: buildしてもいい

{
  "mcpServers": {
    "go-mcp-abc": {
      "command": "/path/to/go-mcp-abc/go-mcp-abc"
    }
  }
}

Stdioの場合、余計な出力があるとエラーになる

Unexpected token 'S', "Starting server..." is not valid JSON https://github.com/AgentDeskAI/browser-tools-mcp/issues/103#issuecomment-2824548286

fmt.Println("Starting server...") とかやるとエラーになる

Related Servers