代码分析器MCP服务器
此MCP服务器提供工具来分析前端和后端代码中的错误、错误和功能问题,并提供修复选项。
特性
- 使用ESLint分析JavaScript/TypeScript代码
- 使用HTMLHint分析HTML代码
- 使用Stylelint分析CSS代码
- 使用Pyright分析Python代码
- 在可能的情况下自动修复问题
- 获取解决已识别问题的建议
可用工具
1.分析代码
分析代码中的bug、错误和功能问题。
参数:
path(必填):要分析的文件或目录的路径language(可选):代码语言(如果未提供,则自动检测)
- 选项:“javascript”、“typescript”、“html”、“css”、“python”、“auto”
fix(可选):是否在可能的情况下自动修复问题(默认值:false)
例子:
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.js",
language: "javascript",
fix: true
}
});2.固定问题
修复了代码中发现的问题。
参数:
path(必需):要修复的文件的路径issueIds(必填):要修复的问题ID数组(来自analyze_code结果)
例子:
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "fix_issues",
arguments: {
path: "/path/to/your/file.js",
issueIds: ["js-/path/to/your/file.js-0", "js-/path/to/your/file.js-1"]
}
});3.get_fix_建议
获取修复已识别问题的建议。
参数:
path(必填):有问题的文件的路径issueId(必填):获取建议的问题ID
例子:
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "get_fix_suggestions",
arguments: {
path: "/path/to/your/file.js",
issueId: "js-/path/to/your/file.js-0"
}
});使用示例
分析JavaScript代码
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.js"
}
});分析和自动修复JavaScript代码
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.js",
fix: true
}
});分析HTML代码
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.html",
language: "html"
}
});分析CSS代码
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.css",
language: "css"
}
});分析Python代码
use_mcp_tool({
server_name: "code-analyzer-server",
tool_name: "analyze_code",
arguments: {
path: "/path/to/your/file.py",
language: "python"
}
});安装
服务器已在MCP设置中安装和配置。要使用它,只需重新启动VSCode或Claude应用程序即可加载新的MCP服务器。
