MCP server that traces call graphs, maps HTTP routes, and analyzes TypeScript/Next.js codebases. Works as a global tool in Claude Code — open any project and start tracing.
git clone <repo-url> && cd systemarchmcp
./install.shThis installs dependencies, builds, links the binary globally, and registers it as a Claude Code MCP server.
Seven tools available in any Claude Code session:
| Tool | Description |
|---|---|
trace_from |
Trace the call graph from a file and line number |
trace_endpoint |
Trace an HTTP endpoint by URL (e.g. /api/users/:id) |
trace_component |
Trace a React component's dependencies |
what_calls |
Find all callers and callees of a file |
what_handles |
Find which handler processes a given URL |
list_routes |
List all discovered HTTP routes |
list_unmatched |
Find HTTP calls that don't match any known route |
On first tool use in a project, the server:
- Indexes all
.ts,.tsx,.js,.jsxfiles using oxc-parser - Builds an in-memory call graph (nodes = definitions, edges = calls/imports)
- Discovers Next.js App Router and Pages Router API routes via filesystem scanning
- Watches for file changes and incrementally re-indexes
Supports:
- Next.js App Router (
app/api/) and Pages Router (pages/api/) - Monorepos with
packages/*/andapps/*/structures - Dynamic route matching —
/api/users/123matches/api/users/:id - Instance method tracing —
authService.login()resolves throughnew AuthService()to the imported class - Cross-file edge resolution with two-pass indexing
- SQLite persistence for cached graph data (in
.code-tracer/)
If you prefer not to use the install script:
npm install
npm run build
npm link
claude mcp add code-tracer --scope user -- code-tracer-mcpnpm run dev # watch mode
npm test # run 238 tests
npm run typecheck # type checkA sample Next.js app is included in demo/nextjs-app/ with API routes, services, components, and hooks for testing the full trace pipeline.