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.3.0.tar.gz (17.5 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.3.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 17.5 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.3.0.tar.gz
Algorithm Hash digest
SHA256 cee287ed8ec71457820a5b1a00f914b4999ba61bcf2b723134ab8e4ab025ed74
MD5 8782323c8e3f8579e0053858eb7a5c14
BLAKE2b-256 57e528fcf68c41f1c904ac8cb37f0d562e3e5bad0f47368935b0b2a46baccc78

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_mcp-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: coreason_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aad8533ecaf1755ce0ec94c8bb8cbdee12a16f51baa408e5f396119649788226
MD5 c9ec4da7676f9d28bf2af6758a464cb4
BLAKE2b-256 6d8919cffdf0960a350b32b1a2f7d35c7f31660bb15894c3518b9bf494cd7921

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_mcp-0.3.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