ts-graph-mcp logo

ts-graph-mcp

Community
couzic

A TypeScript code graph tool that extracts code structure into a queryable

Publishercouzic
Repositoryts-graph-mcp
LanguageTypeScript
Forks
2
Stars
8
Available tools
0
Transport typestdio, streamable-http
Categories
Links
  • Connect tools to AI workflows

    ts-graph-mcp exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    8 stars and 2 forks from the linked repository.

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

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:

json
{
  "packages": [
    { "name": "main", "tsconfig": "./tsconfig.json" }
  ],
  "server": {
    "port": 4000
  }
}

For monorepos, list multiple packages:

json
{
  "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

bash
npx ts-graph-mcp

The server indexes your project on first run and watches for changes.

3. Configure Claude Code

bash
claude mcp add ts-graph-mcp -- npx -y ts-graph-mcp --mcp

Or manually in .mcp.json:

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

typescript
// 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

ParameterRequiredDescription
topicNo*Standalone semantic search (not combinable with from/to)
fromNo*Start point: { symbol } or { query } with optional file_path
toNo*End point: { symbol } or { query } with optional file_path
max_nodesNoOutput 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

bash
ts-graph-mcp              # Start HTTP server
ts-graph-mcp --mcp        # Start MCP stdio server
ts-graph-mcp --reindex    # Force clean reindex

Configuration Reference

Required

FieldDescription
packagesArray of { name, tsconfig }
server.portHTTP server port (no default)

Optional

FieldDescriptionDefault
embedding.enabledEnable semantic searchtrue
embedding.presetEmbedding model"nomic-embed-text-v1.5"
storage.typeDatabase type"sqlite"
storage.pathDatabase file path.ts-graph-mcp/graph.db
watch.debounceEnable debouncingtrue
watch.debounceIntervalDebounce delay (ms)300
watch.pollingUse polling (for Docker/WSL2)false
watch.pollingIntervalPolling interval (ms)1000
watch.excludeDirectoriesDirectories to skip[]
watch.silentSuppress reindex logsfalse

Embedding Models

PresetSizeDimensionsNotes
nomic-embed-text-v1.5~300MB768Default, fast and effective
qwen3-0.6b~650MB1024Higher quality, slower
qwen3-4b~4GB2560Highest quality, needs more RAM
jina-embeddings-v2-base-code~300MB768Optimized 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

bash
npm run check        # Run tests, build, and lint
npm test             # Run tests
npm run build        # Compile TypeScript

Project 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 point

Contributing

See ARCHITECTURE.md for technical internals and CLAUDE.md for code style guidelines.

License

MIT

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "couzic-ts-graph-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ts-graph-mcp"
      ]
    }
  }
}

Use ts-graph-mcp MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once ts-graph-mcp is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add ts-graph-mcp as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the ts-graph-mcp MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "couzic-ts-graph-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "ts-graph-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the ts-graph-mcp MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the ts-graph-mcp MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use ts-graph-mcp to help me with this task?
ts-graph-mcp
Sure. I read it.
Here is what I found using ts-graph-mcp.

Option 2: Add an MCP server URL

Use this when ts-graph-mcp is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for ts-graph-mcp.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the ts-graph-mcp connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the ts-graph-mcp tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the ts-graph-mcp tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use ts-graph-mcp to help me with this task?
ts-graph-mcp
Sure. I read it.
Here is what I found using ts-graph-mcp.

Frequently asked questions

What is the ts-graph-mcp MCP server used for?

ts-graph-mcp is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use ts-graph-mcp MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use ts-graph-mcp with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use ts-graph-mcp MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With ts-graph-mcp connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect ts-graph-mcp MCP to TypingMind?

ts-graph-mcp can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does ts-graph-mcp MCP provide in TypingMind?

ts-graph-mcp exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use ts-graph-mcp MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If ts-graph-mcp requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