Unified Python CLI for code, docs, and otel context tooling
Project description
ossctx
ossctx is a unified Python toolkit for building local context services around source code, documentation, and telemetry.
It brings three related systems under one CLI and one package:
ossCtx codefor source indexing, dependency analysis, call-graph queries, API serving, and MCP accessossCtx docsfor document indexing, website crawling, search, analysis, API serving, and MCP accessossCtx otelfor trace/log/metric ingestion, observability APIs, OTLP compatibility, and MCP access
The goal is to provide a consistent local operator workflow for indexing information, exposing it through HTTP and MCP, and integrating it into editor and agent tooling.
Project structure
The package is organized into four top-level Python packages:
commoncontains shared CLI, config, database, middleware, and server helperscodectximplements code indexing and graph queriesdocsctximplements document ingestion, crawling, analysis, and retrievalotelctximplements telemetry ingestion, storage, search, and service graph features
Features
Code context
- Index local source trees into SQLite
- Extract entities, dependencies, and relations
- Query entities, file dependencies, and call graphs
- Run an HTTP API server for indexed code data
- Run or configure an MCP server for editor and agent integrations
- Install compatibility alias:
codecontext
Document context
- Index local text, markdown, and HTML content
- Crawl documentation sites from a root URL
- Chunk and persist document content
- Run deterministic or provider-backed finalize analysis
- Search indexed content and inspect communities/entities through HTTP APIs
- Run or configure an MCP server for document search workflows
- Install compatibility alias:
docscontext
Telemetry context
- Ingest traces, logs, and metrics from JSON payloads
- Support OTLP HTTP JSON compatibility routes
- Support OTLP gRPC ingestion when dependencies are available
- Query traces, logs, metrics, services, archive, DLQ, TSDB, and health data via HTTP APIs
- Expose websocket and optional Prometheus integrations
- Run or configure an MCP server for observability workflows
- Install compatibility alias:
otelcontext
Requirements
- Python
>=3.11 - Windows, macOS, or Linux with a working Python environment
Installation
Install from the repo root using uv:
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
Install with development extras:
uv pip install -e ".[dev]"
Install with optional parser and loader support:
uv pip install -e ".[dev,tree-sitter,loaders]"
Running
You can use uv run to execute the CLI commands without explicitly activating the virtual environment:
# Run the main CLI
uv run ossCtx --help
# Serve the UI
uv run ossCtx ui serve
# Run specific contexts
uv run ossCtx code --help
uv run ossCtx docs --help
uv run ossCtx otel --help
Optional extras:
devadds pytest, ruff, mypy, and pip-audittree-sitteradds higher-fidelity parsers for supported languagesloadersadds PDF and Word document ingestion support
Installed commands
Primary entrypoint:
ossCtx
Compatibility aliases:
codecontextdocscontextotelcontext
Version command:
ossCtx --version
Quickstart
Index code
ossCtx code index . --db .codecontext.db
ossCtx code stats --db .codecontext.db
ossCtx code query entity hello --db .codecontext.db
Index documents
ossCtx docs index ./docs --db .docscontext.db --finalize
ossCtx docs stats --db .docscontext.db
ossCtx docs serve --db .docscontext.db --port 8090
Crawl a documentation website
ossCtx docs index --url https://example.com/docs --db .docscontext.db --max-pages 100 --max-depth 2 --finalize
Ingest telemetry
ossCtx otel ingest traces.json --db .otelcontext.db
ossCtx otel stats --db .otelcontext.db
ossCtx otel serve --db .otelcontext.db --http-port 8088 --grpc-port 4317
Default storage and ports
Default SQLite files:
- Code:
.codecontext.db - Docs:
.docscontext.db - Otel:
.otelcontext.db
Default API ports:
- Code:
8080 - Docs:
8090 - Otel HTTP:
8088 - Otel gRPC:
4317
Default Otel archive directory:
.otel_archive
Command reference
Root CLI
ossCtx --version
ossCtx code ...
ossCtx docs ...
ossCtx otel ...
Code commands
ossCtx code index
Index a directory into the code database.
ossCtx code index <path> [--db PATH] [--max-file-size MB]
Important options:
--dboverrides the SQLite path--max-file-sizeskips very large files during indexing
ossCtx code query
Query indexed code data.
ossCtx code query entity <name> [--db PATH]
ossCtx code query deps <file-path> [--db PATH]
ossCtx code query calls <entity-name> [--db PATH]
Query types:
entityfinds matching entities by namedepsprints file dependency informationcallsprints outgoing and incoming call edges
ossCtx code stats
Show code index statistics.
ossCtx code stats [--db PATH]
ossCtx code clean
Delete the code database and SQLite sidecar files.
ossCtx code clean [--db PATH]
ossCtx code serve
Run the code HTTP API server.
ossCtx code serve [--host HOST] [--port PORT] [--db PATH]
ossCtx code mcp
Run the CodeCtx MCP server.
ossCtx code mcp [--transport stdio|sse|streamable-http] [--addr HOST:PORT] [--db PATH]
Examples:
ossCtx code mcp --transport stdio --db .codecontext.db
ossCtx code mcp --transport streamable-http --addr 127.0.0.1:8081 --db .codecontext.db
ossCtx code mcp --transport sse --addr 127.0.0.1:8081 --db .codecontext.db
ossCtx code setup
Write or update a VS Code MCP config entry for CodeCtx.
ossCtx code setup [--binary BIN] [--transport TYPE] [--addr HOST:PORT] [--db PATH] [--output PATH] [--server-name NAME]
Example:
ossCtx code setup --output .vscode/mcp.json --db .codecontext.db
Docs commands
ossCtx docs index
Index local files or crawl a documentation site.
ossCtx docs index <path> [--db PATH] [--chunk-size N] [--chunk-overlap N] [--finalize]
ossCtx docs index --url URL [--db PATH] [--max-pages N] [--max-depth N] [--allow-external] [--same-path-prefix|--no-same-path-prefix] [--timeout SECONDS] [--finalize]
Important options:
--urlcrawls from a root site instead of indexing a local path--chunk-sizeand--chunk-overlaptune chunking behavior--max-pagesand--max-depthcontrol crawl size--allow-externalallows following links outside the root host--same-path-prefixrestricts crawling to the original path prefix--finalizeruns structure/entity/community analysis after ingest
ossCtx docs stats
Show document index statistics.
ossCtx docs stats [--db PATH] [--json]
ossCtx docs serve
Run the DocsCtx HTTP API server.
ossCtx docs serve [--host HOST] [--port PORT] [--db PATH]
ossCtx docs mcp
Run the DocsCtx MCP server.
ossCtx docs mcp [--transport stdio|sse|streamable-http] [--db PATH]
ossCtx docs setup
Write or update a VS Code MCP config for DocsCtx.
ossCtx docs setup [--output PATH] [--transport TYPE]
Otel commands
ossCtx otel ingest
Ingest a JSON payload file containing traces, logs, metrics, or OTLP-compatible payloads.
ossCtx otel ingest <path> [--db PATH]
ossCtx otel stats
Show telemetry statistics.
ossCtx otel stats [--db PATH]
ossCtx otel serve
Run the OtelCtx HTTP API server and optional OTLP gRPC receiver.
ossCtx otel serve [--host HOST] [--http-port PORT] [--grpc-port PORT] [--db PATH]
Notes:
- HTTP API defaults to port
8088 - OTLP gRPC defaults to port
4317 - If gRPC dependencies are unavailable, the HTTP server can still run
ossCtx otel mcp
Run the OtelCtx MCP server.
ossCtx otel mcp [--transport stdio|sse|streamable-http] [--addr HOST:PORT] [--db PATH]
ossCtx otel setup
Write or update a VS Code MCP config entry for OtelCtx.
ossCtx otel setup [--binary BIN] [--transport TYPE] [--addr HOST:PORT] [--db PATH] [--output PATH] [--server-name NAME]
MCP workflows
Each subsystem can run as an MCP server or generate a VS Code MCP config file.
Common patterns:
ossCtx code mcp --transport stdio
ossCtx docs mcp --transport stdio
ossCtx otel mcp --transport stdio
Generate .vscode/mcp.json entries:
ossCtx code setup --output .vscode/mcp.json
ossCtx docs setup --output .vscode/mcp.json
ossCtx otel setup --output .vscode/mcp.json
Transport modes:
stdiofor local process-based MCP integrationssefor HTTP SSE transport where supportedstreamable-httpfor HTTP MCP endpoints where supported
Supported content and formats
Code parsing
The parser registry supports a broad set of source and config formats, including:
- Python
- Go
- JavaScript and TypeScript
- Java
- Rust
- C#
- Ruby
- SQL
- Kotlin
- Scala
- Bash
- Lua
- Perl
- R
- HTML
- CSS
- Markdown
- JSON
- XML
- YAML
- TOML
- HCL
- Properties
- Dockerfile
Installing the tree-sitter extra improves fidelity for supported languages.
Document formats
Built-in local document loading supports:
.txt.text.md.markdown.html.htm
Optional loader extras add:
- PDF via
pymupdf - Word documents via
python-docx
API overview
Code API
Run it with:
ossCtx code serve --db .codecontext.db
It exposes shared health/version endpoints plus codectx routes for stats, file/entity lookup, dependency graphs, and call-graph access.
Docs API
Run it with:
ossCtx docs serve --db .docscontext.db
It exposes shared health/version endpoints plus document listing, retrieval, versions, upload, search, finalize, upload progress, communities, entities, and graph neighborhood routes.
Otel API
Run it with:
ossCtx otel serve --db .otelcontext.db
It exposes shared health/version endpoints plus traces, logs, metrics, services, dashboard, archive, DLQ, sampler, graph, ingest, OTLP compatibility, and websocket routes.
Configuration
The package uses environment-driven settings via Pydantic settings models.
Useful environment variables include:
CodeCtx
CODECTX_DB_PATHCODECTX_HOSTCODECTX_PORTCODECTX_MAX_FILE_SIZE_MB
DocsCtx
DOCSCTX_DB_PATHDOCSCTX_HOSTDOCSCTX_PORTDOCSCTX_CHUNK_SIZEDOCSCTX_CHUNK_OVERLAPDOCSCTX_MAX_PAGESDOCSCTX_MAX_DEPTHDOCSCTX_LLM_PROVIDERDOCSCTX_LLM_MODELDOCSCTX_LLM_BASE_URLDOCSCTX_LLM_API_KEYDOCSCTX_LLM_TIMEOUT_SECONDSDOCSCTX_LLM_MAX_RETRIESDOCSCTX_LLM_RETRY_BACKOFF_SECONDSDOCSCTX_LLM_FALLBACK_ON_ERRORDOCSCTX_EMBED_MODELDOCSCTX_EMBED_BASE_URLDOCSCTX_EMBED_API_KEYDOCSCTX_EMBED_BATCH_SIZE
OtelCtx
OTELCTX_DB_PATHOTELCTX_HOSTOTELCTX_PORTOTELCTX_GRPC_PORTOTELCTX_ARCHIVE_DIROTELCTX_HOT_DAYSOTELCTX_TSDB_CAPACITYOTELCTX_SAMPLING_RATEOTELCTX_SAMPLING_ALWAYS_ERRORSOTELCTX_SAMPLING_LATENCY_THRESHOLD_MSOTELCTX_DLQ_MAX_RETRIESOTELCTX_DLQ_REPLAY_INTERVAL_SECONDSOTELCTX_WS_BUFFER_SIZEOTELCTX_WS_FLUSH_INTERVAL_MSOTELCTX_PROMETHEUS_ENABLED
Development
Run tests:
python -m pytest -q
Verified test command in the current environment:
d:/Development/omni-agents/.venv/Scripts/python.exe -m pytest -q
Useful development tasks:
python -m pip install -e .[dev,tree-sitter,loaders]
python -m pytest -q
ruff check .
mypy .
Publishing notes
The package metadata declares:
- project name:
ossctx - version:
0.1.0 - license: MIT
- console scripts:
ossCtx,codecontext,docscontext,otelcontext
License
This project is licensed under the MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ossctx-0.1.0b2.tar.gz.
File metadata
- Download URL: ossctx-0.1.0b2.tar.gz
- Upload date:
- Size: 254.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5788e0dea3b269337f800b128ca8c02bee750cbfa227d59fe840767bdda6691
|
|
| MD5 |
49089443d8dad9858cda3f35b2f1906b
|
|
| BLAKE2b-256 |
c1b93f4d2987d75d943645b658d5b064f8353beb28f6bd82518c92a8ed2cbbe0
|
Provenance
The following attestation bundles were made for ossctx-0.1.0b2.tar.gz:
Publisher:
publish.yml on RandomCodeSpace/ossctx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ossctx-0.1.0b2.tar.gz -
Subject digest:
c5788e0dea3b269337f800b128ca8c02bee750cbfa227d59fe840767bdda6691 - Sigstore transparency entry: 1124456854
- Sigstore integration time:
-
Permalink:
RandomCodeSpace/ossctx@66634da822c5dea50b844d4f2510398ec10aa6f4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RandomCodeSpace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@66634da822c5dea50b844d4f2510398ec10aa6f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ossctx-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: ossctx-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 137.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe644a519937fb8a3424c213be43ff8869eba3cc4e6bcd1363319585b0a7378b
|
|
| MD5 |
a03cab52282e98bfc22dfef0d60206cc
|
|
| BLAKE2b-256 |
a7ac4d817ced2c96c1468beade881b870a24d54267e1ba3858f292d7cd904512
|
Provenance
The following attestation bundles were made for ossctx-0.1.0b2-py3-none-any.whl:
Publisher:
publish.yml on RandomCodeSpace/ossctx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ossctx-0.1.0b2-py3-none-any.whl -
Subject digest:
fe644a519937fb8a3424c213be43ff8869eba3cc4e6bcd1363319585b0a7378b - Sigstore transparency entry: 1124456897
- Sigstore integration time:
-
Permalink:
RandomCodeSpace/ossctx@66634da822c5dea50b844d4f2510398ec10aa6f4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RandomCodeSpace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@66634da822c5dea50b844d4f2510398ec10aa6f4 -
Trigger Event:
push
-
Statement type: