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. For CLI automation, set CTXD_API_KEY
  3. The SDK sends that key as the bearer token directly to the MCP server
  4. ctxd login prompts for an API key interactively and stores it in plaintext in the ctxd config directory for future CLI and SDK usage
  5. ctxd status checks whether an API key is available from the active authentication source

CLI manual:

export CTXD_API_KEY=...       # Use env-based auth for this shell/session
ctxd login                    # Prompt for an API key and store it
ctxd status                   # Check whether an API key is configured
ctxd search "text:deployment"
ctxd fetch doc-123
ctxd profile
ctxd logout                   # Remove the stored API key

CTXD_API_KEY does not require ctxd login. Commands such as ctxd search, ctxd fetch, and ctxd profile use the environment variable directly when it is set.

Stored login credentials are written in plaintext to ~/.ctxd/credentials.json by default. Set CTXD_CREDENTIALS_PATH to override that location.

Base URL resolution order:

  1. base_url= passed to the client
  2. CTXD_BASE_URL
  3. ~/.ctxd/config.json
  4. https://mcp.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.11.tar.gz (9.0 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.11-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.11.tar.gz
Algorithm Hash digest
SHA256 4544000f15269fdf2a6b2bde5adaa33efd5e7c4f9ca36ae1bab169449a7a7556
MD5 d0aa5fd45e142d7afe1e25c285895a51
BLAKE2b-256 8ce0bddd1726a3af633cfe0de7c2e6ee13a090f3d835e7cc78da3b6eec38065d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9c9f5e3c1377bce813c252dafea803972a6c4972c9297ecdfe92081a780fb855
MD5 5b5d2902b56692093f71deca9f9b85ef
BLAKE2b-256 0d578775f6c2d51d883a2dd10c08522e86617c48519106d282a990ccfa838885

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