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
MCPAdapterowns one MCP server connection on a dedicated background thread + event loop (_ThreadedMCPSession), because the host runs handlers viaasyncio.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.
MCPAdapterrequires a server config, so register it manually withregister_adapter(host, MCPAdapter(config)). It is also declared under thechp.adaptersentry-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)
| File | Size | Uploaded | |
|---|---|---|---|
| chp_adapter_mcp-0.55.0.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|