Skip to main content

Public Python SDK and CLI for the ctxd platform.

Project description

ctxd

Public Python SDK and CLI for the ctxd platform.

Install:

pip install ctxd

The SDK exposes sync and async clients:

  • Client
  • AsyncClient

Authentication:

  1. Preferred for headless and scripts: create a user-bound API key through the authenticated application backend
  2. Provide it with Client(api_key=...) or CTXD_API_KEY
  3. The SDK sends that key as the bearer token directly to the MCP server
  4. ctxd login is still supported for interactive local OAuth login
  5. If CTXD_API_KEY is set and you run ctxd login, the CLI first validates the key with get_profile(). If valid, it skips OAuth and reports that you are already authenticated. If invalid, it warns and asks whether to continue with interactive login.

Base URL resolution order:

  1. base_url= passed to the client
  2. CTXD_BASE_URL
  3. ~/.ctxd/config.json
  4. https://mcp.ctxd.dev

Auth API URL resolution order:

  1. CTXD_AUTH_API_URL
  2. https://api.ctxd.dev

Example:

from ctxd import Client

client = Client(api_key="297e24c4-4ee9-4739-828f-48f57f48ce11")

results = client.search("text:deployment application:slack")
profile = client.get_profile()
document = client.fetch_document("doc-123")

API key example:

from ctxd import Client

client = Client(api_key="297e24c4-4ee9-4739-828f-48f57f48ce11")
results = client.search("text:deployment application:slack")

Async example:

from ctxd import AsyncClient

async with AsyncClient(api_key="297e24c4-4ee9-4739-828f-48f57f48ce11") as client:
    results = await client.search("text:deployment")

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

ctxd-0.1.6.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

ctxd-0.1.6-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file ctxd-0.1.6.tar.gz.

File metadata

  • Download URL: ctxd-0.1.6.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.26

File hashes

Hashes for ctxd-0.1.6.tar.gz
Algorithm Hash digest
SHA256 9123805c526a5f905f10eff70d87ce8caee5e1cd119bdc3a6aa082d8b31daa17
MD5 5920a4d9f653cb9d4ec281fe4d3975aa
BLAKE2b-256 10a7c2b53aebb3f7c220bdd1152078e90cb4e448fb5c94083b6ca921818b231d

See more details on using hashes here.

File details

Details for the file ctxd-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: ctxd-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.26

File hashes

Hashes for ctxd-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b019db5b9d91e0117219fb01015e52887c58f75a2ddb01a61fceecd9938849
MD5 cf76d736121f39a6d1cec9fad0bae603
BLAKE2b-256 f4a27a660e0476f1bdab85cb3a720432ec6f15fa8092d44f00acd652a3dd9393

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