{"id":27152338,"url":"https://github.com/i2y/langchaingo-mcp-adapter","last_synced_at":"2026-04-27T20:32:11.230Z","repository":{"id":286784056,"uuid":"962085917","full_name":"i2y/langchaingo-mcp-adapter","owner":"i2y","description":"A Go adapter that bridges LangChain Go tools with Model Context Protocol (MCP) servers.","archived":false,"fork":false,"pushed_at":"2025-06-11T15:06:52.000Z","size":3180,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T16:24:42.831Z","etag":null,"topics":["agent","go","golang","langchaingo","mcp","mcp-tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i2y.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-07T16:16:03.000Z","updated_at":"2025-06-11T15:06:55.000Z","dependencies_parsed_at":"2025-04-08T11:22:10.844Z","dependency_job_id":"fa263e28-7376-4bee-b957-becb70b781f2","html_url":"https://github.com/i2y/langchaingo-mcp-adapter","commit_stats":null,"previous_names":["i2y/langchaingo-mcp-adapter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/i2y/langchaingo-mcp-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Flangchaingo-mcp-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Flangchaingo-mcp-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Flangchaingo-mcp-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Flangchaingo-mcp-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i2y","download_url":"https://codeload.github.com/i2y/langchaingo-mcp-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Flangchaingo-mcp-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32354566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","go","golang","langchaingo","mcp","mcp-tools"],"created_at":"2025-04-08T15:26:02.847Z","updated_at":"2026-04-27T20:32:11.224Z","avatar_url":"https://github.com/i2y.png","language":"Go","funding_links":[],"categories":["📚 Projects (1974 total)"],"sub_categories":["MCP Servers"],"readme":"# LangChainGo MCP Adapter\n\nA Go adapter that bridges LangChain Go tools with Model Context Protocol (MCP) servers.\n\n## Overview\n\nThis adapter allows you to use tools defined on an MCP server with the LangChain Go library. It implements the necessary interfaces to integrate MCP tools seamlessly with LangChain Go's agent infrastructure.\n\n## Features\n\n- Connect to any MCP server\n- Automatically discover MCP tools from a specified MCP server and make them available to LangChain Go\n- Wrap MCP tools as LangChain Go tools\n\n## Installation\n\n```bash\ngo get github.com/i2y/langchaingo-mcp-adapter\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"os\"\n\n    \"github.com/i2y/langchaingo-mcp-adapter\"\n    \"github.com/mark3labs/mcp-go/client\"\n    \"github.com/tmc/langchaingo/agents\"\n    \"github.com/tmc/langchaingo/chains\"\n    \"github.com/tmc/langchaingo/llms/googleai\"\n    \"github.com/tmc/langchaingo/tools\"\n)\n\nfunc main() {\n    // Create an MCP client using stdio\n    mcpClient, err := client.NewStdioMCPClient(\n        \"./an-mcp-server\",  // Path to an MCP server executable\n        nil,                // Additional environment variables if needed\n    )\n    if err != nil {\n        log.Fatalf(\"Failed to create MCP client: %v\", err)\n    }\n    defer mcpClient.Close()\n\n    // Create the adapter\n    adapter, err := langchaingo_mcp_adapter.New(mcpClient)\n    if err != nil {\n        log.Fatalf(\"Failed to create adapter: %v\", err)\n    }\n\n    // Get all tools from MCP server\n    mcpTools, err := adapter.Tools()\n    if err != nil {\n        log.Fatalf(\"Failed to get tools: %v\", err)\n    }\n\n    ctx := context.Background()\n\n    // Create a Google AI LLM client\n    llm, err := googleai.New(\n        ctx,\n        googleai.WithDefaultModel(\"gemini-2.0-flash\"),\n        googleai.WithAPIKey(os.Getenv(\"GOOGLE_API_KEY\")),\n    )\n    if err != nil {\n        log.Fatalf(\"Create Google AI client: %v\", err)\n    }\n\n    // Create a agent with the tools\n    agent := agents.NewOneShotAgent(\n        llm,\n        mcpTools,\n        agents.WithMaxIterations(3),\n    )\n    executor := agents.NewExecutor(agent)\n\n    // Use the agent\n    question := \"Can you help me analyze this data using the available tools?\"\n    result, err := chains.Run(\n        ctx,\n        executor,\n        question,\n    )\n    if err != nil {\n        log.Fatalf(\"Agent execution error: %v\", err)\n    }\n\n    log.Printf(\"Agent result: %s\", result)\n}\n```\n\n## Example Applications\n\nSee the `example` directory for complete examples:\n\n- `example/agent`: Demonstrates how to use the adapter with various LLM providers (Google AI, OpenAI, Anthropic)\n- `example/server`: A minimal MCP server example that provides a URL fetching tool\n\nThe example agent supports multiple LLM providers:\n- **Google AI (Gemini)**: Set `GOOGLE_API_KEY`\n- **OpenAI**: Set `OPENAI_API_KEY`\n- **Anthropic (Claude)**: Set `ANTHROPIC_API_KEY`\n\nThe example is cross-platform and works on Windows, macOS, and Linux. The example automatically builds and runs the MCP server from source. See the [example README](./example/agent/README.md) for detailed setup instructions.\n\nThe mcp-curl server in this sample is based on the code from [this blog](https://k33g.hashnode.dev/creating-an-mcp-server-in-go-and-serving-it-with-docker).\n\n## Requirements\n\n- Go 1.23 or higher\n- [tmc/langchaingo](https://github.com/tmc/langchaingo)\n- [mark3labs/mcp-go](https://github.com/mark3labs/mcp-go)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi2y%2Flangchaingo-mcp-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi2y%2Flangchaingo-mcp-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi2y%2Flangchaingo-mcp-adapter/lists"}