Skip to main content

HTTP retry middleware that auto-uses DC Hub's inline trial keys (X-Trial-Key header)

Project description

dchub-mcp-helper

Drop-in HTTP retry middleware for AI agents talking to DC Hub's data center intelligence API at https://dchub.cloud.

DC Hub's REST + MCP gates auto-mint working trial keys on every gated request and deliver them via standard HTTP headers (X-Trial-Key). This package handles the retry-with-key dance so your code never has to care about 402 responses.

Install

pip install dchub-mcp-helper

Use

import httpx
from dchub_mcp_helper import DCHubTrialAuth

client = httpx.Client(auth=DCHubTrialAuth())
resp = client.get("https://dchub.cloud/api/v1/transactions/export.csv")
# → first call returns 402 with X-Trial-Key header
# → auth handler reads it, retries with X-API-Key
# → second call returns 200 with the CSV
# → all later calls in this session use the same key (no 402)

Optional: persist the trial key across processes (CLI tools):

auth = DCHubTrialAuth(cache_path="~/.dchub-trial-key", verbose=True)

What you DON'T need

  • No browser flow
  • No email verification
  • No OAuth dance
  • No card on file
  • No webhook callback

Trial keys are 200 calls/day, 30-day expiry. Make permanent by POSTing to /api/v1/keys/auto-trial/redeem with {api_key, email}.

What DC Hub offers

  • 21,000+ data center facilities (178 countries)
  • DCPI scores for 285 markets (BUILD / CAUTION / AVOID verdicts)
  • Real-time grid intelligence across 7+ ISOs
  • M&A transactions database
  • Capacity pipeline (550+ active projects)
  • Tax incentives by state
  • Fiber carrier coverage
  • 28+ MCP tools

Full integration manifest: https://dchub.cloud/.well-known/ai-agents.json

Tier matrix

Tier Calls/day Price How to upgrade
Anonymous 25/24h $0 n/a
FREE 100 $0 POST /api/v1/keys/claim
IDENTIFIED 200 $0 claim + add ?email=
Auto-trial 200 $0 (30d) auto-minted on first 402
Starter 500 $9/mo https://buy.stripe.com/8x2dRa5sS0x75uteGuaZi0g
Developer 2,000 $49/mo linked in 402 response
Pro 10,000 $199/mo linked in 402 response

License

MIT. © DC Hub.

Source

https://github.com/azmartone67/dchub-backend/tree/main/docs/mcp-helper-pkg

Publish path (for maintainers)

cd docs/mcp-helper-pkg
python3 -m build              # creates dist/*.whl and dist/*.tar.gz
python3 -m twine upload dist/*  # publishes to PyPI

Requires pip install build twine and a PyPI account with the dchub-mcp-helper namespace.

Project details


Download files

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

Source Distribution

dchub_mcp_helper-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

dchub_mcp_helper-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dchub_mcp_helper-0.1.0.tar.gz.

File metadata

  • Download URL: dchub_mcp_helper-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for dchub_mcp_helper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ccd1abe1de65bfc56b6ee89b3948eae4d78bd61c9d20b2bd0eb2d3409471791
MD5 2d094d9948430b0a851ef5514becd400
BLAKE2b-256 ff62f8a39f31ca625c481aa4ca0ec173c8e57276ddcdefccf254cc1aac465807

See more details on using hashes here.

File details

Details for the file dchub_mcp_helper-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dchub_mcp_helper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 931d7fd5a42048bcfe2a69158b934fe222bedabaf737440c475b6ea8ac6ee815
MD5 adf549e065baa142371e0aa712dbb425
BLAKE2b-256 3d60a2fa5d71d334d79a7ffba349dd166fdd0255ad2eab3988ed85ec9b2ef89e

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