langchain-mcp-registry


Namelangchain-mcp-registry JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummarySeamlessly integrate MCP Registry servers into your LangChain workflows
upload_time2025-10-23 07:18:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords agents ai langchain mcp model-context-protocol registry tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # πŸ”— LangChain MCP Registry

> Seamlessly integrate MCP Registry servers into your LangChain workflows

[![PyPI version](https://badge.fury.io/py/langchain-mcp-registry.svg)](https://badge.fury.io/py/langchain-mcp-registry)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)

## 🌟 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

```bash
pip install langchain-mcp-registry
```

### Python API

```python
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

```bash
# 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

```python
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

```python
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

```python
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

```python
client = MCPRegistryClient(
    registry_url="https://your-private-registry.com",
    headers={"Authorization": "Bearer YOUR_TOKEN"}
)
```

### Error Handling

```python
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

```python
# 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](CONTRIBUTING.md) for details.

## πŸ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## πŸ™ Acknowledgments

- [Model Context Protocol](https://modelcontextprotocol.io/)
- [LangChain](https://www.langchain.com/)
- [Anthropic](https://www.anthropic.com/)

## πŸ”— 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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "langchain-mcp-registry",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "agents, ai, langchain, mcp, model-context-protocol, registry, tools",
    "author": null,
    "author_email": "Foresee Sira AI Team <dev@foresee.ai>",
    "download_url": "https://files.pythonhosted.org/packages/04/34/5dc5af0c371c8d15c09ff99b50929b9b06713658a12e458f7c532b2ede69/langchain_mcp_registry-0.1.2.tar.gz",
    "platform": null,
    "description": "# \ud83d\udd17 LangChain MCP Registry\n\n> Seamlessly integrate MCP Registry servers into your LangChain workflows\n\n[![PyPI version](https://badge.fury.io/py/langchain-mcp-registry.svg)](https://badge.fury.io/py/langchain-mcp-registry)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n\n## \ud83c\udf1f Features\n\n- \ud83d\udd0d **Automatic Discovery**: Search and discover MCP servers from the official registry\n- \ud83d\udd04 **Seamless Integration**: Convert registry servers to LangChain-compatible tools\n- \ud83d\ude80 **Zero Configuration**: Works out of the box with sensible defaults\n- \ud83d\udee1\ufe0f **Type Safe**: Full type hints and Pydantic models\n- \ud83c\udfaf **CLI & Python API**: Use via command line or programmatically\n- \ud83d\udce6 **Multiple Transports**: Support for stdio, HTTP, SSE\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install langchain-mcp-registry\n```\n\n### Python API\n\n```python\nfrom langchain_mcp_registry import MCPRegistryClient\nfrom langchain_openai import ChatOpenAI\nfrom langgraph.prebuilt import create_react_agent\n\n# 1. Discover servers from registry\nasync with MCPRegistryClient() as client:\n    servers = await client.search_servers(query=\"weather\")\n\n    # 2. Auto-convert to LangChain tools\n    tools = await client.load_tools(servers[0])\n\n    # 3. Use in LangChain agent\n    llm = ChatOpenAI(model=\"gpt-4\")\n    agent = create_react_agent(llm, tools)\n\n    result = await agent.ainvoke({\n        \"messages\": [{\"role\": \"user\", \"content\": \"What's the weather in SF?\"}]\n    })\n```\n\n### CLI Usage\n\n```bash\n# Search for servers\nmcp-registry search weather\n\n# List server details\nmcp-registry info @modelcontextprotocol/server-brave-search\n\n# Install and test a server\nmcp-registry install @modelcontextprotocol/server-brave-search\nmcp-registry test brave-search \"search for AI news\"\n```\n\n## \ud83d\udcda Documentation\n\n### Registry Client\n\n```python\nfrom langchain_mcp_registry import MCPRegistryClient\n\nclient = MCPRegistryClient(\n    registry_url=\"https://registry.modelcontextprotocol.io\",\n    timeout=30.0,\n    cache_ttl=3600\n)\n\n# Search with filters\nservers = await client.search_servers(\n    query=\"github\",\n    limit=10,\n    version=\"latest\"\n)\n\n# Get server details\nserver_details = await client.get_server_details(\n    name=\"@modelcontextprotocol/server-github\",\n    version=\"latest\"\n)\n```\n\n### Configuration Converter\n\n```python\nfrom langchain_mcp_registry import RegistryToMCPConverter\n\nconverter = RegistryToMCPConverter()\n\n# Convert registry server to MCP config\nmcp_config = converter.convert(registry_server)\n# Output: {\"command\": \"npx\", \"args\": [...], \"env\": {...}}\n\n# Validate configuration\nis_valid = converter.validate_config(mcp_config)\n```\n\n### Tool Loader\n\n```python\nfrom langchain_mcp_registry import MCPToolLoader\n\nloader = MCPToolLoader()\n\n# Load tools from registry server\ntools = await loader.load_from_registry(\n    server_name=\"@modelcontextprotocol/server-everything\",\n    version=\"latest\"\n)\n\n# Load multiple servers\nall_tools = await loader.load_multiple([\n    \"server-brave-search\",\n    \"server-github\",\n    \"server-filesystem\"\n])\n```\n\n## \ud83c\udfd7\ufe0f Architecture\n\n```\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                    LangChain Agent                      \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                     \u2502\n                     \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502              LangChain MCP Registry                     \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510    \u2502\n\u2502  \u2502   Registry   \u2502  \u2502 Converter  \u2502  \u2502    Tool     \u2502    \u2502\n\u2502  \u2502   Client     \u2502\u2500\u25b6\u2502  (R \u2192 M)   \u2502\u2500\u25b6\u2502   Loader    \u2502    \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518    \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                     \u2502\n                     \u25bc\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502          MCP Registry (modelcontextprotocol.io)         \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n## \ud83d\udd27 Advanced Usage\n\n### Custom Registry\n\n```python\nclient = MCPRegistryClient(\n    registry_url=\"https://your-private-registry.com\",\n    headers={\"Authorization\": \"Bearer YOUR_TOKEN\"}\n)\n```\n\n### Error Handling\n\n```python\nfrom langchain_mcp_registry.exceptions import (\n    ServerNotFoundError,\n    InvalidConfigError,\n    RegistryConnectionError\n)\n\ntry:\n    tools = await client.load_tools(\"non-existent-server\")\nexcept ServerNotFoundError:\n    print(\"Server not found in registry\")\nexcept InvalidConfigError as e:\n    print(f\"Invalid configuration: {e}\")\n```\n\n### Caching\n\n```python\n# Enable local caching for faster repeated access\nclient = MCPRegistryClient(\n    cache_enabled=True,\n    cache_ttl=7200,  # 2 hours\n    cache_dir=\"~/.mcp-registry-cache\"\n)\n```\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- [Model Context Protocol](https://modelcontextprotocol.io/)\n- [LangChain](https://www.langchain.com/)\n- [Anthropic](https://www.anthropic.com/)\n\n## \ud83d\udd17 Links\n\n- **PyPI**: https://pypi.org/project/langchain-mcp-registry/\n- **GitHub**: https://github.com/ChangjunZhao/langchain-mcp-registry\n- **Issues**: https://github.com/ChangjunZhao/langchain-mcp-registry/issues\n\n---\n\nMade with \u2764\ufe0f for the LangChain and MCP communities\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Seamlessly integrate MCP Registry servers into your LangChain workflows",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/ChangjunZhao/langchain-mcp-registry",
        "Issues": "https://github.com/ChangjunZhao/langchain-mcp-registry/issues",
        "Repository": "https://github.com/ChangjunZhao/langchain-mcp-registry"
    },
    "split_keywords": [
        "agents",
        " ai",
        " langchain",
        " mcp",
        " model-context-protocol",
        " registry",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "269de71082cd9d03243e309298e451f4f806ed00e1b870bc7d419cd7cb15a5ae",
                "md5": "20f15c0302a8c61a580d7e47bdf22504",
                "sha256": "2b56bb097775e737f4067994f37a9add237f3515f085ae167cf2180836016809"
            },
            "downloads": -1,
            "filename": "langchain_mcp_registry-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20f15c0302a8c61a580d7e47bdf22504",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 20361,
            "upload_time": "2025-10-23T07:18:37",
            "upload_time_iso_8601": "2025-10-23T07:18:37.181708Z",
            "url": "https://files.pythonhosted.org/packages/26/9d/e71082cd9d03243e309298e451f4f806ed00e1b870bc7d419cd7cb15a5ae/langchain_mcp_registry-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "04345dc5af0c371c8d15c09ff99b50929b9b06713658a12e458f7c532b2ede69",
                "md5": "da3d8b21ebaccd17cea459f4e3bac781",
                "sha256": "37a5c0c249f2266410c013475837c113ca5f3c6ce36b48093fb58d2eb792cb9f"
            },
            "downloads": -1,
            "filename": "langchain_mcp_registry-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "da3d8b21ebaccd17cea459f4e3bac781",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 41128,
            "upload_time": "2025-10-23T07:18:38",
            "upload_time_iso_8601": "2025-10-23T07:18:38.906318Z",
            "url": "https://files.pythonhosted.org/packages/04/34/5dc5af0c371c8d15c09ff99b50929b9b06713658a12e458f7c532b2ede69/langchain_mcp_registry-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-23 07:18:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ChangjunZhao",
    "github_project": "langchain-mcp-registry",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "langchain-mcp-registry"
}
        
Elapsed time: 2.48037s