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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ctxd-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 a8dc1372674890340d430cbf53d61b83deb63d8957af114d12d3af8f04ea4d5b
MD5 f6d884989db0fbd9c7a4f8de8b20e51d
BLAKE2b-256 62aa4abf75e544a66ce4cb755c9ed6efdc5b35a158acc42c34a62c3d22b9e456

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48c20f95f73fc10836d133950a3f40f775bb1a5d38de35aab18e97ce17f36e1e
MD5 fe554965e1d3b29b2d83ddfaed136960
BLAKE2b-256 728b9f6e48e72074baf5c36f1c7bfdb59819ace0e570c8b25d8840efac833a27

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