# trace-mcp

Adopt this skill: https://proskills.md/skills/other/nikolai-vysotskyi-trace-mcp-skills-trace-mcp

Page: https://proskills.md/skills/other/nikolai-vysotskyi-trace-mcp-skills-trace-mcp
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/trace-mcp/SKILL.md
size: 6305
upstream: https://github.com/nikolai-vysotskyi/trace-mcp/blob/master/skills/trace-mcp/SKILL.md

````text
---
name: trace-mcp
description: Use trace-mcp tools for code navigation, impact analysis, and framework-aware queries instead of Read/Grep/Glob/Bash. Activate whenever the agent needs to explore, understand, or modify a codebase that has trace-mcp indexed.
---

# trace-mcp — Code Intelligence Routing

trace-mcp is a framework-aware code intelligence MCP server. It exposes 182 tools that return semantic, structured results over a cross-language dependency graph. When trace-mcp is available, it is almost always cheaper and more accurate than native file tools.

## When to Use

Activate this skill whenever you need to:
- Find a function, class, method, route, component, or any symbol
- Understand a file, module, or feature before editing
- Determine what breaks if you change something
- Trace a request flow, call graph, or data flow
- Audit architecture, dead code, tests, or security

**Do not use** `Read`, `Grep`, `Glob`, or shell `ls`/`find`/`cat`/`head`/`tail` for exploring source code (`.ts`, `.js`, `.py`, `.php`, `.go`, `.rb`, `.java`, etc.). Use trace-mcp tools instead. Native tools stay allowed only for non-code files (`.md`, `.json`, `.yaml`, configs) or immediately before an `Edit` on a known file.

## Start-of-Session Checklist

1. `get_project_map` with `summary_only=true` — orient yourself to the project structure
2. `get_task_context` with `task: "<natural-language description>"` — gather all relevant code in a single call instead of chaining `search` → `get_symbol` → `Read`

## Decision Matrix

| Task | trace-mcp tool | Instead of |
|---|---|---|
| Find a symbol by name | `search` | Grep |
| Understand a file before editing | `get_outline` | Read (full file) |
| Read one symbol's source | `get_symbol` | Read (full file) |
| Multiple symbols + shared imports | `get_context_bundle` | chained `get_symbol` |
| What breaks if I change X | `get_change_impact` | guessing |
| Who calls this / what does it call | `get_call_graph` | Grep |
| All usages of a symbol | `find_usages` | Grep |
| Implementations of an interface | `get_implementations` | Grep / ls |
| Classes implementing X | `search` with `implements` filter | Grep |
| Tests for a symbol or file | `get_tests_for` | Glob + Grep |
| Project overview | `get_project_map` (summary_only) | Bash ls/find |
| Context for a task | `get_task_context` / `get_feature_context` | reading many files |
| HTTP request flow | `get_request_flow` | reading route + controller files |
| DB model relationships | `get_model_context` | reading model + migrations |
| Component tree | `get_component_tree` | reading component files |
| Circular dependencies | `get_circular_imports` | manual tracing |
| Dead code / dead exports | `get_dead_code` (`mode: "exports_only"`) | Grep for unused |
| Project health / coverage gaps | `self_audit` | manual inspection |
| Complexity / hotspots | `get_complexity_report` / `get_risk_hotspots` | guessing |
| List env keys / what config exists | `get_env_vars` (keys + types/formats only, never values) | `os.environ` dump, `cat` of a `.env` file |

## Environment Variables (Safe Path)

- Task "list env keys / what config exists" → `get_env_vars`. It returns keys plus
  inferred types/formats only — never values, so it is safe for secrets.
- `get_env_vars { "pattern": "DB_" }` filters by key prefix.
  `get_env_vars { "file": ".env", "redacted": true }` gives a line-by-line redacted
  per-file view (keys + type hints, no values, preserves order/comments; requires `file`).
- Config file discovery goes via `search` / `get_symbol` / `get_outline` /
  `get_task_context` — never by importing a module to see what it touches.

> **FORBIDDEN — never use these for env/config discovery (values leak into model context):**
>
> - never dump the environment: `python -c "import os; print(os.environ)"` or any
>   `os.environ` / `process.env` printout
> - never import-diff the environment: `before = dict(os.environ)`, import a module,
>   then diff `os.environ` to see what it touched
> - never `print(module.__file__)` for file discovery
> - never `cat` or directly Read a `.env` file for discovery

## Token-Efficiency Rules

1. **Batch independent queries.** Use `batch` when you need 2+ independent tool calls:
   ```
   batch({ calls: [
     { tool: "get_outline", args: { path: "src/foo.ts" } },
     { tool: "get_outline", args: { path: "src/bar.ts" } },
     { tool: "search",      args: { query: "handleRequest", kind: "function" } }
   ]})
   ```
