LangChainGo MCP Adapter

v1.0.0Developer Toolsstable

A Go adapter that bridges LangChain Go tools with Model Context Protocol (MCP) servers.

agentgogolanglangchaingomcp
Share:
49
Stars
0
Downloads
0
Weekly
0/5

What is LangChainGo MCP Adapter?

LangChainGo MCP Adapter is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to go adapter that bridges langchain go tools with model context protocol (mcp) servers.

A Go adapter that bridges LangChain Go tools with 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

  • A Go adapter that bridges LangChain Go tools with Model Cont

Use Cases

Bridge LangChain Go tools with MCP servers
Enable Go-based agentic applications to use MCP tools
i2y

Maintainer

LicenseMIT
Languagego
Versionv1.0.0
UpdatedMay 5, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langchaingo-mcp-adapter

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use LangChainGo MCP Adapter

The LangChainGo MCP Adapter is a Go library that bridges the LangChain Go agent framework with any MCP-compatible tool server, letting Go developers build AI agents that automatically discover and call tools exposed over the Model Context Protocol. Instead of writing custom API wrappers, you point the adapter at one or more MCP servers and it converts their tool schemas into LangChain Go-compatible tool objects that any supported LLM (Google Gemini, OpenAI, Anthropic Claude) can invoke. This is the idiomatic Go path for adding MCP tool support to agentic workflows without leaving the LangChain Go ecosystem.

Prerequisites

  • Go 1.23 or higher installed
  • A running MCP server to connect to (e.g., a filesystem or search server)
  • An LLM provider API key: GOOGLE_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY
  • The tmc/langchaingo and mark3labs/mcp-go Go modules
1

Add the adapter to your Go module

Run go get to download the langchaingo-mcp-adapter package and add it to your go.mod.

go get github.com/i2y/langchaingo-mcp-adapter
2

Set your LLM provider API key

Export the environment variable for whichever LLM provider you want your agent to use. The adapter itself is provider-agnostic; the key is consumed by the LangChain Go LLM client.

# Pick one:
export GOOGLE_API_KEY=your-google-api-key
export OPENAI_API_KEY=your-openai-api-key
export ANTHROPIC_API_KEY=your-anthropic-api-key
3

Create an MCP client and initialise the adapter

In your Go code, create an mcp-go client pointing at your MCP server, then pass it to the adapter to get a slice of LangChain Go tools.

import (
    mcpadapter "github.com/i2y/langchaingo-mcp-adapter"
    "github.com/mark3labs/mcp-go/client"
)

mcpClient, _ := client.NewStdioClient("path/to/mcp-server", []string{})
tools, _ := mcpadapter.NewTools(ctx, mcpClient)
4

Wire the tools into a LangChain Go agent

Pass the discovered tools directly to your LangChain Go agent executor alongside your LLM of choice.

import (
    "github.com/tmc/langchaingo/agents"
    "github.com/tmc/langchaingo/llms/googleai"
)

llm, _ := googleai.New(ctx, googleai.WithDefaultModel("gemini-pro"))
executor, _ := agents.Initialize(llm, tools, agents.ZeroShotReactDescription)
result, _ := chains.Run(ctx, executor, "What files are in the current directory?")
5

Run your agent

Build and run your Go program. The adapter will start the MCP server process, discover its tools, and the agent will call them as needed to answer queries.

go run main.go

LangChainGo MCP Adapter Examples

Client configuration

The adapter is a Go library, not a standalone server. Configure it in code by pointing it at an MCP server binary. This example uses the filesystem MCP server.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "env": {}
    }
  }
}

Prompts to try

After wiring the adapter into a LangChain Go agent, these natural language queries route through MCP tool calls.

- "List all Go source files in the project directory"
- "Search the web for the latest LangChain Go release notes"
- "Read the contents of README.md and summarize the architecture"
- "What tools does this MCP server expose?"

Troubleshooting LangChainGo MCP Adapter

Tool discovery returns zero tools

Confirm the MCP server binary starts successfully on its own and prints valid JSON-RPC responses. Run the server directly in a terminal and check for startup errors before connecting the adapter.

API key environment variable not picked up by the LLM client

The adapter does not read API keys itself — they must be set in the environment before you call googleai.New / openai.New. Export the variable in the same shell session where you run 'go run'.

go get fails with 'no required module provides package'

Ensure your go.mod specifies 'go 1.23' or higher and run 'go mod tidy' after adding the dependency to resolve the full dependency graph.

Frequently Asked Questions about LangChainGo MCP Adapter

What is LangChainGo MCP Adapter?

LangChainGo MCP Adapter is a Model Context Protocol (MCP) server that go adapter that bridges langchain go tools with model context protocol (mcp) servers. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install LangChainGo MCP Adapter?

Follow the installation instructions on the LangChainGo MCP Adapter GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with LangChainGo MCP Adapter?

LangChainGo MCP Adapter works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is LangChainGo MCP Adapter free to use?

Yes, LangChainGo MCP Adapter is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

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.

Quick Config Preview

{ "mcpServers": { "langchaingo-mcp-adapter": { "command": "npx", "args": ["-y", "langchaingo-mcp-adapter"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use LangChainGo MCP Adapter?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides