Context Crafter MCP
Local-first MCP server that turns source repositories into compact AI-agent context: project overviews, repo maps, dependency graphs, architecture notes, and validation reports.
What it generates
| File | Purpose |
|---|---|
AI_CONTEXT_INDEX.md |
Master index linking all generated docs |
PROJECT_OVERVIEW.md |
Detected stacks, root files, source layout, entry points |
REPO_MAP.md |
Compact directory tree with config and test directories |
DEPENDENCY_GRAPH.md |
Mermaid dependency graph + external dependency list |
DEPENDENCY_GRAPH.mmd |
Raw Mermaid dependency graph source |
ARCHITECTURE_SUMMARY.md |
Architecture patterns, risks, and unknowns |
AGENT_BRIEF.md |
Concise 1-page summary optimized for coding agents |
COMMANDS.md |
Statically inferred setup, test, and build commands |
VALIDATION_REPORT.md |
Output completeness and analysis health |
SCAN_REPORT.md |
Scan coverage, skipped items, and safety notes |
EVIDENCE_LEDGER.json |
Machine-readable observed/inferred/unknown evidence ledger |
CONTEXT_MANIFEST.json |
Machine-readable bundle manifest for agents and automation |
RUN_STATE.json |
Machine-readable run metadata for downstream automation and tracking |
Quick start
Requires Python 3.11+ and uv.
From a repo checkout
git clone https://github.com/0langa/context-crafter-mcp.git
cd context-crafter-mcp
uv sync --extra dev
uv run context-crafter-mcp --help
From the published package
Current release is 1.0.0, published to PyPI as context-crafter-mcp.
uv tool install context-crafter-mcp
context-crafter-mcp --help
Or run it without installing:
uvx context-crafter-mcp --help
From a built wheel
If you need an unpublished revision, build and install locally:
uv build
uv tool install --from dist/context_crafter_mcp-*.whl context-crafter-mcp
context-crafter-mcp --help
For MCP clients, the published-package path uses uvx:
{
"mcpServers": {
"context-crafter": {
"command": "uvx",
"args": ["context-crafter-mcp", "serve"]
}
}
}
Run a self-test against the current directory (uses a temp directory by default):
uv run context-crafter-mcp self-test .
Generate context docs for any repository:
uv run context-crafter-mcp generate /path/to/repo --output docs/generated --profile standard
On Windows:
uv run context-crafter-mcp generate C:\path\to\repo --output docs\generated --profile standard
Validate the generated output:
uv run context-crafter-mcp validate docs/generated
Profiles
| Profile | Use case |
|---|---|
| compact | Quick AI context; shorter trees, fewer symbols, concise briefs |
| standard | Default balanced detail |
| deep | Maximum detail for manual review or large repos |
Use as a plugin
The repository is also a plugin-forge plugin for Claude Code, Codex, and Kimi Code. The plugin bundles the MCP server with two skills and a slash command, so the agent knows when to reach for the tools instead of only how.
| Surface | Name | Purpose |
|---|---|---|
| Skill | crafter:using-context-crafter |
When to use the tools, what the outputs mean, evidence discipline, limits |
| Skill | crafter:onboard-repo |
Step-by-step workflow for orienting in an unfamiliar repository |
| Command | /context-map |
Scan the current repo and report its shape in under 15 lines |
| MCP | context-crafter |
All 8 tools |
Install it into every provider with plugin-forge. From a plugin-forge checkout:
uv run forge install --path /path/to/context-crafter-mcp --provider all
Add --dry-run first to see the three target directories without writing anything. Agents with the
plugin-forge MCP server configured can call its install tool instead.
The plugin runs the server from the checkout (uv run --project <plugin root>), so it does not
depend on the published package. forge.yaml is the source of truth; the provider manifests
(.claude-plugin/plugin.json, .codex-plugin/plugin.json, kimi.plugin.json, .mcp.json,
.codex-mcp.json) are compiled from it and should not be hand-edited.
Use with MCP clients
Fastest path
Claude Code and Codex both register the server for you:
claude mcp add context-crafter -- uvx context-crafter-mcp serve
codex mcp add context-crafter -- uvx context-crafter-mcp serve
Config snippets
For clients without an mcp add command, generate a client-specific snippet:
uv run context-crafter-mcp mcp-config --client kimi
Supported clients: claude-desktop, claude-code, kimi, cline, roo, vscode, codex, generic-stdio.
The snippet is emitted in the format that client actually reads. codex gets TOML; every other
client gets JSON.
Published package config
Clients that read JSON use the same stdio config when installed via uvx:
{
"mcpServers": {
"context-crafter": {
"command": "uvx",
"args": ["context-crafter-mcp", "serve"]
}
}
}
Codex reads ~/.codex/config.toml, so it gets the same server as a TOML table:
[mcp_servers.context-crafter]
command = "uvx"
args = ["context-crafter-mcp", "serve"]
Local development config
Point to the repo checkout directly:
uv run context-crafter-mcp mcp-config --client claude-desktop --repo /path/to/this/repo
Client placement
| Client | Where to place the config | Format |
|---|---|---|
| claude-desktop | claude_desktop_config.json → mcpServers |
JSON |
| claude-code | .mcp.json in project root, or claude mcp add |
JSON |
| kimi | Kimi Code settings → MCP servers | JSON |
| cline | Cline settings → MCP servers (hot reload) | JSON |
| roo | Roo settings → MCP servers | JSON |
| vscode | .vscode/mcp.json or user settings |
JSON |
| codex | ~/.codex/config.toml, or codex mcp add |
TOML |
| generic-stdio | Any client that accepts stdio JSON | JSON |
MCP Inspector
Test the server with the MCP Inspector:
npx @modelcontextprotocol/inspector uv run context-crafter-mcp serve
For local repo inspection:
npx @modelcontextprotocol/inspector uv --directory /path/to/this/repo run context-crafter-mcp serve
MCP tools
detect_project— detect stacks for a repo pathgenerate_context— generate 9 required Markdown files plusDEPENDENCY_GRAPH.mmd,EVIDENCE_LEDGER.json,CONTEXT_MANIFEST.json, andRUN_STATE.jsongenerate_project_overviewgenerate_repo_mapgenerate_dependency_graphgenerate_architecture_summaryvalidate_generated_contextexplain_capabilities
MCP resources
After generate_context, generated files are exposed as context-crafter://latest/<filename> resources. Only files from the current session are readable; arbitrary local paths are denied.
Resources are advertised with file-appropriate MIME types, including text/markdown, text/vnd.mermaid, application/json, and text/html for optional HTML output.
Generation results also report resolved_output_dir. If the requested output_dir would escape the repository root, output is confined to docs/generated.
Example output
See examples/outputs/ for real generated files from the demo repository.
Quick preview of AGENT_BRIEF.md:
- Entry points:
src/context_crafter_mcp/cli.py,src/context_crafter_mcp/server.py - Stacks: Python (MCP server, LangGraph pipeline, static analyzers)
- Key dependencies:
mcp,langgraph,pydantic
What makes this different
| Capability | Context Crafter MCP | Generic AI context generators |
|---|---|---|
| Local-first | Runs entirely on your machine | Often cloud-based or API-dependent |
| Static-only | No code execution, no network calls | May run code or call LLMs |
| Deterministic | Same input → same output structure | Often non-deterministic |
| No API keys | Zero external dependencies | Usually requires API keys |
| MCP-native | First-class MCP server with tools, resources, prompts | Ad-hoc integration |
| Validation | Built-in validation reports with machine-readable codes | Rarely validated |
| Evidence model | Observed / inferred / unknown labels on every claim | Often overconfident |
Safety model
- Read-only analysis — never executes code in the target repository.
- Output confined to repo —
output_diris resolved and validated so it cannot escape the repository root. - Resolved path reported — generation JSON explicitly reports the actual output directory used after confinement.
- No network — no HTTP calls, no model inference, no API keys.
- Bounded scans — depth, file count, and file size limits with safe defaults.
- No symlinks followed — prevents infinite loops and directory escaping.
- No stdout logging in MCP mode — stdio protocol is protected from corrupting output.
- Basic secret awareness — flags potential secret files (
.env,credentials.json) in scan reports.
See SECURITY.md for the full threat model and reporting process.
Supported stacks
| Stack | Detection | Analysis depth | Optional extra |
|---|---|---|---|
| Python | pyproject.toml, requirements.txt, *.py |
stdlib AST (imports, classes, functions) | — |
| Node/TypeScript | package.json, tsconfig.json, *.js/ts |
tree-sitter AST + regex fallback | parsers |
| .NET | *.sln, *.csproj, *.cs |
tree-sitter C# AST + XML + regex fallback | parsers |
| Rust | Cargo.toml, *.rs |
tree-sitter Rust AST + regex fallback | parsers |
| Go | go.mod, *.go |
tree-sitter Go AST + regex fallback | parsers |
| Java | pom.xml, build.gradle, build.gradle.kts, *.java |
javalang AST + regex fallback (nested build files discovered) | parsers |
| Generic | Any directory | Directory and filename heuristics | — |
Trust bar note: Python, Node/TypeScript, Go, and Rust have the highest real-repo smoke coverage. Java and .NET are supported and tested on fixtures, but their analysis depth has not yet reached the same hardening standard.
Install deeper parser support:
uv sync --extra parsers
Architecture
- Scanner boundary —
Scanner.scan(root, options) -> RepoSnapshot. Everything above the scanner consumesRepoSnapshot, making the scanner replaceable without changing analyzers. - Python product layer — MCP server, CLI, analyzers, and renderers are Python. A lower-level scanner (Rust/Go) is only considered if benchmarks prove Python traversal is the bottleneck.
- LangGraph pipeline —
validate_repo -> detect -> scan -> analyze -> render. - Analyzer registry —
AnalyzerRegistrywithregister,detect,analyze,merge. Language analyzers run based on detected project types. - Parser abstraction —
ParserBackendprotocol with concrete implementations (Tree-sitter, javalang, stdlib AST, regex fallback). - Enriched snapshot —
SnapshotFilecarriesextension,language_hint, andis_textfor richer analysis.
See docs/adr/0001-python-product-layer-replaceable-scanner.md.
Development
uv sync --extra dev
uv run ruff check .
uv run ruff format --check .
uv run mypy src
uv run pytest -q
uv run context-crafter-mcp self-test .
See CONTRIBUTING.md.
Limitations
| Limitation | Detail |
|---|---|
| Static analysis only | No runtime behavior, dynamic imports, or conditional architecture |
| Non-Python depth | Real AST parsers with regex fallback, not full semantic analysis |
| HTML rendering | Uses markdown library when available; stdlib fallback otherwise |
| Secret redaction | Conservative generated-output redaction for obvious key/token/password values; review generated output before sharing |
| Gitignore nesting | Supported via pathspec with deepest-matching-wins semantics |
| Determinism | Timestamps vary between runs; content and ordering are stable |
| Compact profile | Intentionally omits sections even when a small repo could fit more |
See docs/REAL_REPO_SMOKE_MATRIX.md for the current pre-1.0.0 hardening confidence set.
License
MIT. See LICENSE.
Metadata
Release files for context-crafter-mcp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| context_crafter_mcp-1.0.0.tar.gz | 288.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| context_crafter_mcp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 380.9 kB
Release files / context_crafter_mcp-1.0.0.tar.gz
| Download URL | context_crafter_mcp-1.0.0.tar.gz |
|---|---|
| Size | 288.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70daec5bb7f78f55f9cf528cb9e63a202669de1b7a70cbfdf68c4c89d1152410
|
|
BLAKE2b-256 checksum How to use checksums |
4894c1e535a591bf2a5a0a187a4c1f633a637e6a1224090bea7e1383e8a1b99a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logRelease files / context_crafter_mcp-1.0.0-py3-none-any.whl
| Download URL | context_crafter_mcp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 92.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef7ba06b68a2eaad5bb2953717dda84dc9d057ad7a87c9488ee455bc74b1d772
|
|
BLAKE2b-256 checksum How to use checksums |
7be4640b271ffe9e3113f540824061fb725d8501d0f014aec38daf5b69d6147f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logSecurity for context-crafter-mcp 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for context_crafter_mcp-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.