Skip to the content.

Python SDK

Package pch-sdk. Public import: from pch_sdk import Client.

The client is a thin HTTP wrapper around pairing, MCP tools, and MCP resources. It is not an agent runtime.

Install (workspace)

uv sync

From a published wheel, depend on pch-sdk (same version as the Hub, currently 0.2.0).

Client

from pch_sdk import Client

c = Client("http://127.0.0.1:8765", token="")
result = c.pair("<pairing-code>")   # stores result["token"]
print(c.search("Atlas", purpose="status_update"))
print(c.call("get_context_contract", purpose="continue planning the trip"))
print(c.resource("hub://connection/self"))
Method Behavior
Client(base, token) httpx.Client timeout 30s
pair(code) POST /v1/connections/pair; assigns self.token
call(tool, **kwargs) POST /v1/mcp/tools/{tool}
search(query, purpose, project=None) search_personal_context
resource(uri) GET /v1/mcp/resources?uri=

Headers: Authorization: Bearer {token}.

raise_for_status() is used; handle httpx.HTTPStatusError for 401 (revoked) and 4xx validation.

Plugin authoring

from pch_sdk.plugin_runtime import hub, PermissionDenied

See Plugins. Kit CLI: pch-sdk plugin new|validate|pack|dev.

Capture guidance (for adapters)

pch_sdk.capture_guidance exports the strings baked into recipes:

Demo agent

uv run pch-sdk demo-agent --pair <code> --base http://127.0.0.1:8765

Pairs, then calls search_personal_context with query Atlas and purpose demo. It is a smoke client, not a product assistant.

MCP bridge

PCH_TOKEN=PCH_BASE=http://127.0.0.1:8765 uv run pch-sdk mcp-bridge

Implementation: pch_sdk.mcp_bridge. Tool names and JSON Schema: MCP tools.