MCP Client Go
mcp client for Go (Golang). Integrate multiple Model Context Protocol (MCP) servers
What is MCP Client Go?
MCP Client Go is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp client for go (golang). integrate multiple model context protocol (mcp) servers
mcp client for Go (Golang). Integrate multiple Model Context Protocol (MCP) servers
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- mcp client for Go (Golang). Integrate multiple Model Context
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-client-goConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Client Go
mcp-client-go is a Go library that lets Golang applications connect to and orchestrate multiple MCP servers simultaneously, supporting stdio, SSE, and HTTP transports. It ships with pre-built configuration helpers for 50+ popular services including databases (Redis, PostgreSQL, MySQL), cloud platforms (AWS, Aliyun, Cloudflare), developer tools (GitHub, GitLab, Jira), and mapping or finance APIs. Developers use it to embed rich AI tool-use capabilities directly into Go services without managing raw MCP protocol details.
Prerequisites
- Go 1.21 or later installed
- npx, uvx, and/or docker installed and available on PATH (required for launching subprocess MCP servers)
- Service-specific API keys for the MCP servers you integrate (e.g. AMAP_MAPS_API_KEY for Amap maps)
- An MCP-compatible AI client or agent host (Claude Desktop, a custom Go agent, etc.)
Add the library to your Go module
Run go get to pull mcp-client-go into your project's module dependencies.
go get github.com/yincongcyincong/mcp-client-goChoose a transport and build a client config
Use one of the three initialiser helpers — InitStdioMCPClient for subprocess-based servers launched with npx/uvx, InitSSEMCPClient for SSE servers, or InitHttpMCPClient for plain HTTP MCP endpoints.
import "github.com/yincongcyincong/mcp-client-go/clients"
import "github.com/yincongcyincong/mcp-client-go/param"
// Stdio example — launches an npx MCP server as a subprocess
conf := clients.InitStdioMCPClient(
"amap-maps",
"npx",
[]string{"AMAP_MAPS_API_KEY=YOUR_KEY_HERE"},
[]string{"-y", "@amap/amap-maps-mcp-server"},
)
// SSE example
confSSE := clients.InitSSEMCPClient("my-sse-server", "http://127.0.0.1:8080")
// HTTP example
confHTTP := clients.InitHttpMCPClient("my-http-server", "http://127.0.0.1:8080")Register one or more MCP clients
Pass a slice of configs to RegisterMCPClient. The library starts all subprocesses and negotiates capabilities in the background.
ctx := context.Background()
clients.RegisterMCPClient(ctx, []*param.MCPClientConf{conf, confSSE})Retrieve a client and execute a tool
Fetch the registered client by name and call ExecTools with the tool name and a map of parameters.
client, err := clients.GetMCPClient("amap-maps")
if err != nil {
log.Fatal(err)
}
result, err := client.ExecTools(ctx, "maps_direction_driving", map[string]interface{}{
"origin": "116.481028,39.989643",
"destination": "116.434446,39.90816",
})Configure MCP clients via a Claude-style config file
Optionally load server definitions from a claude_desktop_config.json-compatible file so your app shares config with the Claude Desktop client.
// Load config from file
clients.LoadConfigFromFile("claude_desktop_config.json")MCP Client Go Examples
Go integration example
A minimal Go snippet that registers the GitHub MCP server and lists repositories for a user.
package main
import (
"context"
"fmt"
"github.com/yincongcyincong/mcp-client-go/clients"
"github.com/yincongcyincong/mcp-client-go/param"
)
func main() {
ctx := context.Background()
conf := clients.InitStdioMCPClient(
"github",
"npx",
[]string{"GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxx"},
[]string{"-y", "@modelcontextprotocol/server-github"},
)
clients.RegisterMCPClient(ctx, []*param.MCPClientConf{conf})
c, _ := clients.GetMCPClient("github")
res, _ := c.ExecTools(ctx, "list_repositories", map[string]interface{}{"username": "octocat"})
fmt.Println(res)
}Prompts to try
Once embedded in a Go-backed AI agent, these are typical natural-language requests the integrated tools can fulfil.
- "List all open pull requests in the myorg/myrepo GitHub repository"
- "Get driving directions from Tiananmen Square to the Beijing Capital Airport"
- "Fetch the latest price of BTC/USDT from Binance"
- "Query all users from the PostgreSQL database where role = 'admin'"Troubleshooting MCP Client Go
RegisterMCPClient returns an error that npx is not found
Ensure Node.js (which bundles npx) is installed and that the npx binary is on the PATH available to your Go process. On macOS you may need to set the full PATH in the env slice passed to InitStdioMCPClient.
ExecTools times out with no response
Stdio MCP servers can be slow to start on first invocation while npx downloads the package. Increase the client timeout or pre-warm the server by calling ExecTools with a lightweight tool (e.g. a list_tools equivalent) at startup.
API key errors from a service-specific MCP server
Pass the environment variable in the env slice of InitStdioMCPClient, e.g. []string{"AMAP_MAPS_API_KEY=yourkey"}. Environment variables set in the parent process are not automatically inherited by subprocess MCP servers in all cases.
Frequently Asked Questions about MCP Client Go
What is MCP Client Go?
MCP Client Go is a Model Context Protocol (MCP) server that mcp client for go (golang). integrate multiple model context protocol (mcp) servers It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP Client Go?
Follow the installation instructions on the MCP Client Go GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Client Go?
MCP Client Go works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Client Go free to use?
Yes, MCP Client Go is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
MCP Client Go Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP Client Go? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP Client Go in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP Client Go?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.