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

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_mcp-0.4.0.tar.gz
  • Upload date:
  • Size: 17.6 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.4.0.tar.gz
Algorithm Hash digest
SHA256 3a44ada10d3a7daf4c01610880ab9ffc731a03d3a9226f980d3b55b777c79011
MD5 3dc7d03fb999e950d2d3b4075a4d98aa
BLAKE2b-256 52e4892239961089d085d545d37048ab08aa68f0c052239c604917cf5d199612

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: coreason_mcp-0.4.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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 016f49aba54fb077c175d29be67afb5de157a155d2da843a5f16a0cbce0890d0
MD5 50229e32b10c0e2b1e850f23db4730e9
BLAKE2b-256 0ed5844f3d4fa9770f34317aa48abc5b409b6ac3d55c55e8d2474925deae8998

See more details on using hashes here.

Provenance

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