2. **Never read the same file twice.** Use `get_outline` once, then `get_symbol` for specific pieces.
3. **Prefer `get_context_bundle`** over chained `get_symbol` calls — it deduplicates shared imports.
4. **Read-before-Edit optimization.** When you must `Read` a file to edit it:
   - Call `get_outline` first to find the line range of the target symbol.
   - Read only that range with `offset` + `limit`. Never read a 500-line file to edit 5 lines.
5. **Do not delegate code exploration to subagents.** Agent subprocesses carry ~50k tokens of overhead before doing anything. Use trace-mcp tools in the main conversation instead.

## After Editing a File

- Call `register_edit` with the edited `file_path` to reindex just that file and invalidate caches. This is much lighter than a full `reindex` and keeps subsequent queries accurate.
- If the response includes `_duplication_warnings`, review the referenced symbols — you may be duplicating existing logic.
- Do **not** re-read the file to "verify" the edit. The `Edit` tool already confirmed success.

## Before Creating New Symbols

- Call `check_duplication` with `{ name, kind }` to verify no similar symbol exists. Prevents reinventing existing logic.

## Health Checks (Once Per Session)

- `audit_config` — stale references in CLAUDE.md / settings
- `self_audit` — dead exports, untested code, hotspots
- `get_tech_debt` — per-module tech-debt grades
- `get_optimization_report` — detects repeated reads, Bash grep usage, missed trace-mcp opportunities

## Related Skills

- `trace-mcp-refactoring` — safe refactoring workflow (risk assessment → rename → impact check)
- `trace-mcp-codemod` — bulk mechanical changes via `apply_codemod`
- `trace-mcp-pre-commit` — security, quality-gate, and antipattern checks before commit
````

## File: README.md
upstream: https://github.com/nikolai-vysotskyi/trace-mcp/blob/master/README.md

````text
<!-- Header images are generated — `node scripts/gen-readme-banner.mjs` re-renders
     them from docs/_data/counts.yml and docs/_data/pr_context_bench.json. Never
     retouch a PNG by hand: the numbers in it would stop tracking the data.
     PNG @2x rather than SVG because GitHub renders README images in an isolated
     context where an SVG's @font-face never loads and Space Grotesk falls back.
     The narrow cut is for phones: GitHub scales the 1200px banner into a ~390px
     column, which drops the tagline to 8px. Order matters — the first matching
     <source> wins, so the max-width pair has to stay above the theme source.
     The missing space in `(prefers-color-scheme:light)` on the narrow source is
     deliberate: GitHub's <themed-picture> substring-matches the spaced form and,
     for a reader who pinned Light in Appearance, rewrites that source's media to
     match every viewport — which would put the phone cut on a 750px desktop. -->

<p align="center">
  <picture>
    <source media="(max-width: 500px) and (prefers-color-scheme:light)" srcset="docs/images/readme/banner-narrow-light.png" />
    <source media="(max-width: 500px)" srcset="docs/images/readme/banner-narrow-dark.png" />
    <source media="(prefers-color-scheme: light)" srcset="docs/images/readme/banner-light.png" />
    <img src="docs/images/readme/banner-dark.png" width="750" alt="trace-mcp indexes what your agent keeps re-reading, and serves the answer instead. Context to review one pull request: 13,595 tokens without trace-mcp, 3,291 with it — 72.7% less, median over 60 merged PRs in 6 open-source repos that are not ours. 182 tools, 81 languages, 91 framework integrations, your code stays local, MIT." />
  </picture>
</p>

