Skip to content

About

MCP server that traces call graphs, maps HTTP routes, and analyzes TypeScript/Next.js codebases.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

code-tracer-mcp

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.

Install

git clone <repo-url> && cd systemarchmcp
./install.sh

This installs dependencies, builds, links the binary globally, and registers it as a Claude Code MCP server.

What it does

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

How it works

On first tool use in a project, the server:

  1. Indexes all .ts, .tsx, .js, .jsx files using oxc-parser
  2. Builds an in-memory call graph (nodes = definitions, edges = calls/imports)
  3. Discovers Next.js App Router and Pages Router API routes via filesystem scanning
  4. Watches for file changes and incrementally re-indexes

Supports:

  • Next.js App Router (app/api/) and Pages Router (pages/api/)
  • Monorepos with packages/*/ and apps/*/ structures
  • Dynamic route matching — /api/users/123 matches /api/users/:id
  • Instance method tracing — authService.login() resolves through new AuthService() to the imported class
  • Cross-file edge resolution with two-pass indexing
  • SQLite persistence for cached graph data (in .code-tracer/)

Manual setup

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-mcp

Development

npm run dev          # watch mode
npm test             # run 238 tests
npm run typecheck    # type check

Demo

A sample Next.js app is included in demo/nextjs-app/ with API routes, services, components, and hooks for testing the full trace pipeline.

About

MCP server that traces call graphs, maps HTTP routes, and analyzes TypeScript/Next.js codebases.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages