Navigation
TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing - MCP Implementation

TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing

Empower AI code editors with this MCP server to swiftly trace TypeScript symbols, classes, interfaces, and functions back to their original definitions across your codebase.

Developer Tools
4.7(37 reviews)
55 saves
25 comments

Users create an average of 36 projects per month with this tool

About TypeScript Definition Finder MCP Server

What is TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing?

TypeScript Definition Finder MCP Server is a specialized tool enabling AI-powered code editors to trace and navigate to the original definitions of TypeScript symbols within your project. Built on the Model Context Protocol (MCP), it bridges the gap between coding environments and local codebases by resolving references to imported modules, classes, interfaces, and functions. Whether working with third-party packages or internal code, this server provides precise location and context for symbols, enhancing developer productivity through seamless definition tracing.

How to use TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing?

Begin by ensuring your TypeScript project includes the typescript dependency and Node.js runtime. Execute the command npx -y ts-def-mcp@latest within your project directory to start the server. Integrate this with supported AI editors like Claude Desktop or Cursor by configuring the /ts-def trigger command. Provide three parameters during queries: the absolute file path, the exact line containing the symbol, and its starting column number to receive detailed definition locations and code snippets.

TypeScript Definition Finder MCP Server Features

Key Features of TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing?

  • Deep Symbol Resolution: Identifies definitions across local and external package imports
  • Contextual Precision: Returns line/column coordinates and surrounding code context
  • Editor Ecosystem Support: MCP-compliant stdio interface works natively with leading AI tools
  • Development Integration: Built with Bun for high-performance execution

Use cases of TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing?

Developers benefit in scenarios like:

  • Tracing third-party API implementations (e.g., finding StdioServerTransport from Node modules)
  • Resolving type definitions in complex class hierarchies
  • Debugging by jumping directly to function declarations in external packages
  • Understanding legacy codebases through automated reference tracking

TypeScript Definition Finder MCP Server FAQ

FAQ from TypeScript Definition Finder MCP Server: Code Navigation & Definition Tracing?

  • Q: Does it work with Docker environments?
    A: No, requires direct filesystem access - avoid Docker/WebSocket setups
  • Q: How is the column number determined?
    A: Use 1-based indexing starting from the first character of the symbol's name
  • Q: Can I customize the trigger command?
    A: The /ts-def command is fixed, but editor integrations may offer workflow adaptations
  • Q: What about large codebases?
    A: Optimized for TypeScript project scales through incremental analysis and caching mechanisms

Content

TypeScript Definition Finder MCP Server

A Model Context Protocol (MCP) server that helps AI code editors find TypeScript symbol definitions in your codebase. This tool is particularly useful when you need to locate the original definition of imported symbols, classes, interfaces, or functions in a TypeScript project.

Features

  • Finds original definitions of TypeScript symbols
  • Works with imported symbols from external packages
  • Returns both the definition location and code snippet
  • Supports stdio interface for seamless integration with AI code editors

Prerequisites

  • TypeScript project with typescript dependency installed
  • Node.js for running the server

Installation & Usage

This is a Model Context Protocol (MCP) stdio server that requires access to your local filesystem to find TypeScript definitions. To use it:

  1. Ensure your project has TypeScript installed as a dependency
  2. Run the following command in your project directory:
npx -y ts-def-mcp@latest

You can integrate this command with various AI code editors that support MCP:

  • Claude Desktop
  • Cursor
  • Windsurf
  • Roo Cline Editor

Important Note : Due to the local filesystem access requirements, Docker + WebSocket solutions will not work. Please ignore the installation guide on https://smithery.ai/server/@runninghare/typescript-definition-finder-mcp.

Tool Description

The server provides a find_typescript_definition tool with the following capabilities:

  • Tool Name : find_typescript_definition
  • Trigger Command : /ts-def (Useful in Cursor if you want to force AI editor to find the referenced symbol definition)
  • Purpose : Locates the original definition of TypeScript symbols in your codebase

Input Parameters

The tool requires three parameters:

  1. file_path (string):
* The absolute path to the current TypeScript file
* Example: `/path/to/your/project/src/index.ts`
  1. line_content (string):
* The entire line containing the symbol you want to find the definition of
* Used to locate the correct line in the file
* Must match the line exactly as it appears in the file
  1. column_number (number):
* The 1-based column number where the symbol starts
* Must be the exact column position of the symbol's first character

Examples

  1. Finding an Imported Symbol Definition

Given this import statement:

import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

To find the definition of StdioServerTransport, which starts at column 10, you would use:

{
  "file_path": "~/my-mcp-project/src/index.ts",
  "line_content": "import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";",
  "column_number": 10
}

The output of this tool will be:

[
  {
    "file": "~/my-mcp-project/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts",
    "type": "Definition",
    "location": "Line 9, Column 22",
    "codeSnippet": "   8    */\n   9 > export declare class StdioServerTransport implements Transport {\n  10 +     private _stdin;\n  11 +     private _stdout;\n  12 +     private _readBuffer;\n  13 +     private _started;\n  14 +     constructor(_stdin?: Readable, _stdout?: Writable);\n  15 +     onclose?: () => void;\n  16 +     onerror?: (error: Error) => void;\n  17 +     onmessage?: (message: JSONRPCMessage) => void;\n  18 +     _ondata: (chunk: Buffer) => void;\n  19 +     _onerror: (error: Error) => void;\n  20 +     /**\n  21 +      * Starts listening for messages on stdin.\n  22 +      */\n  23 +     start(): Promise<void>;\n  24 +     private processReadBuffer;\n  25 +     close(): Promise<void>;\n  26 +     send(message: JSONRPCMessage): Promise<void>;\n  27   }\n"
  }
]
  1. Finding a Local Symbol Definition

For a local class usage:

class MyService {
  private transport: StdioServerTransport;
}

To find the definition of StdioServerTransport, which starts at column 20, use:

{
  "file_path": "/path/to/project/src/service.ts",
  "line_content": "  private transport: StdioServerTransport;",
  "column_number": 20
}

Response Format

The tool returns a JSON response containing:

  • The file path where the definition was found
  • The line number of the definition
  • The actual code snippet of the definition

Claude Desktop Example

2025-03-16_19-15-46

Development

This project was created using bun init in bun v1.2.2. Bun is a fast all-in-one JavaScript runtime.

Running in Development Mode

For development, you can run the server directly using Bun:

bun run src/index.ts

License

[Add your license information here]

Contributing

[Add contribution guidelines here]

Related MCP Servers & Clients