Skip to main content

Standardizes external data access using the Model Context Protocol.

Project description

coreason-mcp

The Complete Gateway for the Model Context Protocol (MCP).

coreason-mcp serves as the Universal Interface Layer for the CoReason ecosystem. It replaces ad-hoc API wrappers with a standardized Model Context Protocol (MCP) Gateway, acting as an MCP Host that connects to both remote services (via SSE) and local sidecars (via Stdio).

Organization License Build Status Code Style: ruff Documentation

Installation

pip install coreason-mcp

Features

  • Hybrid Transport: Support for both SSE (remote microservices) and Stdio (local sidecars) transports.
  • Tool Aggregation: Merges tools from multiple servers into a unified namespace with automatic conflict resolution.
  • Secure Credential Injection: Manages API keys and headers securely in the transport layer, keeping them out of the agent's context.
  • Async/High Concurrency: Built on httpx and asyncio to ensure non-blocking operations across the mesh.
  • Robust Error Handling: Maps connection and protocol errors to standardized exceptions.

For detailed requirements and architecture, see Product Requirements.

Usage

Here is how to initialize and use the library to connect to a local filesystem tool and a remote database.

import asyncio
from coreason_mcp.config import McpServerConfig, TransportType
from coreason_mcp.manager import McpManager

# 1. Configure your servers (Mesh Topology)
# A local sidecar (Stdio) - e.g., for secure filesystem access
local_fs = McpServerConfig(
    name="local_fs",
    transport=TransportType.STDIO,
    command="npx",
    args=["-y", "@modelcontextprotocol/server-filesystem", "/home/user/docs"]
)

# A remote microservice (SSE) - e.g., for clinical data
clinical_db = McpServerConfig(
    name="clinical_db",
    transport=TransportType.SSE,
    url="http://db-service.internal:8080/sse",
    auth_headers={"Authorization": "Bearer s3cr3t-t0k3n"}
)

# 2. Initialize the manager
manager = McpManager([local_fs, clinical_db])

async def main():
    # 3. Connect to all servers
    await manager.connect_all()

    try:
        # 4. List aggregated tools (converted to OpenAI format)
        tools = await manager.get_openai_tools()
        print(f"Available tools: {[t['function']['name'] for t in tools]}")

        # 5. Call a tool
        # The manager handles routing and error mapping
        result = await manager.call_tool(
            tool_name="clinical_db_get_patient",
            arguments={"patient_id": "PT-12345"}
        )
        print("Result:", result.content[0].text)

    finally:
        # 6. Cleanup connections
        await manager.close()

if __name__ == "__main__":
    asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreason_mcp-0.5.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreason_mcp-0.5.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file coreason_mcp-0.5.0.tar.gz.

File metadata

  • Download URL: coreason_mcp-0.5.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coreason_mcp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 52cb6fac647a1357e06301f93ec0a61e9bc8fa0a5040a5313b8f936c25480afc
MD5 838c374c73b7c27c70db8e7398e63f11
BLAKE2b-256 45be8686965b3882f21cf6810edc5ba219e6ea8f8b4dc6e292b8a28ff0fdf781

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_mcp-0.5.0.tar.gz:

Publisher: publish.yml on CoReason-AI/coreason-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coreason_mcp-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: coreason_mcp-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coreason_mcp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c4152b706485ac04a22921a8139bd1966121a9ae5200332ead2cdfe330b115a
MD5 020c9d423ae499e8297dce1dbcac030a
BLAKE2b-256 cce9fbb4f58958a8037bd89bbc6ab0f6ba63fea4e275d22a5d7a3c0e6470b25b

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_mcp-0.5.0-py3-none-any.whl:

Publisher: publish.yml on CoReason-AI/coreason-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page