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, agent, and member 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.

Org MCP API key (recommended for backends)

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

Mint the key from 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
)
# 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 - Org 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

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.1.0.tar.gz (7.7 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.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cortexhub-2.1.0.tar.gz
Algorithm Hash digest
SHA256 0c41b42457c5dee8065244eb177ce430c8a7b32ccde9019da53e5f3c5aee6f68
MD5 88eaf9bcc3a4c619e3819b36f3d7fa29
BLAKE2b-256 cf53eff28ba80a6f40e79c94b1ec5ab07a960ab4fbf3fe036b0ddbf1aa92c2ae

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for cortexhub-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 117ae7e2b7e65b9ed2e75d2a66cd510557d4258415638b62d68339ae22d56f94
MD5 aea812ea636b09d5788870c0cde66879
BLAKE2b-256 2eff603736d86509fef96affcd4cf6d096060eea299f68a53499cf1a9d585d59

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