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 运行服务器:
执照
[在此添加您的许可证信息]
贡献
[在此处添加贡献指南]
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
模型上下文协议服务器可帮助 AI 代码编辑器在代码库中定位 TypeScript 符号定义,对于查找导入的符号和类的原始定义特别有用。
Related MCP Servers
- Asecurity-licenseAqualityA 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 -3305MIT License
- Asecurity-licenseAqualityA comprehensive Model Context Protocol server for advanced code analysis that provides tools for syntax analysis, dependency visualization, and AI-assisted development workflow support.Last updated -284
- Asecurity-licenseAqualityA discovery and recommendation service that helps AI assistants find Model Context Protocol servers based on natural language queries.Last updated -8864MIT License
- Asecurity-licenseAqualityA Model Context Protocol server that enables intelligent searching across documentation for 30+ programming libraries and frameworks, fetching relevant information from official sources.Last updated -226MIT License