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 --version                # Print the installed ctxd version
ctxd login                    # Prompt for an API key and store it
ctxd status                   # Check whether an API key is configured
ctxd install-app              # Open the app installation page
ctxd search "text:deployment"
ctxd search text:test application:slack
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.12.tar.gz (9.6 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.12-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.12.tar.gz
Algorithm Hash digest
SHA256 d5fba0ed03c719d3c896bf6870a93009691a0f11334a2b38c4a9a0ad3f44f592
MD5 463833f85667b354a9fbae7630afe87b
BLAKE2b-256 20926126b261232f83ddb403479727646837e9b30c427b8b9bac63ce92d1618d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ctxd-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 6fa55acc5925a55c4a2440349ab1f9b65fc8ea8aa67780938e0ed5970d3e9626
MD5 39d7588ebdee9288a104332756a72fd6
BLAKE2b-256 089f889c1b6d6e8003db3e84c8cf9b735aa2c076216a73070a6c96acd555b5a2

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