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.

Metadata

Release files for chp-adapter-mcp 0.55.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chp-adapter-mcp 0.55.0
File Size Uploaded
chp_adapter_mcp-0.55.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chp-adapter-mcp 0.55.0
File Interpreter ABI Platform
chp_adapter_mcp-0.55.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / chp_adapter_mcp-0.55.0.tar.gz

Download URL chp_adapter_mcp-0.55.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3d4060bc68ad88867b27d8218d0e559be30d559f7ee8c510ca2949135488d6a0
BLAKE2b-256 checksum
How to use checksums
e42a735beb6a595c5673fe2c663d32e17484ce4fe22305a563e51a818c7353ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / chp_adapter_mcp-0.55.0-py3-none-any.whl

Download URL chp_adapter_mcp-0.55.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917d8cd2f2bdc8afac354dd20904eda051e6861a5e867ca01a92cfea6a7338d5
BLAKE2b-256 checksum
How to use checksums
b9d0f8cd36e5203612a65b5589b85ff3fbe582eb47a461882c6ef1efc2ffa57b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.55.0 This release

2 release files

0.28.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.23.0

1 release file

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

1 release 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