Skip to main content

Open-MCP

PyPI version Conda Version Python Support Documentation Status License: MIT

An open-source Python package for Model Context Protocol (MCP) - enabling seamless integration between language models and external tools, data sources, and services.

🚀 Features

  • 🔧 Tool Integration: Execute external tools and functions from language models
  • 📊 Resource Access: Access and manage external data sources and files
  • 💬 Prompt Management: Dynamic prompt templates with parameter substitution
  • 🌐 Client & Server: Full MCP client and server implementations
  • ⚡ Async Support: Built with modern async/await patterns
  • 🔒 Type Safe: Full type hints and Pydantic validation
  • 🧪 Well Tested: Comprehensive test suite with high coverage
  • 📚 Documented: Complete API documentation and examples

📦 Installation

Via pip (PyPI)

pip install open-mcp
uv add open-mcp

Via conda

conda install -c conda-forge open-mcp

Development Installation

git clone https://github.com/2796gaurav/open-mcp.git
cd open-mcp
uv sync --all-extras --dev

🏃 Quick Start

MCP Client

import asyncio
from open_mcp import MCPClient

async def main():
    async with MCPClient("http://localhost:8000") as client:
        # List available tools
        tools = await client.list_tools()
        print(f"Available tools: {[tool.name for tool in tools]}")
        
        # Execute a tool
        result = await client.call_tool("calculator", {
            "operation": "add",
            "a": 5,
            "b": 3
        })
        print(f"Result: {result.content}")
        
        # Access resources
        resources = await client.list_resources()
        content = await client.get_resource("file://data.json")
        
        # Use prompts
        prompt_content = await client.get_prompt("summarize", {
            "text": "Long text to summarize...",
            "max_words": 100
        })

asyncio.run(main())

MCP Server

from open_mcp import MCPServer
from open_mcp.models import Tool, ToolResult

# Create server instance
server = MCPServer("My MCP Server")

# Register a tool
@server.tool("calculator", "Perform basic calculations")
async def calculator(operation: str, a: float, b: float) -> ToolResult:
    operations = {
        "add": a + b,
        "subtract": a - b, 
        "multiply": a * b,
        "divide": a / b if b != 0 else "Error: Division by zero"
    }
    
    result = operations.get(operation, "Unknown operation")
    return ToolResult(content=result)

# Register a resource
@server.resource("file://config.json", "Application configuration")
async def get_config():
    return {"setting1": "value1", "setting2": "value2"}

# Start server
if __name__ == "__main__":
    import uvicorn
    uvicorn.run(server.app, host="0.0.0.0", port=8000)

Metadata

Release files for open-mcp-protocol 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-mcp-protocol 0.0.1
File Size Uploaded Provenance
open_mcp_protocol-0.0.1.tar.gz 14.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for open-mcp-protocol 0.0.1
File Interpreter ABI Platform
open_mcp_protocol-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.9 kB

Release files / open_mcp_protocol-0.0.1.tar.gz

Download URL open_mcp_protocol-0.0.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a6d3a8894298315571694a9c85aef18d7539e148fcabc5c725aa699446e96720
BLAKE2b-256 checksum
How to use checksums
196e0bb3e10071ca4398cb4c8c1372dfb7a3cb04fe1b06273f44d9b9a8787d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / open_mcp_protocol-0.0.1-py3-none-any.whl

Download URL open_mcp_protocol-0.0.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c06b4d11321f571f49bd6da9b78042d1cb583cae0e274541d16cca259579fd2
BLAKE2b-256 checksum
How to use checksums
0b232302621f9bb32cb08d1ff65574e9fd4932350e5d7c48804a73dc1f09383e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for open-mcp-protocol 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page