TypeScript Definition Finder MCP Server

TypeScript Definition Finder MCP Server

A Model Context Protocol server that helps AI code editors locate TypeScript symbol definitions in codebases, particularly useful for finding original definitions of imported symbols and classes.

runninghare

Developer Tools
Visit Server

README

TypeScript Definition Finder MCP Server

smithery badge

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

  • Bun v1.2.2 or later
  • Node.js for running the compiled server

Installation

Installing via Smithery

To install TypeScript Definition Finder for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @runninghare/ts-def-mcp --client claude

Manual Installation

  1. Install dependencies:
bun install
  1. Build the project:
bun run build

Usage

Start the stdio server:

node dist/run.js

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
  2. 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
  3. 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

<img width="766" alt="2025-03-16_19-15-46" src="https://github.com/user-attachments/assets/cbb7cd44-cf3c-430f-a281-0b6187ab3235" />

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 index.ts

License

[Add your license information here]

Contributing

[Add contribution guidelines here]

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python