ctx-gen-mcp
This server provides tools to generate, validate, and assemble a navigable, AI-friendly code wiki for large projects:
Scan a code repository (
scan_skeleton): Analyze a project directory to produce a deterministic module skeleton, including domain groupings, tags, dependency graphs, and file/line statistics.Validate documentation coverage (
validate_coverage): Check that every discovered module has a corresponding generated context JSON, report coverage percentage, list missing modules, and detect stale modules whose source code has changed since last generation.Assemble wiki documentation (
assemble_docs): Compile all per-module JSON context files into a structured, progressive-disclosure Markdown wiki — producing a mainINDEX.mdentry point and individual cross-linked.wiki.mdpages per module, organized by domain.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ctx-gen-mcpgenerate L0-L3 context docs for this project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ctx-gen-mcp
Code context wiki generator -- MCP Server + OpenCode plugin for navigable, progressive-disclosure code docs with domain grouping, tags, and dependency graph.
What It Does
Generates a navigable Code Wiki for large projects, so AI coding agents can quickly locate and understand any module without reading the entire codebase.
Instead of dumping flat documentation, ctx-gen produces:
INDEX.md -- single entry point with domain table, tag index, and module list
Cross-linked wiki pages -- each module has its own
.wiki.mdwith YAML front-matter, summary, dependency links, and detailed contentDomain grouping -- modules auto-grouped by directory structure
Tag-based lookup -- find modules by language, architecture level, tech feature
Dependency graph -- shallow
#include/importanalysis with cross-links
Related MCP server: MCP Prompt Enhancer
Progressive Disclosure
The wiki is designed so AI agents read the minimum to locate what they need:
INDEX.md (~50-100 lines) -- scan domains and tags
lookup MCP tool -- find modules by keyword without reading the INDEX
Module wiki page -- full context for one module with cross-links to related modules
Follow links --
Depends:/Used by:links for impact analysis
One-Click Install
# 1. Install the pip package
pip install ctx-gen-mcp
# 2. Run one-click setup (installs skill + agent + MCP config)
ctx-gen-setupThat's it. OpenCode will now have:
A
ctx-genskill (loadable via/ctx-gen)A
ctx-genagent (switchable in agent panel)MCP server config in
opencode.jsonAGENTS.mdin your project root
Usage
In OpenCode (recommended)
Open your project in OpenCode
Say:
"use the ctx-gen skill to generate context wiki"Or switch to the
ctx-genagent in the agent panelThe agent will: scan -> generate per-module JSON -> validate -> assemble wiki
MCP Tools (any MCP-compatible agent)
The package exposes 4 deterministic MCP tools:
Tool | What it does |
| Scan repo -> skeleton with domains, tags, dependency graph |
| Find modules by tag/domain/keyword (no need to read full INDEX) |
| Check all modules have context, detect stale ones |
| Build wiki INDEX.md + cross-linked .wiki.md pages |
CLI
# Run MCP server directly (for testing)
ctx-gen-server
# Or:
python -m ctx_gen_mcp.server
# Re-run setup (e.g. after moving project)
ctx-gen-setup --project-dir /path/to/project
# Install globally (all projects)
ctx-gen-setup --global
# Uninstall
ctx-gen-setup --uninstallOutput
After running, you'll have:
.ctx-cache/
skeleton.json # repo structure with domains/tags/deps (deterministic)
ctx/
<module_id>.json # per-module structured context
docs/
wiki/
INDEX.md # single entry point
domains/
<domain>/
<module>.wiki.md # cross-linked per-module wiki pageAdd these to .gitignore:
.ctx-cache/
docs/wiki/Architecture
Core Insight: Separate Deterministic from LLM Operations
Operation | Who does it | Why |
Repo scanning + domain grouping |
| Glob + regex never hallucinates |
Module lookup by tag/keyword |
| String matching is exact |
Per-module description | LLM (via Agent) | Needs semantic understanding |
Coverage validation |
| Hash comparison is exact |
Wiki assembly |
| Template + cross-link generation |
Domain Grouping (Hybrid Strategy)
Directory-based first:
src/engine/-> domain "engine"If a domain has >10 modules, flagged for potential LLM subdivision
Domains are reflected in the output directory structure
Tag Inference (Automatic)
Tags are inferred from file names, directory names, and shallow content analysis:
Dimension | Examples | Detection Method |
Language |
| File extension statistics |
Architecture |
| Filename + content keywords |
Tech feature |
| Filename + content keywords |
Build target |
| Build system analysis |
Dependency Detection (Shallow)
Only direct #include, import, require statements are analyzed.
This covers ~80% of real dependencies with zero parser overhead.
Requirements
Python >= 3.10
OpenCode >= 1.0 (for skill/agent support)
Or any MCP-compatible agent (Claude Code, etc.)
License
MIT
Available Tools
3 toolsassemble_docsC
Assemble all per-module JSON context files into progressive-disclosure MD docs.
Args: project_dir: Path to the project root. ctx_dir: Path to the ctx/ directory with per-module JSONs. out_docs: Output directory for MD docs. project_name: Optional project name (default: inferred from project_dir).
Returns: Dict with: main_doc, module_docs[], errors[].
| Name | Required | Description | Default |
|---|---|---|---|
| project_dir | Yes | ||
| ctx_dir | Yes | ||
| out_docs | Yes | ||
| project_name | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It does not mention file system side effects (reading JSON, writing MD), permissions required, or whether it overwrites existing files. The return value description is minimal.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is relatively short but includes the Args section which largely repeats the input schema. Given no schema descriptions, this is acceptable but could be more concise by integrating parameter details into a single paragraph.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description mentions output structure (Dict with main_doc, module_docs[], errors[]) which is helpful. However, it lacks details on prerequisites (e.g., JSON files must exist), error conditions, or how this fits with sibling tools. No output schema exists, so more detail on return values would benefit completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description includes an Args section with brief explanations for each parameter, compensating for 0% schema coverage. However, these are minimal (e.g., 'Path to the project root') and do not add context like formatting constraints or defaults beyond what the schema already indicates.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Assemble all per-module JSON context files into progressive-disclosure MD docs', which specifies a concrete verb and resource. However, it does not differentiate from sibling tools like scan_skeleton or validate_coverage, missing an opportunity to clarify its role in the pipeline.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus its siblings (scan_skeleton, validate_coverage). The description should indicate that this tool is typically used after scanning and validation are complete.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
scan_skeletonA
Scan a code repository and return a deterministic module skeleton.
Args: project_dir: Absolute path to the project root directory. depth: Directory depth for auto-detecting modules (default 2). code_only: If True, only include code files (default True).
Returns: A dict with: root_path, total_modules, total_files, total_lines, modules[].
| Name | Required | Description | Default |
|---|---|---|---|
| project_dir | Yes | ||
| depth | No | ||
| code_only | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description clearly outlines deterministic behavior and return structure, but omits potential edge cases or non-obvious side effects. With no annotations, this is adequate but not exhaustive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, well-structured with Args and Returns sections, and contains no redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers the return value and parameter semantics, but lacks details on error handling or performance considerations. Sibling context not addressed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Each parameter is explained with type and default values, adding meaning beyond the schema (e.g., project_dir as absolute path, depth for auto-detection depth).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool scans a code repository and returns a deterministic module skeleton, differentiating it from siblings like assemble_docs and validate_coverage.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool vs alternatives; the description lacks context for selecting this tool over siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_coverageA
Validate that every module has a generated context JSON, and detect stale ones.
Args: project_dir: Path to the project root. ctx_dir: Path to the ctx/ output directory. check_stale: If True, detect modules whose source has changed (default True).
Returns: Dict with: total_modules, generated, coverage_pct, missing_ids[], stale_ids[], unknown_fields_summary{}.
| Name | Required | Description | Default |
|---|---|---|---|
| project_dir | Yes | ||
| ctx_dir | Yes | ||
| check_stale | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description partially compensates by indicating the tool validates and detects staleness, implying a read-only operation. However, it does not explicitly state whether the tool has side effects, requires specific permissions, or is idempotent. More transparency would improve the score.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured. It starts with a single-sentence summary, lists arguments with brief explanations, and specifies the return value. Every sentence serves a purpose with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of annotations and output schema, the description covers the basic functionality, parameters, and return values. However, it lacks details on error handling, expected input formats, or why a user would choose this tool over siblings. This leaves some gaps for a validation tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, so the description must compensate. It explains each parameter: 'project_dir: Path to the project root.', 'ctx_dir: Path to the ctx/ output directory.', and 'check_stale: If True, detect modules whose source has changed (default True).' These descriptions add meaningful context beyond the schema's type and name, though they could be slightly more detailed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Validate that every module has a generated context JSON, and detect stale ones.' It uses a specific verb (validate) and resource (coverage of context JSONs per module), and it distinguishes itself from siblings like assemble_docs and scan_skeleton, which likely handle assembly and scanning respectively.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings or alternative approaches. It does not mention prerequisites, exclusions, or explicit conditions for invocation. The usage is only implied by the purpose statement.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v1.0.0- First observed
assemble_docs - First observed
scan_skeleton - First observed
validate_coverage
TDQS
Scored across 3 tools
Each tool targets a distinct phase in the documentation generation workflow—scanning, assembling, and validating—with no functional overlap.
All tool names follow a consistent verb_noun pattern (assemble_docs, scan_skeleton, validate_coverage) with clear action and object.
Three tools are well-scoped for a context generation server, covering the essential operations without excess or deficiency.
The tool surface covers the core workflow (scan, assemble, validate), but lacks a tool to manage or regenerate specific context files manually.
Maintenance
Related MCP Connectors
Codebase graphs, caller impact analysis, and recorded project context for AI coding agents.
Project memory, semantic code search, and grounded agent context.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides intelligent summarization capabilities through a clean, extensible architecture. Mainly built for solving AI agents issues on big repositories, where large files can eat up the context window.1737MIT
- FlicenseNot gradedqualityDmaintenanceIntelligently analyzes codebases to enhance LLM prompts with relevant context, featuring adaptive context management and task detection to produce higher quality AI responses.2-
- AlicenseAqualityDmaintenanceProvides coding agents with a mental map of codebases via progressive disclosure, enabling efficient exploration of project structure and entity relationships.36GPL 3.0
- AlicenseAqualityAmaintenanceProvides AI coding agents with durable architecture memory for repositories by generating structured project maps of responsibilities, relationships, and risks.6281MIT