- Explore MCP Servers
- langchaingo-mcp-adapters
Langchaingo Mcp Adapters
What is Langchaingo Mcp Adapters
langchaingo-mcp-adapters is a lightweight wrapper that enables compatibility between Model Context Protocol (MCP) tools and LangchainGo, facilitating their integration and usage.
Use cases
Use cases include building applications that require mathematical operations, weather data retrieval, or any other functionalities provided by MCP tools within a LangchainGo environment.
How to use
To use langchaingo-mcp-adapters, install it along with the MCP Go SDK and LangchainGo. Build an MCP server and use the MultiServerMCPClient to connect to it and utilize its tools within a LangchainGo agent.
Key features
Key features include the ability to convert MCP tools into LangchainGo tools, and a client implementation (MultiServerMCPClient) that allows connections to multiple MCP servers via stdio or SSE.
Where to use
langchaingo-mcp-adapters can be used in various fields that require integration of MCP tools with LangchainGo, such as data processing, machine learning, and application development.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Langchaingo Mcp Adapters
langchaingo-mcp-adapters is a lightweight wrapper that enables compatibility between Model Context Protocol (MCP) tools and LangchainGo, facilitating their integration and usage.
Use cases
Use cases include building applications that require mathematical operations, weather data retrieval, or any other functionalities provided by MCP tools within a LangchainGo environment.
How to use
To use langchaingo-mcp-adapters, install it along with the MCP Go SDK and LangchainGo. Build an MCP server and use the MultiServerMCPClient to connect to it and utilize its tools within a LangchainGo agent.
Key features
Key features include the ability to convert MCP tools into LangchainGo tools, and a client implementation (MultiServerMCPClient) that allows connections to multiple MCP servers via stdio or SSE.
Where to use
langchaingo-mcp-adapters can be used in various fields that require integration of MCP tools with LangchainGo, such as data processing, machine learning, and application development.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
LangchainGo MCP Adapters
This library provides a lightweight wrapper that makes Model Context Protocol (MCP) tools compatible with LangchainGo.
Features
- 🛠️ Convert MCP tools into LangchainGo tools that can be used with LangchainGo agents.
- 📦 A client implementation (
MultiServerMCPClient) that allows you to connect to multiple MCP servers (via stdio or SSE) and load tools from them.
References: The MCP adapters of Python implementation and TypeScript implementation.
Installation
go get github.com/akihiro-fukuchi/langchaingo-mcp-adapters
You will also need to install the underlying MCP Go SDK and LangchainGo:
go get github.com/mark3labs/mcp-go go get github.com/tmc/langchaingo
Quickstart
Here is a simple example of using MCP tools with a LangchainGo agent.
Server
First, let’s build an example MCP server that can add and multiply numbers.
Build the server: go build -o math-server examples/math-server/main.go
Client
Now, use the MultiServerMCPClient to connect to the server and use its tools with a LangchainGo agent.
Run the client: go run examples/agent/main.go
Note: OPENAI_API_KEY is required to run the agent. It is expect to be set as an environment variable.
Multiple MCP Servers
The MultiServerMCPClient is designed to handle connections to multiple servers simultaneously. Simply add more entries to the connections map during initialization, specifying either StdioConnection or SSEConnection for each server.
// Example with Math (stdio) and Weather (sse) servers
connections := map[string]mcpclient.ConnectionConfig{
"math": mcpclient.StdioConnection{
Transport: "stdio",
Command: "/path/to/your/go/math-server", // Absolute path
Args: []string{},
},
"weather": mcpclient.SSEConnection{
Transport: "sse",
URL: "http://localhost:8081/sse", // URL of your Go weather server SSE endpoint
},
}
client := mcpclient.NewMultiServerMCPClient(connections, mcp.Implementation{}, mcp.ClientCapabilities{})
// ... start client, get tools, run agent ...
The client.GetTools() method will return a combined list of tools from all successfully connected and initialized servers.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










