Token导航 LogoToken导航TokenDH.com
Code Auditor MCP logo
开发工具stdio官方级别未说明来源级核验

Code Auditor MCP

MCP Server

code-audit

Code Auditor是一款AI驱动的多语言代码智能分析工具,能够索引和分析代码库,提供实时分析并与AI助手集成,帮助开发者编写更好的代码。

工具数

1

提示词数

0

GitHub Stars

6

资源数

0
代码分析TypeScriptClaude代码质量ClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

BenAHammond

提供方

BenAHammond

最后核验

2026/5/17 20:21

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx code-audit

详细介绍

代码审计:基于人工智能的多语言代码智能

你的AI能够跨语言理解你的代码。 Code Auditor为你的整个代码库(TypeScript、JavaScript和Go)建立索引,并提供实时分析,像Claude这样的人工智能助手实际上可以用来帮助你编写更好的代码。

它解决的问题

AI编码助手功能强大,但它们是盲目的。他们无法搜索你的代码库,不知道你的模式,也无法错过关键的上下文。Code Auditor通过为代码中的每个函数、组件和模式创建可搜索的索引来改变这一点。

运作原理

  1. 索引 -自动编目函数、React组件、Go结构和依赖项
  2. 分析 -检测跨多种语言的SOLID违规、代码重复和安全问题
  3. 连接 -AI助手通过MCP(模型上下文协议)访问您的代码索引
  4. 迭代 -根据您的实际代码库模式获取智能建议

快速入门(2分钟)

# Add to your project with Claude Code CLI
claude mcp add code-auditor -- npx code-auditor-mcp

# That's it! Now ask Claude:
# "What authentication functions exist in my codebase?"
# "Find all API endpoints and check for rate limiting"
# "Show me Go structs that handle user data"
# "Compare TypeScript and Go implementations of the same feature"

重要的核心功能

🔍 多语言代码搜索

"Find all functions that validate user input"
"Show me where we're calling the payment API"
"What Go structs implement the User interface?"
"Compare error handling patterns between TypeScript and Go"

🎯 智能代码分析

  • 坚实的原则 -在架构问题传播之前抓住它们
  • DRY违规 -查找应重构的重复代码
  • 安全模式 -验证身份验证、速率限制、SQL注入保护
  • 死代码 -识别未使用的导入和功能

🤖 AI工具集成

自动生成以下配置:

  • 克劳德(通过MCP)
  • 光标
  • 继续
  • GitHub Copilot
  • 10+其他AI助手

⚙️ 持久配置

设置一次分析器首选项:

You: "Set SOLID analyzer to allow 3 responsibilities for components"
Claude: Configuration saved! All future audits will use this setting.

📋 项目任务队列(MCP)

使用 project_tasks 工具,用于在本地数据库中保存每个项目的任务列表(标题、状态、优先级、截止日期、阻止程序、相关文件/符号等)。 任务存活 sync_index 重置:清除分析索引会删除索引函数、缓存审计、代码映射和模式覆盖,这样就不会保留对已删除代码的“幽灵”引用——确实如此 删除任务列表或分析器配置。

真实案例

示例1:查找身份验证模式

You: "Show me all authentication-related functions"
Claude: Found 23 functions across 8 files:
- `validateToken()` in auth/tokens.ts:45
- `requireAuth()` in middleware/auth.ts:12
- `checkPermissions()` in auth/permissions.ts:78
...

示例2:分析代码质量

You: "Audit the user service for issues"
Claude: Found 3 critical issues:
- Single Responsibility violation: UserService handles both auth and profile updates
- SQL injection risk: Raw query in getUserByEmail() at line 234
- Missing rate limiting on password reset endpoint

示例3:发现模式

You: "Find React components similar to DataTable"
Claude: Found 4 similar components:
- `UserTable` - extends DataTable with user-specific columns
- `OrderGrid` - implements similar pagination pattern
- `ProductList` - uses same filtering approach

安装选项

已发布的包(npm/pnpm/yarn)

npm install -g code-auditor-mcp
# or: pnpm add -g code-auditor-mcp
code-audit  # Run analysis

项目安装

npm install --save-dev code-auditor-mcp
npx code-audit

从该存储库开发

需要 Node.js 18+.从 app/ 目录:

pnpm install
pnpm run build
pnpm test

正在使用的包管理器是 pnpm (参见 packageManagerpackage.json).使用 pnpm run test:parity 仅当您需要传统与通用分析器奇偶校验套件时。

CI/CD集成

# GitHub Actions
- name: Code Audit
  run: npx code-audit --fail-on-critical

MCP服务器:存储索引的位置

Loki索引文件默认为 /.code-index/index.db。如果您的MCP主机在意外或共享的情况下运行 cwd,指向专用文件夹:

  • 环境变量 CODE_AUDITOR_DATA_DIR --用作存储根的目录(服务器启动时相对于进程cwd的绝对或相对目录)。数据库文件是 /index.db (无额外费用 .code-index 分段)。
  • 命令行界面node dist/mcp-index.js --data-dir /path/to/data (相当于设置env变量)。已发布的二进制文件 code-auditor-mcp 也接受 --data-dir 因为它加载了相同的引导程序。

示例 光标 .cursor/mcp.json 片段:

{
  "mcpServers": {
    "code-auditor": {
      "command": "node",
      "args": ["/absolute/path/to/code-auditor/app/dist/mcp-index.js", "--stdio"],
      "env": {
        "CODE_AUDITOR_DATA_DIR": "/Users/you/Library/Application Support/code-auditor"
      }
    }
  }
}

关键命令

code-audit                    # Full analysis with HTML report
code-audit -f json           # JSON output for CI/CD
code-audit -a solid,dry      # Run specific analyzers
code-audit --health          # Quick health score (0-100)

反馈循环

  1. 写入代码 → 代码审计员会自动为其建立索引
  2. 问AI → “是否有验证电子邮件的功能?”
  3. 获取上下文 → AI发现 validateEmail() 以及类似的模式
  4. 改进 → 人工智能建议使用现有的验证,而不是复制
  5. 重复 → 你的AI对你的代码库越来越聪明

配置

为您的架构设置自定义阈值:

// Via MCP
mcp.set_analyzer_config({
  analyzerName: "solid",
  config: {
    maxUnrelatedResponsibilities: 4,
    patternThresholds: {
      "Dashboard": { maxResponsibilities: 6 }
    }
  }
});

高级搜索运算符

您想要什么搜索查询
功能复杂complexity:>10
仅Go功能lang:go
TypeScript组件lang:typescript component:functional
无证出口exported:true jsdoc:false
React钩子的使用component:functional hook:useState
Go结构体方法lang:go entity:struct
查找依赖关系calls:validateUser
跨语言模式name:validateEmail
未使用的进口unused-imports file:src

演出

  • 秒内索引10000+个函数
  • 文件更改的增量更新
  • LokiJS用于快速内存搜索
  • FlexSearch用于智能查询

贡献

贡献.md 作为指导方针。

许可证

麻省理工学院-随时随地使用它。

______________________________________________________________________

准备好将你的AI x射线视觉输入到你的代码中了吗?

claude mcp add code-auditor -- npx code-auditor-mcp

目录标签

目录标签

代码分析TypeScriptClaude代码质量本地部署多语言支持AI集成安全检测

支持客户端

ClaudeCursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

code-audit

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP