Metadata-Version: 2.4
Name: cortexhub
Version: 2.0.0
Summary: MCP gateway client for CortexHub — simple and verified runtime sessions.
Project-URL: Homepage, https://cortexhub.ai
Project-URL: Documentation, https://docs.cortexhub.ai
Project-URL: Examples, https://github.com/CortexHub-AI/examples/
Author-email: CortexHub <hello@cortexhub.ai>
License: MIT
License-File: LICENSE
Keywords: agents,ai,cxh_gateway,governance,mcp
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# cortexhub

Official Python SDK for the CortexHub MCP gateway and runtime-session control plane.

[Documentation](https://docs.cortexhub.ai)

## Install

```bash
pip install cortexhub
```

## Simple mode (declared end-user)

For personal MCP clients or server agents that do not need verified end-user identity:

```python
from cortexhub import Cortexhub

cx = Cortexhub()  # reads CORTEXHUB_API_KEY
session = cx.session(user_id="user_123")

print(session.mcp.url)      # https://mcp.cortexhub.ai/v1/mcp
print(session.mcp.headers)  # X-API-Key + X-CortexHub-End-User-Subject
```

Hand `session.mcp.url` and `session.mcp.headers` to Claude Agent SDK, OpenAI Agents, LangGraph, or any MCP client.

## Verified mode (runtime sessions)

When policies require verified end-user attribution:

```python
from cortexhub import Cortexhub, CortexhubPlatform

# 1. Your trusted backend (tenant API key) binds the end user once.
platform = CortexhubPlatform()  # CORTEXHUB_PLATFORM_API_KEY
ctx = platform.create_context(
    agent_id="cxh_agent_…",
    end_user_subject="user_123",
)

# 2. Your agent runtime mints a short-lived bearer.
agent = Cortexhub()  # agent API key
runtime = agent.open_runtime(ctx.id)

print(runtime.mcp.headers)  # Authorization: Bearer cxh_rs_…
```

Resume after reconnect:

```python
runtime = agent.resume_runtime(runtime.session_id)
```

## Configuration

| Variable | Purpose |
|---|---|
| `CORTEXHUB_API_KEY` | Agent API key for `Cortexhub()` |
| `CORTEXHUB_PLATFORM_API_KEY` | Tenant or org key for `CortexhubPlatform()` |

Gateway URL is fixed at `https://mcp.cortexhub.ai/v1/mcp`. Control plane is `https://api.cortexhub.ai`.

## License

MIT.
