langchaingo -adapter
A Go adapter that bridges LangChain Go tools with Model Context Protocol (MCP) servers.
claude mcp add --transport stdio i2y-langchaingo-mcp-adapter docker run -i langchaingo-mcp-server:latest \ --env ADAPTER_LOG_LEVEL="info|debug|warn|error" \ --env MCP_SERVER_ADDRESS="the MCP server address if not using default" \ --env MCP_TOOL_DISCOVERY_PATH="optional path for tool discovery"
How to use
This MCP adapter is a Go-based bridge that lets you expose MCP server tools to the LangChain Go ecosystem. It discovers tools offered by a running MCP server and wraps them as LangChain Go tools, allowing you to build agents that can invoke those tools directly from your Go code. The adapter integrates with LangChain Go’s agent infrastructure, so you can fetch the available tools, construct an agent with those tools, and execute complex queries through a single pipeline. Typical usage involves starting an MCP server, launching the adapter to connect to that server, and then using the resulting toolset with a LangChain Go agent to perform tasks like data analysis, HTTP fetching, or other MCP-enabled operations.
How to install
Prerequisites:
- Go 1.20+ (as per project recommendations)
- GOPATH configured or using Go modules
- Access to the internet to fetch dependencies
Installation steps:
-
Install the Go module for the adapter: go get github.com/i2y/langchaingo-mcp-adapter
-
Build and run your own usage example (adjust paths as needed): go env -w GOPROXY=https://proxy.golang.org,direct go get github.com/i2y/langchaingo-mcp-adapter
-
Start an MCP server (external to this repository) or use a provided example server. Ensure the server is reachable by the adapter (see mcp_config for environment details).
-
Run your Go application that imports the adapter and connects to the MCP server via stdio or a suitable transport as configured in your environment.
Additional notes
Tips and notes:
- The adapter discovers tools from the connected MCP server and exposes them to LangChain Go as native tools. Ensure the MCP server is started and accessible before launching your Go application.
- Configure MCP discovery and server addressing via environment variables (MCP_SERVER_ADDRESS, MCP_TOOL_DISCOVERY_PATH).
- Logging level can be adjusted with ADAPTER_LOG_LEVEL to help diagnose issues during development (e.g., debug for verbose output).
- If your MCP server uses stdio for communication, you may need to provide the correct path and permissions for the server executable and ensure it can be invoked from the environment running the Go adapter.
- This documentation assumes a separate MCP server binary or image; the adapter itself does not ship a full MCP server. See the example server in the repository for reference on how MCP servers can be structured.
Related MCP Servers
context-space
Ultimate Context Engineering Infrastructure, starting from MCPs and Integrations
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
github-brain
An experimental GitHub MCP server with local database.
tasker
An MCP server for Android's Tasker automation app.
rod
Model Context Protocol Server of Rod
mcp
Teamwork.com MCP server