Skip to main content

AI-native codebase context engine. Scans projects and serves intelligent context packs to Claude Code, Cursor, Windsurf, and any MCP-compatible tool.

Project description

Contexta

AI-native codebase context engine. Serves intelligent project context to Claude Code, Cursor, Windsurf, and any MCP-compatible tool — or generates curated context packs for manual use.

Python License: MIT Platform Version MCP


     

Install via pip, download the portable executable, or run from source.


Contexta interface preview

What is Contexta

Contexta analyzes codebases and serves intelligent, curated context to AI tools. Instead of dumping files blindly, it understands project structure, detects frameworks, ranks files by importance, and delivers exactly what an AI needs.

Three ways to use it:

Mode Command What it does
MCP Server contexta serve Runs as a tool server — Claude Code, Cursor, Windsurf call it automatically
CLI contexta ./project --pack onboarding Generates a context pack Markdown file
GUI contexta Desktop app with visual controls

MCP Server (recommended)

The MCP server is the primary way to use Contexta. AI coding assistants call it as a tool to understand your project — no copy-paste needed.

Setup

Add to your MCP configuration (Claude Code, Cursor, Windsurf, etc.):

{
  "mcpServers": {
    "contexta": {
      "command": "contexta",
      "args": ["serve"]
    }
  }
}

Or if running from source:

{
  "mcpServers": {
    "contexta": {
      "command": "python",
      "args": ["/path/to/contexta_mcp.py"]
    }
  }
}

Available tools

Tool What it does
scan_project Quick fingerprint — type, language, frameworks, deps, entry points
get_architecture Module relationships, folder structure, risks, key patterns
generate_context Full AI-optimized context pack with all preset options
find_files Search files by name, extension, or keyword
read_files Read specific file contents
list_packs List available pack presets
cache_status Show cache hit/miss statistics
refresh_cache Force-refresh cached analysis

Smart cache

Results are cached in memory with automatic invalidation. First call analyzes the project (~700ms), subsequent calls return in ~2ms until files change on disk. The cache monitors file mtimes and manifest files — when you edit code, the next call recomputes automatically.


Install

Option A: pip (recommended)

pip install contexta-ai

Optional AI API integrations:

pip install contexta-ai[claude]    # Claude API
pip install contexta-ai[gemini]    # Gemini API
pip install contexta-ai[openai]    # OpenAI API
pip install contexta-ai[all-ai]    # All three

Option B: Portable executables

Option C: From source

git clone https://github.com/pablokaua03/Contexta.git
cd Contexta
pip install -r requirements.txt
python contexta.py

CLI usage

# Generate context packs
contexta ./project                                          # default pack
contexta ./project --pack onboarding                        # understand a new codebase
contexta ./project --pack raw_files                         # clean path + content dump
contexta ./project --pack pr_review --diff --copy           # review changes
contexta ./project --mode debug --focus "auth flow"         # debug a specific area

# AI API integration — send context + question directly to an AI
contexta ./project --ask "what are the main security risks?"
contexta ./project --ask "explain the architecture" --provider claude

# Configure AI API keys
contexta --configure-ai

CLI flags

Flag Description
--pack Preset: custom, chatgpt, onboarding, pr_review, risk_review, debug, backend, frontend, changes_related, raw_files
--mode Context mode: full, debug, feature, diff, onboarding, refactor
--compression full, balanced, focused, signatures, lean
--ai Target AI profile: generic, chatgpt, claude, gemini, copilot
--task Task profile: general, ai_handoff, bug_report, code_review, explain_project, risk_analysis, refactor_request, pr_summary, write_tests, find_dead_code
--focus Bias scoring around a topic (e.g. "auth flow", "database")
--diff / --staged Use git changes as context
--ask Send context pack + prompt to an AI API
--provider AI provider: claude, gemini, openai
--api-key API key (also reads ANTHROPIC_API_KEY, GOOGLE_API_KEY, OPENAI_API_KEY)
--configure-ai Interactive AI API setup
-c / --copy Copy output to clipboard
-o / --output Custom output path

