ts-graph-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ts-graph-mcpfind how user authentication flows from login to token generation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ts-graph-mcp
A TypeScript code graph tool that extracts code structure into a queryable database, with MCP integration for AI coding agents.
What It Does
ts-graph parses TypeScript source code using AST analysis and builds a graph database of your codebase structure. The graph captures code symbols (functions, classes, interfaces, types, variables) and their relationships (calls, imports, type usage, inheritance).
Semantic search included. On first run, ts-graph downloads an embedding model (~300MB) and generates embeddings for all symbols. AI agents can search by concept ("user validation", "database queries") not just exact symbol names.
AI agents query the graph through the searchGraph MCP tool to:
Find code by concept (semantic search)
Traverse call graphs (who calls this? what does this call?)
Find paths between symbols
Related MCP server: lsp-intelligence
Requirements
Node.js 24 or later. Storage uses the built-in node:sqlite module, so there
is nothing to compile — no build tools on any platform.
Quick Start
1. Configuration
Create ts-graph-mcp.config.json in your project root:
{
"packages": [
{ "name": "main", "tsconfig": "./tsconfig.json" }
],
"server": {
"port": 4000
}
}For monorepos, list multiple packages:
{
"packages": [
{ "name": "shared", "tsconfig": "./shared/tsconfig.json" },
{ "name": "frontend", "tsconfig": "./frontend/tsconfig.json" },
{ "name": "backend", "tsconfig": "./backend/tsconfig.json" }
],
"server": {
"port": 4000
}
}2. Start the HTTP Server
npx ts-graph-mcpThe server indexes your project on first run and watches for changes.
3. Configure Claude Code
claude mcp add ts-graph-mcp -- npx -y ts-graph-mcp --mcpOr manually in .mcp.json:
{
"mcpServers": {
"ts-graph-mcp": {
"command": "npx",
"args": ["-y", "ts-graph-mcp", "--mcp"]
}
}
}Note: Start the HTTP server first. The MCP wrapper connects to it.
MCP Tool: searchGraph
Unified search combining semantic search with graph traversal.
Query Patterns
// Find code by concept (semantic search)
{ topic: "user authentication" }
// What does handleRequest call? (forward traversal)
{ from: { symbol: "handleRequest" } }
// Who calls saveUser? (backward traversal)
{ to: { symbol: "saveUser" } }
// How does A reach B? (path finding)
{ from: { symbol: "handleRequest" }, to: { symbol: "saveUser" } }Parameters
Parameter | Required | Description |
| No* | Standalone semantic search (not combinable with |
| No* | Start point: |
| No* | End point: |
| No | Output limit (default: 50) |
*At least one of topic, from, or to is required. topic is standalone
only — it cannot be combined with from/to.
Example Output
## Symbols matching "validation" (semantic search)
validateInput (Function) - src/validation.ts [score: 0.847]
checkUserData (Function) - src/user.ts [score: 0.721]## Graph
handleRequest --CALLS--> validate --CALLS--> saveUser
## Nodes
validate:
type: Function
file: src/service.ts
offset: 10, limit: 5
snippet:
10: export function validate(data: Input) {
> 11: return saveUser(data);
12: }CLI Options
ts-graph-mcp # Start HTTP server
ts-graph-mcp --mcp # Start MCP stdio server
ts-graph-mcp --reindex # Force clean reindexConfiguration Reference
Required
Field | Description |
| Array of |
| HTTP server port (no default) |
Optional
Field | Description | Default |
| Enable semantic search |
|
| Embedding model |
|
| Database type |
|
| Database file path |
|
| Enable debouncing |
|
| Debounce delay (ms) |
|
| Use polling (for Docker/WSL2) |
|
| Polling interval (ms) |
|
| Directories to skip |
|
| Suppress reindex logs |
|
Embedding Models
Preset | Size | Dimensions | Notes |
| ~300MB | 768 | Default, fast and effective |
| ~650MB | 1024 | Higher quality, slower |
| ~4GB | 2560 | Highest quality, needs more RAM |
| ~300MB | 768 | Optimized for code |
Add .ts-graph-mcp/ to your .gitignore.
Yarn PnP Support
ts-graph works with Yarn 4 PnP monorepos. When .pnp.cjs is detected, module
resolution uses Yarn's PnP API.
Requirements:
Use base package imports (
@libs/utils, not@libs/utils/date)Declare dependencies with
workspace:*protocol
Supported Types
Nodes: Function, Class, Method, Interface, TypeAlias, Variable, SyntheticType, Feature, Spec, TestSuite, Test
Edges: CALLS, IMPLEMENTS, EXTENDS, TAKES, RETURNS, HAS_TYPE, HAS_PROPERTY, DERIVES_FROM, ALIAS_FOR, REFERENCES, INCLUDES, CONTAINS, SPECIFIES, VERIFIED_BY
Development
npm run check # Run tests, build, and lint
npm test # Run tests
npm run build # Compile TypeScriptProject Structure
ts-graph-mcp/
├── http/ # HTTP server, database, ingestion, queries
├── mcp/ # MCP stdio wrapper
├── shared/ # Shared types
├── ui/ # Web UI (React + Vite)
└── main.ts # Entry pointContributing
See ARCHITECTURE.md for technical internals and CLAUDE.md for code style guidelines.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Codebase graphs, caller impact analysis, and recorded project context for AI coding agents.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAST-aware TypeScript/JavaScript codebase exploration for AI agents, providing high-precision symbol resolution, reference finding, and structural analysis via MCP tools.135 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server providing 29 tools across 5 layers for semantic TypeScript/JavaScript code intelligence, enabling AI agents to find references, trace impacts, guard APIs, and explain errors without text-search false positives.18 npm1MIT
- AlicenseAqualityBmaintenanceIndexes any TypeScript / React / Next.js repo into a queryable code graph and exposes 13 MCP tools — who-renders, who-calls, find-references, blast-radius, find-cycles, dead-code orphans, and local semantic search — so agents query structure instead of reading whole files. Built on ts-morph, so edges are resolved, not grepped.142MIT
- AlicenseNot gradedqualityAmaintenanceSemantic code intelligence MCP server for TypeScript/JavaScript codebases, enabling AI agents to retrieve specific symbols, types, and relationships without reading entire files.20MIT