SuperAPI AI Directory

mcp-code-indexer

Index TypeScript/React repos into a code graph: who-renders and who-calls queries, blast radius, dependency cycles, dead code and symbol signatures.

Open website

About this tool

mcp-code-indexer is the source monorepo of code-graph-indexer. code-graph-indexer is a code intelligence engine that can convert any TypeScript / React / Next.js repository (including monorepos) into a queryable code graph, and provides services externally in five ways: CLI, an MCP server for AI agents, HTTP + WebSocket API, a 3D web explorer with a built-in chatbot, and local semantic search.

Purpose and Goals The engine is used to answer code relationship questions, such as "if I modify this, what will be affected?". The traditional approach requires an AI agent to read a large number of files and guess, whereas a single graph query gives the exact answer, with token consumption only about 1% of the former. This is because edge relationships are derived by parsing with the TypeScript parser, rather than through grep text matching. Edges are only drawn when they resolve to real indexed nodes, so the results are more conservative and reliable.

Main Capabilities

  • Graph model: each node carries metrics (loc, exportsCount), a status block (type/lint/build health status), and git metadata, enough to support codebase dashboards, impact analysis, and AI agent navigation.
  • Query types: supports who-renders, who-calls, blast-radius, dependency cycles, dead code detection, and symbol signature queries.
  • Five usage interfaces: 1) 3D explorer + chatbot, providing folder drill-down, type/health status coloring, hover tracing, blast radius highlighting, a 2D fallback mode, and a graph-based chat panel; 2) MCP server, registered via stdio, for Claude Code / Cursor to call directly, with 14 tools in total, including index_repo, get_graph, get_node, who_renders, who_calls, find_references, blast_radius, find_cycles, find_orphans, search_nodes, get_context_pack, build_embeddings, semantic_search, and open_explorer; 4) HTTP + WebSocket API, supporting reads, reverse queries, POST /api/reindex, POST /api/chat, and pushing real-time patches via WS /ws, bound only to 127.0.0.1; the endpoints are unauthenticated and can mutate state, and must not be exposed outside the host; 5) local semantic search, using the all-MiniLM-L6-v2 local embeddings (384-dimensional) provided by @huggingface/transformers, with no API key required, and data never leaves the local machine. This semantic search is an optional dependency; if not installed, semantic_search degrades to lexical search rather than failing outright.

How to Use If you only use the features, there is no need to clone this repository. Run npx code-graph-indexer ui --root . to get the full functionality; see the package README for details. This repository is for development work on the engine itself. Developing the engine requires Node ≥ 20.19 and pnpm 10 (pinned via packageManager; run corepack enable to select it). Before running the CLI or server from source, you must first run pnpm build. Running the full explorer can target this repository or any path: pnpm serve provides the prebuilt web bundle; pnpm ui is the hot-reload development server for developing the UI itself.

Architecture and Limitations The project is a Turborepo composed of several focused packages (and shared configuration), with dependency flow starting from the bottom: code-graph-core is the contract layer, using Zod schema validation for every node, edge, and snapshot, ensuring the graph shape end to end, pure functions, and complete unit tests; code-indexer is the analysis engine, using ts-morph to parse and perform workspace discovery (monorepos and standalone repositories), writes incremental snapshots to .code-graph/, and also doubles as the MCP server; indexer-server wraps the engine with Express + ws, indexes at startup, enriches node status in the background, watches files for real-time updates, and serves chat endpoints (local claude CLI → API key → heuristic); web/code-graph is the 3D explorer, a pure API consumer; code-indexer-dist packages the above into a single code-graph-indexer npm package, containing a web UI. The tech stack includes TypeScript (strict mode), Turborepo, pnpm workspaces, ts-morph, Zod, Express, ws, @parcel/watcher, React, three.js, Model Context Protocol SDK, Transformers.js, Vitest, tsup. The project enforces quality through pnpm build, pnpm typecheck, pnpm lint, pnpm test, and CI runs the same gates on every push and PR. Limitations: the API binds only to 127.0.0.1, has no authentication and supports mutating operations, so it must not be exposed externally. Semantic search depends on optional dependencies and degrades to lexical search when they are missing. It currently targets only TypeScript / React / Next.js repositories; other languages or frameworks are not yet supported.

Use cases Suitable for TypeScript / React / Next.js projects that need precise code relationship analysis, impact analysis, dependency cycle detection, dead code discovery, and AI-agent code navigation, and is especially well suited to monorepo scenarios.