Context packs

Pack Best for
onboarding Understanding a new codebase fast
pr_review Code review with change context
risk_review Regression hotspots, missing coverage, broad-impact modules
debug Bug hunting with changed/suspicious files prioritized
backend / frontend Bias toward one side of the app
changes_related Git changes + nearby relevant files
raw_files Clean dump of important files — path + full content, no analysis
chatgpt General-purpose ChatGPT preset
custom Full manual control

What Contexta exports

Depending on pack, mode, and task, the output can include:

  • Project summary with detected technologies, entry points, purpose, and central modules
  • Read-this-first path through the repository
  • Main execution flow narrative
  • Core files, supporting files, related tests, and changed-file context
  • Relationship maps and risk notes
  • Score breakdown explaining why each file was selected
  • Curated Markdown payload ready for any AI tool

Main features

Feature Detail
MCP Server contexta serve — AI tools call it as a tool server with smart caching
AI API integration --ask sends context directly to Claude, Gemini, or OpenAI
Smart cache ~2ms cached responses with automatic mtime-based invalidation
Raw files pack Clean path + content dump for simple AI workflows
GUI + CLI Desktop app for visual use, CLI for scripting and automation
Project fingerprinting Detects stack, frameworks, domain, and project type automatically
Syntax-aware analysis tree-sitter + heuristic fallback for symbol extraction
Multi-language Python, JS/TS, Go, Rust, PHP, Java, C#, Kotlin, Swift, C++ and more
Token guidance tiktoken-backed estimates for pack sizing
Inline blob protection Collapses base64/binary literals automatically
PyPI package pip install contexta-ai with optional AI extras

Build from source

# Windows (requires Visual Studio C++ Build Tools)
.\build.bat

# Linux / macOS
chmod +x build.sh && ./build.sh

Build outputs: dist/contexta.exe (Windows), dist/contexta (Linux/macOS), dist/contexta-linux.tar.gz (Linux bundle).


Run tests

python -m pytest tests/ -k "not test_relation_score"

Security and behavior

  • Read-only: Contexta does not modify the scanned project
  • No runtime telemetry or network requirement (except optional --ask AI calls)
  • Scan limits prevent runaway exports
  • Embedded binary/blob payloads are suppressed automatically
  • AI API keys are stored locally in ~/.contexta/ai_config.json when using --configure-ai

Contributing

See CONTRIBUTING.md

Changelog

See CHANGELOG.md

License

MIT © pablokaua03

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

contexta_ai-2.0.0.tar.gz (509.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contexta_ai-2.0.0-py3-none-any.whl (146.8 kB view details)

Uploaded Python 3

File details

Details for the file contexta_ai-2.0.0.tar.gz.

File metadata

  • Download URL: contexta_ai-2.0.0.tar.gz
  • Upload date:
  • Size: 509.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contexta_ai-2.0.0.tar.gz
Algorithm Hash digest
SHA256 694ea2a7cc136a5250a8fe5cc8606b328a47ddd4dabed9dbfdce6cc780c6eb46
MD5 9d7ce103bb1f855730583e8c31f59d71
BLAKE2b-256 2e36895aa6bd8d3f7dd4af8574c42c46b21f1accb1c5d6b1fa109842a43ac2ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexta_ai-2.0.0.tar.gz:

Publisher: publish-pypi.yml on pablokaua03/Contexta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file contexta_ai-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: contexta_ai-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 146.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for contexta_ai-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a97b473d7456009e8325e7991d14d8cbcef7920862d34f9ebd664e4b70d8374
MD5 f493def660c3e537da49ef3c228cec4a
BLAKE2b-256 b4067c80a193cdcd26fbb4673316075865a5ea346d18130aecc7a7aec65a0260

See more details on using hashes here.

Provenance

The following attestation bundles were made for contexta_ai-2.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on pablokaua03/Contexta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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