TypeScript 定义查找器 MCP 服务器
模型上下文协议 (MCP) 服务器可帮助 AI 代码编辑器在您的代码库中查找 TypeScript 符号定义。当您需要在 TypeScript 项目中查找导入的符号、类、接口或函数的原始定义时,此工具尤其有用。
特征
- 查找 TypeScript 符号的原始定义
- 使用从外部包导入的符号
- 返回定义位置和代码片段
- 支持 stdio 接口,可与 AI 代码编辑器无缝集成
先决条件
- Bun v1.2.2 或更高版本
- 用于运行已编译服务器的 Node.js
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 TypeScript Definition Finder:
手动安装
- 安装依赖项:
- 构建项目:
用法
启动 stdio 服务器:
工具描述
服务器提供了find_typescript_definition
工具,具有以下功能:
- 工具名称:
find_typescript_definition
- 触发命令:
/ts-def
(如果您想强制 AI 编辑器找到引用的符号定义,则在Cursor
中很有用) - 目的:在代码库中定位 TypeScript 符号的原始定义
输入参数
该工具需要三个参数:
file_path
(字符串):- 当前 TypeScript 文件的绝对路径
- 例如:
/path/to/your/project/src/index.ts
line_content
(字符串):- 包含要查找其定义的符号的整行
- 用于定位文件中的正确行
- 必须与文件中出现的行完全匹配
column_number
(数字):- 符号起始的列号(以 1 为基数)
- 必须是符号第一个字符的准确列位置
示例
- 查找导入的符号定义
鉴于此导入声明:
要找到从第 10 列开始的StdioServerTransport
的定义,您可以使用:
该工具的输出将是:
- 查找本地符号定义
对于本地类用法:
要查找从第 20 列开始的StdioServerTransport
的定义,请使用:
响应格式
该工具返回一个 JSON 响应,其中包含:
- 找到定义的文件路径
- 定义的行号
- 定义的实际代码片段
Claude 桌面示例
发展
该项目是使用 bun v1.2.2 中的bun init
创建的。Bun 是一个快速的一体化 JavaScript 运行时。
以开发模式运行
对于开发,您可以直接使用 Bun 运行服务器:
执照
[在此添加您的许可证信息]
贡献
[在此处添加贡献指南]
Related MCP Servers
- AsecurityAlicenseAqualityA production-ready template for creating Model Context Protocol servers with TypeScript, providing tools for efficient testing, development, and deployment.Last updated -1112JavaScriptMIT License
- AsecurityAlicenseAqualityA production-ready template for building Model Context Protocol servers in TypeScript, offering fast development with Bun, Biome linting, and automated version management.Last updated -11JavaScriptMIT License
- -securityAlicense-qualityA TypeScript implementation of a Model Context Protocol server that provides a frictionless framework for developers to build and deploy AI tools and prompts, focusing on developer experience with zero boilerplate and automatic tool registration.Last updated -6TypeScriptMIT License
- AsecurityAlicenseAqualityA TypeScript-based Model Context Protocol toolkit that enables AI to interact with code files, manage translations, build projects, and search for files and code content.Last updated -33435TypeScriptMIT License