Nishant-Chaudhary5338/mcp-code-indexer

๐Ÿ’ป Developer Tools
0 Views
0 Installs

๐Ÿ“‡ ๐Ÿ  - Index any TypeScript/React repo (including monorepos) into a queryable code graph. Reverse queries (who-renders, who-calls, find-references), blast-radius analysis, dependency cycles, dead-code orphans, and symbol signatures โ€” exposed over stdio. Install: npx code-graph-indexer.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "nishant-chaudhary5338-mcp-code-indexer": {
      "command": "npx",
      "args": [
        "-y",
        "nishant-chaudhary5338-mcp-code-indexer"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

mcp-code-indexer

The source monorepo for code-graph-indexer โ€” a code-intelligence engine that turns any TypeScript / React / Next.js repo into a queryable code graph and serves it five ways: a CLI, an MCP server for AI agents, an HTTP + WebSocket API, a 3D web explorer with a built-in chatbot, and local semantic search.

Just want to use it? You don't need this repo. npx code-graph-indexer ui --root . gets you the whole thing โ€” see the package README. This repo is for working on the engine itself.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   ts-morph AST    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   serve    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ any TS/React โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ  โ”‚  code graph   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ โ”‚ CLI ยท MCP ยท HTTP/WS ยท 3D UI ยท semantic โ”‚
โ”‚     repo     โ”‚   walk + resolve  โ”‚ nodes + edges โ”‚            โ”‚        (consume from anywhere)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Everything is built on ts-morph, so edges are resolved by the compiler, not grepped โ€” and conservative: an edge is drawn only when it resolves to a real indexed node. The indexer is generic; it discovers the workspace shape itself and handles monorepos (pnpm / turbo / lerna) and standalone single-package repos alike. Nothing about the target is hardcoded.


Why it makes development faster, cheaper, and more reliable

Estimated cost of the same question with an agent reading files versus one graph query (typical mid-size repo):

What you askAgent alone (read files)With the code graphYou save
"What calls format()?"~30k tokens ยท ~40s~0.4k tokens ยท <1s~99% tokens
"What breaks if I change this?"~50k tokens ยท ~60s (misses edges)~0.6k tokens ยท <1s (exact)~99% tokens
"Where's the code that does X?"~25k tokens ยท ~30s~0.3k tokens ยท ~2s~98% tokens
"Context to edit this safely"~40k tokens ยท ~50s (5 reads)~0.8k tokens ยท <1s (1 call)~98% tokens
"Any dead code or cycles?"~60k tokens ยท manual audit~0.5k tokens ยท instant~99% tokens

Faster (in-memory lookups, not re-reads) ยท cheaper (fewer tokens = lower bill) ยท reliable (compiler-resolved edges โ€” no hallucinated callers, no missed impact).


The graph model

Node typesEdge types
repo ยท app ยท package ยท folder ยท file ยท component ยท function ยท externalcontains ยท imports ยท calls ยท renders ยท references ยท depends-on

Each node carries metrics (loc, exportsCount), a status block (type/lint/build health), and git metadata โ€” enough to build codebase dashboards, impact analysis, and AI-agent navigation on top of.


Quickstart (working on the engine)

pnpm install
pnpm build        # turbo builds core โ†’ _shared โ†’ engine โ†’ server โ†’ web (topo order)
pnpm test         # unit tests across the engine + schema packages
pnpm typecheck
pnpm lint

Requires Node โ‰ฅ 20.19 and pnpm 10 (pinned via packageManager; corepack enable selects it). pnpm build is required before running the CLI or server from source.

Run the full explorer against this repo (or any path):

pnpm serve --root .        # HTTP/WS server on :3002 (serves the built UI too)
pnpm ui                    # OR: Vite dev server on :5182 with HMR, proxying /api + /ws โ†’ :3002

pnpm serve serves the pre-built web bundle; pnpm ui is the hot-reloading dev server for working on the UI itself.


The five surfaces

All resolve the same engine against a target repo root.

1. 3D explorer + chatbot

The apps/web/code-graph front-end โ€” a react-force-graph-3d viewer with folder drill-down, type/health coloring, hover tracing, blast-radius highlighting, a 2D fallback, and a chat panel grounded in the graph. It's a pure consumer of the HTTP/WS API: it loads GET /api/graph, then applies live GraphPatches over WS /ws as you edit files. The published package bundles the built version so npx code-graph-indexer ui just works.

2. MCP server โ€” 14 tools

Registers over stdio so Claude Code / Cursor can call it directly:

claude mcp add code-graph -- node "$(pwd)/tools/code-indexer/build/code-indexer/src/index.js"

Tools: 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 (starts the 3D UI and returns its URL). Full descriptions are in the package README.

3. CLI

node tools/code-indexer/build/code-indexer/src/cli.js index --root /path/to/repo
node tools/code-indexer/build/code-indexer/src/cli.js query blast-radius --id "fn:src/util.ts#format" --root /path/to/repo

4. HTTP + WebSocket API

pnpm serve --root /path/to/repo
curl localhost:3002/api/graph | jq '.meta'
# { "root": "/โ€ฆ", "nodeCount": 908, "edgeCount": 2138, "indexerVersion": "โ€ฆ" }

Reads, reverse queries, POST /api/reindex, POST /api/chat, and WS /ws for live patches. Bound to 127.0.0.1 only โ€” endpoints are unauthenticated and mutating, so never expose it off-host.

5. Semantic search

Local Xenova/all-MiniLM-L6-v2 embeddings via transformers.js โ€” no API key, nothing leaves the machine. Falls back to lexical search when the model isn't installed.


Architecture

Deeper rationale โ€” the graph model, why ts-morph, the macro/micro split, and the honest trade-offs โ€” is in docs/DESIGN.md.

A Turborepo of a few focused packages (plus shared config):

mcp-code-indexer/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ code-graph-core/       @repo/code-graph-core โ€” Zod schemas: nodes, edges, snapshot, status
โ”‚   โ””โ”€โ”€ code-indexer-dist/     code-graph-indexer โ€” the published npm bundle (tsup) + bundled web UI
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ _shared/               @tools/shared โ€” MCP server base (McpServerBase, ToolRegistry), utils
โ”‚   โ””โ”€โ”€ code-indexer/          code-indexer-mcp โ€” the engine: ts-morph analysis, CLI, MCP server
โ””โ”€โ”€ apps/
    โ”œโ”€โ”€ indexer-server/        indexer-server โ€” Express + ws runtime, file-watcher, REST/WS + chat
    โ””โ”€โ”€ web/code-graph/        code-graph โ€” the React + three.js 3D explorer

Dependency flow (leaves first):

code-graph-core โ”€โ”ฌโ”€โ–ถ code-indexer โ”€โ–ถ indexer-server โ”€โ”
   _shared โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                   โ”œโ”€โ–ถ code-indexer-dist  (the npm package)
   web/code-graph โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • code-graph-core โ€” the contract. Zod schemas validate every node, edge, and snapshot, so the graph shape is guaranteed end-to-end. Pure and fully unit-tested.
  • code-indexer โ€” the analysis engine. ts-morph parsing plus workspace discovery (monorepo vs standalone), incremental snapshots to .code-graph/. Doubles as the MCP server.
  • indexer-server โ€” wraps the engine in Express + ws, indexes on boot, enriches node status in the background, watches files for live updates, and serves the chat endpoint (local claude CLI โ†’ API key โ†’ heuristic).
  • web/code-graph โ€” the 3D explorer, a pure API consumer.
  • code-indexer-dist โ€” bundles all of the above into the single code-graph-indexer npm package, web UI included.

Scripts

CommandWhat it does
pnpm buildBuild every package (topo order via turbo)
pnpm typechecktsc --noEmit across every package
pnpm testUnit tests (schemas + engine)
pnpm lintESLint across all packages (shared flat config)
pnpm serve --root <path>Run the server (with UI) against any repo on :3002
pnpm uiVite dev server for the explorer on :5182

Tech

TypeScript (strict) ยท Turborepo ยท pnpm workspaces ยท ts-morph ยท Zod ยท Express ยท ws ยท @parcel/watcher ยท React ยท three.js ยท Model Context Protocol SDK ยท transformers.js ยท Vitest ยท tsup.

Status

pnpm build โœ“ ยท pnpm typecheck โœ“ ยท pnpm lint โœ“ ยท pnpm test โœ“. CI runs the same gate (build โ†’ typecheck โ†’ lint โ†’ test) on every push and PR (.github/workflows/ci.yml).

Related MCP Servers

Moxie-Docs-MCPโ˜… Featured

MCP & Agent Skills for Automated Documentation, and codebase conventions + context

๐Ÿ’ป Developer Tools2 views
3KniGHtcZ/codebeamer-mcp

๐Ÿ“‡ โ˜๏ธ ๐ŸŽ ๐ŸชŸ ๐Ÿง - Codebeamer ALM integration for managing work items, trackers, and projects. Provides 17 tools for reading and writing items, associations, references, comments, and risk management data via Codebeamer REST API v3.

๐Ÿ’ป Developer Tools1 views
21st-dev/Magic-MCP

Create crafted UI components inspired by the best 21st.dev design engineers.

๐Ÿ’ป Developer Tools0 views
a-25/ios-mcp-code-quality-server

๐Ÿ“‡ ๐Ÿ  ๐ŸŽ - iOS code quality analysis and test automation server. Provides comprehensive Xcode test execution, SwiftLint integration, and detailed failure analysis. Operates in both CLI and MCP server modes for direct developer usage and AI assistant integration.

๐Ÿ’ป Developer Tools0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it โ†’
โ˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.