Back to MCP directory
publicPublicdnsLocal runtime

semgrep-mcp-server

一个基于MCP协议的Semgrep服务器,用于集成静态代码分析和规则管理到开发环境。

article

README

🚀 Semgrep 服务器

Semgrep 服务器是一个用于将 Semgrep 集成到开发环境中的模型上下文协议(MCP)服务器。它支持执行静态代码分析并管理 Semgrep 规则,可通过 MCP 协议直接实现,为开发者提供了便捷的代码分析和规则管理能力。

🚀 快速开始

安装

# 克隆仓库
git clone [仓库地址]
cd semgrep-server

# 安装依赖项
npm install

# 构建服务器
npm run build

启动服务器

服务器可以通过以下方式启动:

# 生产模式
npm start

# 开发模式
npm run dev

✨ 主要特性

该服务器提供以下 MCP 工具:

  • scan_directory:在指定目录中执行 Semgrep 扫描
  • list_rules:列出可用的 Semgrep 规则
  • analyze_results:分析扫描结果
  • create_rule:创建新的 Semgrep 规则
  • filter_results:根据不同条件过滤扫描结果
  • export_results:将扫描结果导出为多种格式
  • compare_results:比较两个扫描结果

📚 详细文档

开发

该项目使用 TypeScript 编写,并基于 MCP SDK 实现服务器。

项目结构

semgrep-server/
├── src/           # 源代码
├── build/         # 编译后的 JavaScript 文件
├── test.js        # 测试文件
└── test-rule.yaml # 示例 Semgrep 规则

依赖项

  • Node.js & npm
  • TypeScript
  • MCP SDK
  • Axios 用于 HTTP 请求

📄 许可证

该项目采用 ISC 许可证。更多详细信息请参阅 LICENSE 文件。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client