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.6.1.tar.gz (18.7 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.6.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_mcp-0.6.1.tar.gz
  • Upload date:
  • Size: 18.7 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.6.1.tar.gz
Algorithm Hash digest
SHA256 6c4a3cb22f10322bb35c7aae492f21a58740e33632262c9d1437aea8f2ee9c9d
MD5 eff6ef9b3f8e99be035720e9d1cb03b3
BLAKE2b-256 f7d0164409c0c86380593b6fddbbffe95b01b3da9a4eb47f759af3637a5a2f84

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: coreason_mcp-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 24.9 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.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efd1311c4797011f14ef31b97cbaffb95dada91b98d84ab0f2feee08be61d277
MD5 602825d6e25932988da9b20c707d4753
BLAKE2b-256 acdfc11ba5657d52a2d996bcc107ad5bb535dd773a40f68de711c2260edd6b7b

See more details on using hashes here.

Provenance

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