TypeScript Analyzer MCP Server - Enterprise Edition
使用智能 MCP 服务器分析并修复 TypeScript 中的任何类型错误——快速、可扩展且支持 React。
davidleathers113
README
TypeScript 分析器 MCP 服务器 - 企业版
一个高性能的 MCP (模型上下文协议) 服务器,用于分析和修复代码库中的 TypeScript any
类型,具有高级错误处理、缓存和智能类型推断功能。
功能
- 🔍 分析 TypeScript 文件: 扫描文件中的
any
类型并获取建议的替换类型 - 🛠️ 修复 TypeScript 文件: 自动将
any
类型替换为更具体的类型 - 📊 批量处理: 一次处理多个文件
- 🧩 组件接口生成: 为 React 组件生成 TypeScript 接口
- ⚙️ 服务器配置: 动态更新服务器配置(日志级别、缓存等)
- 🔧 缓存管理: 清除和管理分析缓存
安装
- 克隆此仓库
- 安装依赖:
npm install
- 构建项目:
npm run build
- 启动服务器:
或者npm run start
node dist/index.js
与 Claude Desktop 一起使用
要将此 MCP 服务器与 Claude Desktop 一起使用,请将其添加到你的 .claude-app.json
配置文件中:
{
"mcpServers": {
"typescript-analyzer": {
"command": "node",
"args": ["/path/to/typescript-analyzer-mcp/dist/index.js"],
"env": {}
}
}
}
工具
getServerInfo
检索有关分析器服务器的基本信息(名称、版本、描述、功能、配置)。
示例:
Please provide server info
configureServer
在运行时更新服务器配置(日志级别、缓存等)。
参数:
config
: 要与当前配置合并的部分配置对象
示例:
Please update the logLevel to 'debug' for the server
analyzeTypeScriptFile
分析 TypeScript 文件中的 any
类型。
参数:
filePath
: 要分析的 TypeScript 文件的路径skipCache
: (可选) 如果为 true,则强制进行全新分析
示例:
Please analyze the TypeScript file src/components/Button.tsx for any types
fixTypeScriptFile
修复单个 TypeScript 文件中的 any
类型。
参数:
filePath
: 要修复的 TypeScript 文件的路径fixType
: 用于替换的默认类型(默认值:"unknown")dryRun
: 如果为 true,则显示更改而不应用它们skipBackup
: 如果为 true,则在修改之前不创建备份文件
示例:
Please fix the TypeScript file src/components/Button.tsx, using Record<string, unknown> as the default replacement
batchFixTypeScriptFiles
批量修复多个 TypeScript 文件中的 any
类型。
参数:
directory
: 包含 TypeScript 文件的目录pattern
: 用于处理文件的 Glob 模式(例如 "**/*.ts")fixType
: 用于替换的默认类型dryRun
: 如果为 true,则显示更改而不应用它们concurrency
: (可选) 并行处理的文件数
示例:
Please fix all TypeScript files in the src/components directory
generateComponentInterface
为 React 组件 props 生成正确的 TypeScript 接口。
参数:
filePath
: React 组件文件的路径componentName
: 要分析的组件的名称outputPath
: (可选) 保存生成的接口的路径
示例:
Please generate an interface for the Button component in src/components/Button.tsx
clearCache
清除分析缓存,以强制在后续操作中进行全新分析。
示例:
Please clear the analysis cache
类型映射策略
服务器使用一组预定义的映射来处理常见模式:
模式 | 替换 |
---|---|
e: any |
e: React.SyntheticEvent |
event: any |
event: React.SyntheticEvent |
onChange: any |
onChange: (value: unknown) => void |
onClick: any |
onClick: (event: React.MouseEvent<HTMLElement>) => void |
ref: any |
ref: React.RefObject<HTMLElement> |
data: any |
data: Record<string, unknown> |
options: any |
options: Record<string, unknown> |
config: any |
config: Record<string, unknown> |
props: any |
props: Record<string, unknown> |
items: any[] |
items: unknown[] |
results: any[] |
results: unknown[] |
callback: any |
callback: (...args: unknown[]) => unknown |
对于映射未涵盖的模式,默认使用 unknown
。
许可证
MIT
推荐服务器
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
MCP Package Docs Server
促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。
Claude Code MCP
一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。
@kazuph/mcp-taskmanager
用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。
mermaid-mcp-server
一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。
Jira-Context-MCP
MCP 服务器向 AI 编码助手(如 Cursor)提供 Jira 工单信息。

Linear MCP Server
一个模型上下文协议(Model Context Protocol)服务器,它与 Linear 的问题跟踪系统集成,允许大型语言模型(LLM)通过自然语言交互来创建、更新、搜索和评论 Linear 问题。

Sequential Thinking MCP Server
这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。
Curri MCP Server
通过管理文本笔记、提供笔记创建工具以及使用结构化提示生成摘要,从而实现与 Curri API 的交互。