Skip to main content

MCP gateway client for CortexHub — simple and verified runtime sessions.

Project description

cortexhub

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

Documentation

Install

pip install cortexhub

Simple mode (declared end-user)

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

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:

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:

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.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cortexhub-2.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

cortexhub-2.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file cortexhub-2.0.0.tar.gz.

File metadata

  • Download URL: cortexhub-2.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cortexhub-2.0.0.tar.gz
Algorithm Hash digest
SHA256 13779fe5980eeab1a1a621c7f1d90730d4244197fd73a58b7822de0936a96447
MD5 9cdaf00844219557e689ee4903098051
BLAKE2b-256 430af627b3e358faa452c2f25cc356acebc22018b97a965f6ff2b9fc93918f90

See more details on using hashes here.

File details

Details for the file cortexhub-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cortexhub-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cortexhub-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c1929603920f0fdeb3761a8c9ce002637ca2461b1cf7b96fac51e774890cef5
MD5 b7cae1940338c996f6536a8c3c71651c
BLAKE2b-256 8d3350d1783b944cc7ef2774290f5fce3debf98764b17e42cfcb6d10fc8495e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page