Skip to main content

MCP gateway client for CortexHub programmatic agent access.

Project description

cortexhub

Official Python client for the CortexHub MCP gateway.

This package builds the URL and headers your MCP transport needs to call https://mcp.cortexhub.ai/v1/mcp. It does not call the CortexHub Platform API; for organisation and workspace management, see the Platform API reference.

Documentation

Install

pip install cortexhub

Two ways to authenticate

The SDK supports both gateway authentication paths through one entry point. Pick the one that matches how your application identifies users.

Workspace MCP API key (recommended for backends)

Use this when your application has its own users who do not have CortexHub accounts. The workspace key authenticates the gateway; the end-user identity is attested per call.

Mint the key from Workspace settings → MCP API keys in the CortexHub dashboard, or programmatically via the Platform API.

from cortexhub import Cortexhub

cx = Cortexhub(api_key="cxh_mcpk_<id>_<secret>")
session = cx.session(
    agent="invoice-bot",
    end_user_subject="user_42",          # required for end-user accountability policies
    end_user_display_hint="Alice",       # optional, render-only, never persisted
    invocation_mode="autonomous",        # default; pass "interactive" if a human is present
)
# session.mcp.url and session.mcp.headers → pass to your MCP transport

MCP OAuth client

Use this when your application signs in CortexHub users interactively. Create the OAuth client from Account settings → MCP OAuth clients and copy the client_id and client_secret.

from cortexhub import Cortexhub

cx = Cortexhub(client_id="...", client_secret="...")
session = cx.session(
    agent="helpdesk-bot",
    mcp_session_id="chat-42",                    # optional: groups activity per session
    conversation_title="Engineering standup",    # optional: context shown in audit
    last_user_message="Create a standup page",   # optional: context shown in audit
)

Environment variables

Variable Default Purpose
CORTEXHUB_URL https://mcp.cortexhub.ai MCP gateway base URL
CORTEXHUB_API_KEY Workspace MCP API key (cxh_mcpk_*)
CORTEXHUB_CLIENT_ID MCP OAuth client id
CORTEXHUB_CLIENT_SECRET MCP OAuth client secret

If both CORTEXHUB_API_KEY and OAuth credentials are configured, the API key wins.

What the SDK returns

In both modes, session.mcp.url and session.mcp.headers are ready to wire into the MCP transport of your choice (the official MCP Python SDK, a custom HTTP client, anything that accepts URL + headers).

License

MIT.

Project details


Release history Release notifications | RSS feed

This version

2.0.5

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.5.tar.gz (9.2 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.5-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cortexhub-2.0.5.tar.gz
  • Upload date:
  • Size: 9.2 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.5.tar.gz
Algorithm Hash digest
SHA256 358cd5faf623341a7c09f86953e501344af4c738a6e801d094c8bcf26b8940aa
MD5 d3e4790ea248ef70b539b6375dbfa66b
BLAKE2b-256 580ef9b7164e5684f8dd4f420a299643fe8dc2adfdb054bf194661e85a73da33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cortexhub-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4f82c3d75a74c1992a05a028ea3a06bfcedcbbf12a813cc74fcbc7eecd324072
MD5 9f8ac2c1b527026b2d481fb1dffc2d72
BLAKE2b-256 c2ea65496fd97052f7abc48d9a1ab40499a5066643d9a6a1ccfbb3be2485bb7e

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