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.1.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.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ctxd-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c4528077dfea9d354e22df0ce5bc7049842941c473f8d215998fdb3656faa4e2
MD5 633d4dcce155f94763b45e18c139e664
BLAKE2b-256 a248d47d97a393b17afff8f3ef00e14894f7c35d0539f5452e159ef6eb63a03b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ctxd-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 873f077b2f7b4bf86a0d37b45e8f858a7afd38b30e7ff0411a68936162b9605e
MD5 33e388c46dc7df09eb083471659e0f19
BLAKE2b-256 070f4baa3465f68c375c6df78e7cb34cb2f1d6771048ce6f1e9d27e3a85d4cb0

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