🔗 LangChain MCP Registry
Seamlessly integrate MCP Registry servers into your LangChain workflows
🌟 Features
- 🔍 Automatic Discovery: Search and discover MCP servers from the official registry
- 🔄 Seamless Integration: Convert registry servers to LangChain-compatible tools
- 🚀 Zero Configuration: Works out of the box with sensible defaults
- 🛡️ Type Safe: Full type hints and Pydantic models
- 🎯 CLI & Python API: Use via command line or programmatically
- 📦 Multiple Transports: Support for stdio, HTTP, SSE
🚀 Quick Start
Installation
pip install langchain-mcp-registry
Python API
from langchain_mcp_registry import MCPRegistryClient
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
# 1. Discover servers from registry
async with MCPRegistryClient() as client:
servers = await client.search_servers(query="weather")
# 2. Auto-convert to LangChain tools
tools = await client.load_tools(servers[0])
# 3. Use in LangChain agent
llm = ChatOpenAI(model="gpt-4")
agent = create_react_agent(llm, tools)
result = await agent.ainvoke({
"messages": [{"role": "user", "content": "What's the weather in SF?"}]
})
CLI Usage
# Search for servers
mcp-registry search weather
# List server details
mcp-registry info @modelcontextprotocol/server-brave-search
# Install and test a server
mcp-registry install @modelcontextprotocol/server-brave-search
mcp-registry test brave-search "search for AI news"
📚 Documentation
Registry Client
from langchain_mcp_registry import MCPRegistryClient
client = MCPRegistryClient(
registry_url="https://registry.modelcontextprotocol.io",
timeout=30.0,
cache_ttl=3600
)
# Search with filters
servers = await client.search_servers(
query="github",
limit=10,
version="latest"
)
# Get server details
server_details = await client.get_server_details(
name="@modelcontextprotocol/server-github",
version="latest"
)
Configuration Converter
from langchain_mcp_registry import RegistryToMCPConverter
converter = RegistryToMCPConverter()
# Convert registry server to MCP config
mcp_config = converter.convert(registry_server)
# Output: {"command": "npx", "args": [...], "env": {...}}
# Validate configuration
is_valid = converter.validate_config(mcp_config)
Tool Loader
from langchain_mcp_registry import MCPToolLoader
loader = MCPToolLoader()
# Load tools from registry server
tools = await loader.load_from_registry(
server_name="@modelcontextprotocol/server-everything",
version="latest"
)
# Load multiple servers
all_tools = await loader.load_multiple([
"server-brave-search",
"server-github",
"server-filesystem"
])
🏗️ Architecture
┌─────────────────────────────────────────────────────────┐
│ LangChain Agent │
└────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ LangChain MCP Registry │
│ ┌──────────────┐ ┌────────────┐ ┌─────────────┐ │
│ │ Registry │ │ Converter │ │ Tool │ │
│ │ Client │─▶│ (R → M) │─▶│ Loader │ │
│ └──────────────┘ └────────────┘ └─────────────┘ │
└────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ MCP Registry (modelcontextprotocol.io) │
└─────────────────────────────────────────────────────────┘
🔧 Advanced Usage
Custom Registry
client = MCPRegistryClient(
registry_url="https://your-private-registry.com",
headers={"Authorization": "Bearer YOUR_TOKEN"}
)
Error Handling
from langchain_mcp_registry.exceptions import (
ServerNotFoundError,
InvalidConfigError,
RegistryConnectionError
)
try:
tools = await client.load_tools("non-existent-server")
except ServerNotFoundError:
print("Server not found in registry")
except InvalidConfigError as e:
print(f"Invalid configuration: {e}")
Caching
# Enable local caching for faster repeated access
client = MCPRegistryClient(
cache_enabled=True,
cache_ttl=7200, # 2 hours
cache_dir="~/.mcp-registry-cache"
)
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
🔗 Links
- PyPI: https://pypi.org/project/langchain-mcp-registry/
- GitHub: https://github.com/ChangjunZhao/langchain-mcp-registry
- Issues: https://github.com/ChangjunZhao/langchain-mcp-registry/issues
Made with ❤️ for the LangChain and MCP communities
Metadata
Release files for langchain-mcp-registry 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_mcp_registry-0.1.4.tar.gz | 41.5 kB | Without provenance | Details for langchain_mcp_registry-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_mcp_registry-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for langchain_mcp_registry-0.1.4-py3-none-any.whl |
Total release size: 62.2 kB
Release files / langchain_mcp_registry-0.1.4.tar.gz
| Download URL | langchain_mcp_registry-0.1.4.tar.gz |
|---|---|
| Size | 41.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87227d4443535cbd3762cf88bb567de26a12bcd8b4908eb47f8d2007d9e51ac5
|
|
BLAKE2b-256 checksum How to use checksums |
4108ae6377f8d5233cb8771ca5bb2d293b9dfc67d19307b1806623d1e4b839df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / langchain_mcp_registry-0.1.4-py3-none-any.whl
| Download URL | langchain_mcp_registry-0.1.4-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1c8c43cf1cd0d293c976ecbf3aed7a40442307bbb76ba844649e11bf3ece4a7
|
|
BLAKE2b-256 checksum How to use checksums |
c3d63a94ed7d6f9b1a52934212d2d7e30edd8483f7eb294106219551d5c952bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for langchain-mcp-registry 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.