Skip to main content

chp-adapter-mcp

The inbound MCP bridge for the Capability Host Protocol. Connects to an external Model Context Protocol server, discovers its tools, and registers each one as a governed CHP capability (chp.adapters.mcp.<server>.<tool>) with full execution evidence.

This complements the TypeScript outbound bridges (@auxo/chp-runtime-mcp), which expose CHP capabilities as MCP tools. Together they make CHP and MCP interoperate in both directions:

  • outbound (TS): CHP capability → MCP tool
  • inbound (this package): MCP tool → CHP capability

Install

pip install chp-adapter-mcp

Usage

from chp_core import LocalCapabilityHost, register_adapter
from chp_adapter_mcp import MCPAdapter, MCPServerConfig

host = LocalCapabilityHost()
adapter = MCPAdapter(MCPServerConfig(
    name="filesystem",
    command="npx",
    args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
))
register_adapter(host, adapter)

# Every tool the server exposes is now a CHP capability:
result = host.invoke("chp.adapters.mcp.filesystem.read_file", {"path": "/tmp/x"})

The MCP tool's own JSON Schema becomes the capability input_schema, so chp-core validates arguments before the tool runs and emits a full evidence chain (execution_started → mcp_tool_called → mcp_tool_result → execution_completed, or execution_failed).

Design notes

  • Each MCPAdapter owns one MCP server connection on a dedicated background thread + event loop (_ThreadedMCPSession), because the host runs handlers via asyncio.run (a fresh loop per call) and an MCP session is loop-bound.
  • The session is abstracted behind a small protocol so it can be faked in tests without spawning a subprocess.
  • MCPAdapter requires a server config, so register it manually with register_adapter(host, MCPAdapter(config)). It is also declared under the chp.adapters entry-point group for discovery/introspection.

Download files

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

Source Distribution

chp_adapter_mcp-0.20.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

chp_adapter_mcp-0.20.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file chp_adapter_mcp-0.20.0.tar.gz.

File metadata

  • Download URL: chp_adapter_mcp-0.20.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for chp_adapter_mcp-0.20.0.tar.gz
Algorithm Hash digest
SHA256 14b62a8791a236a6bd3a2ad23aca4b44be8f5ed250c133743fafd9ff3e12e446
MD5 92eae6c6172a12e1b038fad44bb9ff4d
BLAKE2b-256 efe3939afceeb6f7c6ec80e7f6210cf5bff5c86dbc9926c9a86080b6239adb0c

See more details on using hashes here.

File details

Details for the file chp_adapter_mcp-0.20.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chp_adapter_mcp-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82065d5092917e21ecd6c9b3e9b00ed9c29988aeb350971b9b1d1b60d7990372
MD5 eaad969170abeafca232ed0908898154
BLAKE2b-256 ee7705b3c7a770e65d2ff376fb585b005a5b0972f95b767c9cdd159bbad47a5f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

1 file

0.22.0

2 files

0.21.0

2 files

This release

0.20.0 This release

2 files

0.19.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

1 file

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