# codeweb [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/GhostlyGawd/codeweb  
**GitHub Stars:** 0  
**npm Downloads (last month):** 277  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codeweb

## Description
Your agents break less code and burn fewer tokens — a deterministic call graph over 27 MCP tools.

## Tools
Capabilities this server exposes over MCP:

- **codeweb_callers** — Direct callers (call-edge in-neighbors) of a symbol. For EVERY kind of user (imports, subclasses, tests, refs too) use codeweb_dependents. Budgeted: top 20 by default (full:true for all).
- **codeweb_dependents** — "Who do I break?" — mapped users of a symbol in one answer: the union codeweb_callers cannot see (call + import + inherit + test + ref edges, each tagged by kind). Call BEFORE changing a symbol's contract or signature. Budgeted: top 20 by default (full:true for all).
- **codeweb_callees** — Direct callees (the functions a symbol calls). Budgeted: top 20 by default.
- **codeweb_impact** — Mapped transitive impact through supported graph edges, plus domains touched. Unmapped or dynamic relationships may be missing; this is source-graph evidence. Call BEFORE editing. Budgeted: summary + top 20 by fan-in (count is the mapped total; full:true for all mapped ids).
- **codeweb_cycles** — File-level dependency cycles (circular imports/calls). Budgeted: top 15 by default.
- **codeweb_orphans** — Uncalled and unexported symbols (dead-code candidates). Budgeted: top 25 by default; prefer codeweb_deadcode for a confidence-tiered plan.
- **codeweb_tests** — The tests that exercise a symbol (test-edge in-neighbors). Run the right subset after editing a symbol.
- **codeweb_diff** — Structural delta + regression verdict between two graph.json snapshots (before vs after an edit): nodes/edges/cycles/overlaps/orphans added & removed, coupling delta, and ok:false with reasons on a regression. The CI gate's exact semantics (verdict.check: orphan-gate): a new cycle, a new confirmed duplication, or a NON-EXPORTED symbol newly losing every in-edge — exported ones are listed in verdict, flagged exempt. Call AFTER an edit to gate it. Both args are optional: `after` defaults to the discovered graph, `before` defaults to "prev" (the graph.prev.json that codeweb_refresh {snapshot:true} saves) — so refresh {snapshot:true} then diff {} completes the legacy loop. Prefer before:"baseline", refresh:true after capturing a pre-edit baseline: one queued action refreshes and compares; skipped analysis checks are labeled.
- **codeweb_explain** — "Tell me about X before I touch it" in ONE ~1KB card: identity, role, signature, complexity, fan-in/out, tests, blast radius + domains, top-5 callers/callees, and any duplication/pattern findings it belongs to. Start here; drill down with impact/context/callers.
- **codeweb_brief** — The day-one page for a mapped repo (~2KB): domains with summaries, the most depended-on symbols, entry points, test layout, and known issues (duplications/cycles/orphans). Call FIRST in a new session instead of exploring; then codeweb_find/explain to go deeper.
- **codeweb_find** — Concept search when you do NOT know the symbol name: free text ("retry handling") -> ranked symbols (identifier/file/domain token match, stemmed, weighted by exports/role/fan-in). Deterministic, no embeddings. Start here when orienting; feed the top id to codeweb_explain.
- **codeweb_context** — Bounded edit window for a symbol in ONE call: its body, direct callers as CALL-SITE WINDOWS (±3 lines around each use — the lines that break if the contract changes), callees (location-only), and the impact set. Budgeted: 12 callers by default (full:true for the unabridged lists); bodies:"full" switches callers to whole caller bodies (large).
- **codeweb_refresh** — Re-extract the graph from disk (meta.root) so mid-task queries reflect your edits, not a stale snapshot. Incremental; preserves domains, drops stale overlaps. snapshot:true first saves the current graph as graph.prev.json, so codeweb_diff {} can gate the edit against it. Use baseline:true BEFORE editing to refresh and save graph.baseline.json, protected from ordinary/automatic refreshes. Then codeweb_diff {before:"baseline", refresh:true} verifies the edit. baseline:true explicitly replaces any earlier baseline.
- **codeweb_find_similar** — Before writing a function, rank mapped non-test function/method source candidates for comparison with a signature or body snippet (>=15% similarity; existing bodies limited to first 400 lines, candidate uncapped). structural:true uses identifier-normalized shingles. Missing bodies and unmapped code may hide candidates; similarity does not establish equivalent behavior, novelty, or safe reuse. Inspect source and run relevant tests.
- **codeweb_placement** — Where a NEW symbol belongs: given the comma-separated ids/labels it will call, suggests the domain + file by callee gravity, and warns if it duplicates an existing symbol.
- **codeweb_review** — Structural review of a change: changed files (comma-separated, optionally file:start-end) -> changed symbols, blast radius, domains, fan-in-ranked review order. With gate:true it FAILS on new body-confirmed duplication even WITHOUT `before`; add `before` (a prior graph.json) to also fail on new cycles / lost call-callers — the full review gate, agent-reachable.
- **codeweb_fitness** — Check the graph against architectural fitness rules (codeweb.rules.json): forbidden-dependency, layering, no-cycles, max-fan-in, max-symbol-loc. Reports violations. `rules` is optional — defaults to codeweb.rules.json beside the graph or in cwd.
- **codeweb_risk** — Rank symbols by change-risk (fan-in, fan-out, loc, blast radius, churn); `changed` scopes to a comma-separated file list. Budgeted: top 15 by default.
- **codeweb_break_cycles** — For each file dependency cycle, the cheapest dependency edge to sever — verified to actually break the cycle. Budgeted: top 10 cycles by default.
- **codeweb_deadcode** — Mapped orphan candidates grouped by structural review flags, with source availability, incompleteness and freshness. Deletion safety is not established; unmapped calls may hide use. Budgeted: top 20 per tier by span (totals stay true; full:true for all mapped candidates).
- **codeweb_codemod** — Plan a consolidation merge (report-only): canonical survivor, exact deletions + caller rewrites, LOC reclaimed, and the projected regression-gate verdict. `into` is optional — omitted, the engine picks the canonical survivor. Read-only — does NOT modify source.
- **codeweb_hotspots** — Rank symbols by refactoring priority (complexity x fan-in x churn): where to focus first. Budgeted: top 15 with raw components.
- **codeweb_campaign** — Ordered optimization candidates (orphan deletions, cycle cuts, duplicate merges), checked in a mapped-graph simulation for new cycles when applied in order. The simulation does not establish runtime safety or behavior. Budgeted: top 25 ROI steps by default (`budget` N or full:true for the whole plan).
- **codeweb_reading_order** — A foundations-first reading path (depended-upon leaves before orchestrators) to understand a codebase or one scope fast. scope: domain|file|symbol + value narrows it; budget bounds the list (default 20).
- **codeweb_simulate** — PRE-FLIGHT an edit without performing it: {newCycles, lostCallers, ok} for a hypothetical delete / merge / move. STRICTER than the CI gate (verdict.check: call-caller-preflight): flags ANY surviving symbol losing its last call-caller, exported or not, and cannot see duplication. Call BEFORE committing to a refactor plan — a doomed edit is discarded for the cost of one call.
- **codeweb_annotate** — Record a FALSE-POSITIVE suppression for a finding (never touches source — writes .codeweb/annotations.json): after you verify a deadcode/duplication finding is wrong, suppress its fingerprint so it stops resurfacing; the finding count reports suppressed separately. list:true shows current suppressions.
- **codeweb_stats** — The local value receipt: what codeweb actually did in this workspace (pre-edit cards, regressions flagged before landing, queries served), month by month plus lifetime. Local-only counters; nothing leaves the machine.
- **codeweb_map** — Build (or rebuild) the codeweb graph for a repo: runs the deterministic pipeline (extract -> cluster -> overlap -> optimize -> report) into <target>/.codeweb. ~3s for a 3k-symbol repo. Call when a query reports "no graph found", or after large changes. Returns the graph path + stats; artifacts include report.html and graph.json.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "codeweb": {
    "command": "npx",
    "args": ["-y","-p","@ghostlygawd/codeweb","codeweb-mcp"]
  }
}
```

## Documentation

## What codeweb does

codeweb builds a local graph of supported repository symbols and their relationships, then exposes that graph through MCP tools for coding agents. The graph can represent calls, imports, inheritance, tests, references, file-level cycles, domains, duplication findings, orphan candidates, and other structural properties. It is intended for change planning and review: an agent can identify a symbol’s users, estimate its mapped blast radius, inspect relevant call sites, and check the result of an edit.

The system is deterministic and runs on the local machine. It reads source code but does not execute the program, use an LLM for static checks, require an account, or send telemetry. A generated `.codeweb/report.html` provides an interactive view of the extracted map, while `graph.json` and related artifacts support comparisons and CI workflows.

## How it works

`codeweb_map` runs the extraction, clustering, overlap, optimization, and reporting pipeline for a repository. `codeweb_refresh` re-extracts the graph after edits and can save a prior graph for comparison. Queries return bounded results by default, with options such as `full:true` for larger mapped result sets.

A typical agent workflow starts with `codeweb_brief` or `codeweb_find`, continues with `codeweb_explain`, `codeweb_context`, or `codeweb_impact`, and uses `codeweb_tests` to identify relevant tests. Before a refactor, `codeweb_simulate` can check a hypothetical delete, merge, or move. Afterward, `codeweb_refresh` and `codeweb_diff` can compare graph snapshots, while `codeweb_review` performs a structural review of changed files.

## Setup and configuration

Run the package from a repository with npx:

```bash
npx -y @ghostlygawd/codeweb .
```

The initial map is written beneath the repository’s `.codeweb` directory. The generated report can be opened at `.codeweb/report.html`. Use `codeweb_map` when no graph exists or after substantial repository changes. For baseline comparisons, refresh with `baseline:true` before editing; for the older snapshot loop, use `snapshot:true` and then run `codeweb_diff`.

A CI workflow can build graphs for a pull request’s base and head and fail on configured structural regressions. The documented gate checks for a new dependency cycle, newly confirmed duplication, or a non-exported symbol that loses all mapped callers. The repository also supports `codeweb.rules.json` for architectural fitness checks.

## Tools and capabilities

The MCP surface includes tools for:

- Finding callers, callees, mapped dependents, tests, cycles, orphans, and transitive impact.
- Producing repository and symbol briefs, concept search results, bounded edit context, and foundations-first reading orders.
- Comparing similar functions, suggesting placement for a new symbol, and identifying hotspots or change-risk rankings.
- Planning duplicate consolidation, cycle cuts, dead-code review, optimization campaigns, and hypothetical refactors without changing source files.
- Reviewing changed files, checking architectural fitness rules, recording false-positive suppressions, and reporting local usage statistics.
- Building, refreshing, and comparing graph artifacts for local analysis and CI gates.

## Limitations and notes

Results describe the mapped source graph rather than complete runtime behavior. Unsupported layouts, ambiguous calls, dynamic dispatch, unmapped code, and other runtime relationships can cause callers or impact sets to be incomplete. Similarity findings do not prove equivalent behavior or safe reuse, and dead-code candidates are not deletion guarantees.

A passing structural check does not prove that the program works. Run relevant tests and inspect unresolved relationships. The diff gate exempts exported symbols from its orphan check, while `codeweb_simulate` is stricter and flags any surviving symbol that loses its last call-caller. Structural analysis uses no model tokens, and pure removals do not count as structural regressions.

_Full upstream README: https://allmcps.com/mcp/codeweb/readme_