<!-- The three buttons carry their own background plate and sit flush against each
     other, so they continue the banner instead of floating on GitHub's canvas.
     Keep the anchors on one line: any whitespace between them paints a seam.
     There is no `width` attribute here on purpose. One `width` serves every
     viewport, so it can pin the desktop row (3 x 250 = 750, the banner's width)
     or let the phone cut fill the column, never both. The size therefore comes
     from srcset density instead: the 1600px desktop art declared `6.4x` lays out
     at exactly 250, and the 2000px phone art declared `4x` lays out at 500 —
     wider than any phone column, so `max-width: 100%` clamps it to the full
     width and the empty margin either side of the plate disappears.
     GitHub strips srcset from <img> while keeping it on <source> — measured on
     a live PR page — so the last <source> carries no media at all and always
     matches. That is what sizes the default dark view; the <img> is only ever
     reached by a renderer that drops <picture> entirely. -->
<p align="center"><a href="https://github.com/nikolai-vysotskyi/trace-mcp/releases/latest"><picture><source media="(max-width: 500px) and (prefers-color-scheme:light)" srcset="docs/images/readme/btn-macos-narrow-light.png 4x" /><source media="(max-width: 500px)" srcset="docs/images/readme/btn-macos-narrow-dark.png 4x" /><source media="(prefers-color-scheme: light)" srcset="docs/images/readme/btn-macos-light.png 6.4x" /><source srcset="docs/images/readme/btn-macos-dark.png 6.4x" /><img src="docs/images/readme/btn-macos-dark.png" alt="Download for macOS — Apple Silicon, Intel, .dmg" /></picture></a><a href="https://github.com/nikolai-vysotskyi/trace-mcp/releases/latest"><picture><source media="(max-width: 500px) and (prefers-color-scheme:light)" srcset="docs/images/readme/btn-windows-narrow-light.png 4x" /><source media="(max-width: 500px)" srcset="docs/images/readme/btn-windows-narrow-dark.png 4x" /><source media="(prefers-color-scheme: light)" srcset="docs/images/readme/btn-windows-light.png 6.4x" /><source srcset="docs/images/readme/btn-windows-dark.png 6.4x" /><img src="docs/images/readme/btn-windows-dark.png" alt="Download for Windows — .exe installer" /></picture></a><a href="https://www.npmjs.com/package/trace-mcp"><picture><source media="(max-width: 500px) and (prefers-color-scheme:light)" srcset="docs/images/readme/btn-npm-narrow-light.png 4x" /><source media="(max-width: 500px)" srcset="docs/images/readme/btn-npm-narrow-dark.png 4x" /><source media="(prefers-color-scheme: light)" srcset="docs/images/readme/btn-npm-light.png 6.4x" /><source srcset="docs/images/readme/btn-npm-dark.png 6.4x" /><img src="docs/images/readme/btn-npm-dark.png" alt="Install via npm — npm install -g trace-mcp" /></picture></a></p>

<p align="center">
  <sub><b>WORKS WITH</b> &nbsp;&middot;&nbsp; Claude Code &nbsp;&middot;&nbsp; Cursor &nbsp;&middot;&nbsp; Codex &nbsp;&middot;&nbsp; Windsurf &nbsp;&middot;&nbsp; Zed &nbsp;&middot;&nbsp; any MCP client</sub>
</p>

<!-- The banner carries this sentence as a picture; this line carries it as text,
     so search and screen readers get the same claim. Keep the two in sync, and keep
     both verbatim with the hero on trace-mcp.com and with docs/_config.yml —
     The boundary line under it is not a footnote: it travels with the claim wherever the claim goes, including the one
     declinable exception (TRA-979) — keep that clause verbatim with the hero too. -->
<p align="center">
  <strong>trace-mcp indexes what your agent keeps re-reading, and serves the answer instead.</strong><br />
  <strong>72.7% fewer input tokens</strong> to review a pull request &mdash; median over 60 merged pull requests in open-source repos we don't own.
</p>

<p align="center">
  <sub>We change configuration you could change yourself. We do not patch your client's binary, intercept its traffic, or rewrite its files. One declinable exception: the Max tier's <a href="https://trace-mcp.com/what-trace-init-installs.html#the-tweakcc-pairing-and-the-line-it-sits-next-to">tweakcc pairing</a> runs a third-party patcher for you.</sub>
</p>

<p align="center">
  <a href="https://github.com/nikolai-vysotskyi/trace-mcp/actions/workflows/ci.yml"><img src="https://github.com/nikolai-vysotskyi/trace-mcp/actions/workflows/ci.yml/badge.svg?branch=master" alt="CI" /></a>
  <a href="https://www.npmjs.com/package/trace-mcp"><img src="https://img.shields.io/npm/v/trace-mcp" alt="npm version" /></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License" /></a>
</p>

```bash
npm install -g trace-mcp   # MCP server, no app
trace init                 # wire it into your agent, once per machine
trace add                  # index the repo you are in
```

**72.7% fewer input tokens** to review a pull request — median over 60 merged PRs in six repos that are not ours, 13,595 → 3,291 per pull request. [Method and reproduction →](https://trace-mcp.com/pr-context-benchmark.html)

<sub>Measured at trace-mcp 3.23.2 (`cb8ab30c`) on 7 September 2026 — a result from that build, not a claim about the current one. What it set out to measure, the bar it had to clear and the verdict: [preregistration](https://trace-mcp.com/perf/prereg-pr-context/).</sub>

Cheaper is not the same as better, so the same 60 pull requests were reviewed twice and scored blind. The trace-mcp arm **understood the change in 67%** of them against **65%** for naive file loading, at **0.80** false positives per PR against **0.58**. [Quality half of the benchmark →](https://trace-mcp.com/perf/prereg-pr-quality/)

<p align="center">
  <img src="docs/images/app-graph.webp" alt="trace-mcp app — GPU graph explorer visualizing symbol connections, light appearance" width="820" height="512" loading="lazy" />
  <br/>
  <sub>The <a href="#desktop-app">desktop app</a>: a GPU graph explorer over the same index the MCP server serves.</sub>
</p>

---

## The problem

AI agents pay repeatedly for work they have already done. Every turn, the agent re-reads the same files, re-traverses the same dependencies, and re-inflates the context window with structure it discovered five steps ago. That repeated work is most of what a long 
````
