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. Run ctxd login with the CLI to store OAuth credentials in a secure local store
  2. The CLI starts a device-style login session through the backend auth API
  3. The browser flow continues on https://app.ctxd.dev/cli-login, so login can finish on a different machine than the terminal session
  4. The backend dynamically registers the CLI session with the MCP authorization server and completes the OAuth callback server-side
  5. The SDK keeps only non-secret metadata in ~/.ctxd/config.json
  6. The SDK reads the stored access token and refreshes it automatically when needed
  7. Tokens are loaded from the OS keychain when available, otherwise from an encrypted local credential store unlocked with a passphrase entered interactively or provided through CTXD_PASSPHRASE

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()

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

Async example:

from ctxd import AsyncClient

async with AsyncClient() 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.2.tar.gz (12.1 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.2-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86dd30d101938c970d58408bf1e3c2d9b80f564ad04a2abbe0993d12db68f8ce
MD5 f928448753defe6d184f33ba32380cec
BLAKE2b-256 4b4bbbfd72db38b063ef46146cb60ac317ba7b067b44939c47db365349d86ab0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1bb5fa9983f29c4dc9a01965157b7f8519f3977824fa63ed98a79d2686c61411
MD5 1ec0ba214410607ade6d8f9404c0b4e7
BLAKE2b-256 cd24f489cf3baa5184c165e9a877044b2c7c8d1fa3cae6b28ba85ae79604c449

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