security-mcp
Security MCP 设置
此设置将 security-mcp 服务器连接到 AI 编码工具,使代理能够获取当前仓库的 GitHub Code Scanning 警报并应用本地补丁。
支持的客户端:
Claude Code — 通过
claude mcp add的 MCP,通过.claude/commands/fix-vuls.md的斜杠命令Cursor — 通过设置的 MCP,通过
.cursor/skills/fix-vuls/SKILL.md的技能GitHub Copilot CLI — 通过
copilot mcp add或.github/mcp.json的 MCP,通过.github/skills/fix-vuls/SKILL.md的技能IntelliJ IDEA(GitHub Copilot 插件) — 通过 Copilot Chat Agent 模式小部件的 MCP,通过
.github/skills/fix-vuls/SKILL.md的技能
/fix-vuls 技能运行一个修复循环:
/fix-vuls
→ fetch open GitHub Code Scanning alerts
→ triage and classify each alert
→ research CVEs (Spring Boot BOM first for dependency alerts)
→ apply minimal local patches
→ validate with build and tests
→ re-check alerts and repeat until done or blocked除非你明确要求,否则代理不会提交、推送或打开 PR。完整的技能提示位于此仓库的 fix-vuls.md 中。
用于获取警报的 GitHub 令牌从你正在修复的仓库内部(你在 IDE 或 CLI 中打开的组织仓库)的 .env 文件中读取——它永远不会通过命令行传递或提交到源代码控制。你也可以在客户端支持的 MCP 服务器 env 配置中设置 GITHUB_TOKEN。
1. 克隆并安装依赖项
在连接 MCP 服务器之前,克隆此仓库并安装 Node.js 依赖项:
git clone https://github.com/P-Shreyas-Maersk/security-mcp.git
cd security-mcp
npm install在以下步骤中注册 MCP 服务器时,请使用此文件夹的绝对路径。
Related MCP server: osv-ui-mcp
2. 添加包含 GitHub 令牌的 .env 文件
GitHub 令牌不作为 CLI 标志传递。相反,在你想要扫描的组织仓库内部(而不是 security-mcp 服务器文件夹)创建一个 .env 文件。
对于当前的 v1,令牌只需要访问读取安全/代码扫描警报的权限。
macOS:
cd your-org-repo
echo "GITHUB_TOKEN=YOUR_GITHUB_TOKEN" > .envWindows(PowerShell):
cd your-org-repo
"GITHUB_TOKEN=YOUR_GITHUB_TOKEN" | Out-File -Encoding utf8 .envWindows(命令提示符):
cd your-org-repo
echo GITHUB_TOKEN=YOUR_GITHUB_TOKEN > .env将 YOUR_GITHUB_TOKEN 替换为具有读取 Code Scanning 警报权限的 GitHub 令牌。
⚠️ 将
.env添加到.gitignore中,以确保令牌永远不会被提交。
3. Claude Code — 连接 MCP
从同一个仓库文件夹中,添加 MCP 服务器(不需要令牌标志——security-mcp 在运行时从 .env 读取):
macOS:
claude mcp add security-mcp -- node /absolute/path/to/security-mcp/server.js示例:
claude mcp add security-mcp -- node /Users/p.shreyas/workplace/experiment/code-vuls/security-mcp/server.jsWindows(PowerShell / 命令提示符):
claude mcp add security-mcp -- node C:\absolute\path\to\security-mcp\server.js示例:
claude mcp add security-mcp -- node C:\Users\shreyas\workplace\experiment\code-vuls\security-mcp\server.js4. 验证 MCP 连接
运行:
claude mcp list预期输出:
security-mcp ✓ Connected如果服务器未连接,请重启 Claude Code 并验证 MCP 路径和 .env 文件。
5. 在目标仓库中打开 Claude Code
进入你的组织仓库(包含 .env 文件的同一文件夹):
macOS:
cd your-org-repo
claude示例:
cd /Users/p.shreyas/workplace/vas-experience-api
claudeWindows(PowerShell / 命令提示符):
cd your-org-repo
claude示例:
cd C:\Users\shreyas\workplace\vas-experience-api
claude6. 手动测试 MCP
在 Claude Code 内部,运行此提示:
Use the security-mcp tool to list open code scanning alerts for this current GitHub repo. Detect owner and repo from git remote.预期结果:
Found open code scanning alerts:
- java/sql-injection ...
- java/path-injection ...
- java/log-injection ...如果你看到此错误:
Missing GITHUB_TOKEN in environment请检查以下内容:
在你运行
claude的仓库文件夹(而不是security-mcp服务器文件夹)中存在.env文件。.env文件包含一行完全如GITHUB_TOKEN=YOUR_GITHUB_TOKEN的内容,没有引号或多余空格。你在创建或编辑
.env后重启了 Claude Code(claude)。
如果需要,移除并重新添加 MCP:
macOS:
claude mcp remove security-mcp
claude mcp add security-mcp -- node /absolute/path/to/security-mcp/server.jsWindows:
claude mcp remove security-mcp
claude mcp add security-mcp -- node C:\absolute\path\to\security-mcp\server.js然后重启 Claude Code。
7. 安装 fix-vuls 技能
此仓库在 fix-vuls.md 中提供了技能提示。不要手动复制内容——将该文件复制或移动到目标仓库和工具的技能或斜杠命令文件夹中。
Claude Code 斜杠命令 — 复制到你扫描的仓库中:
macOS:
mkdir -p your-org-repo/.claude/commands
cp /absolute/path/to/security-mcp/fix-vuls.md your-org-repo/.claude/commands/fix-vuls.mdWindows(PowerShell):
New-Item -ItemType Directory -Force your-org-repo\.claude\commands
Copy-Item C:\absolute\path\to\security-mcp\fix-vuls.md your-org-repo\.claude\commands\fix-vuls.mdCursor 项目技能 — 复制到你扫描的仓库中:
macOS:
mkdir -p your-org-repo/.cursor/skills/fix-vuls
cp /absolute/path/to/security-mcp/fix-vuls.md your-org-repo/.cursor/skills/fix-vuls/SKILL.mdWindows(PowerShell):
New-Item -ItemType Directory -Force your-org-repo\.cursor\skills\fix-vuls
Copy-Item C:\absolute\path\to\security-mcp\fix-vuls.md your-org-repo\.cursor\skills\fix-vuls\SKILL.mdGitHub Copilot 技能 — 作为 SKILL.md 复制到你扫描的仓库中(Copilot 需要 YAML 前置元数据;请参见第 11 节或第 13 节):
macOS:
mkdir -p your-org-repo/.github/skills/fix-vuls
cp /absolute/path/to/security-mcp/fix-vuls.md your-org-repo/.github/skills/fix-vuls/SKILL.mdWindows(PowerShell):
New-Item -ItemType Directory -Force your-org-repo\.github\skills\fix-vuls
Copy-Item C:\absolute\path\to\security-mcp\fix-vuls.md your-org-repo\.github\skills\fix-vuls\SKILL.md然后将第 11 或 13 节中显示的 YAML 前置元数据添加到 SKILL.md 的顶部。
将 /absolute/path/to/security-mcp 替换为你克隆此仓库的路径,并将 your-org-repo 替换为你想要修复的仓库。
当此处的技能更新时,重新将 fix-vuls.md 复制到你的目标文件夹以获取更改。
8. Claude Code — 运行命令
在 Claude Code 内部:
/fix-vuls预期的最终行为:
Remediation complete after 2 cycles.
Fixed:
- Alert #4 (java/sql-injection) — src/main/java/.../Repository.java
- Alert #7 (CVE-2024-XXXX) — root pom.xml Spring Boot 3.2.x → 3.2.y
Fixed locally, pending GitHub rescan:
- Alert #9 (java/path-injection) — green build; push and wait for CodeQL rescan
Blocked:
- Alert #12 — generated code; cannot patch locally
Build: mvn -B test — SUCCESS
No commit, push, or PR was performed.9. 开发者审查
修复循环完成后,查看摘要和本地差异:
git diffClaude 在循环期间运行构建和测试,但在提交前请在你的环境中确认结果。
如果更改看起来没问题,使用你团队的正常工作流程创建分支、提交、推送并打开 PR。GitHub Code Scanning 警报将在推送和 CodeQL 重新扫描后更新。
10. GitHub Copilot CLI — MCP 服务器
先决条件:
已安装并登录 GitHub Copilot CLI
在你想要扫描的组织仓库(包含
.env文件的文件夹)中打开终端
选项 A — 使用 copilot mcp add 全局注册
macOS:
copilot mcp add security-mcp -- node /absolute/path/to/security-mcp/server.jsWindows(PowerShell / 命令提示符):
copilot mcp add security-mcp -- node C:\absolute\path\to\security-mcp\server.js如果 MCP 进程无法读取你的目标仓库 .env,请显式传递令牌:
macOS:
copilot mcp add security-mcp -e GITHUB_TOKEN=YOUR_GITHUB_TOKEN -- node /absolute/path/to/security-mcp/server.jsWindows(PowerShell):
copilot mcp add security-mcp -e GITHUB_TOKEN=YOUR_GITHUB_TOKEN -- node C:\absolute\path\to\security-mcp\server.js验证:
copilot mcp list
copilot mcp get security-mcp选项 B — 在组织仓库中提交项目 MCP 配置
在你扫描的仓库中添加 .github/mcp.json,以便协作者获得相同的设置:
macOS 示例(your-org-repo/.github/mcp.json):
{
"mcpServers": {
"security-mcp": {
"type": "local",
"command": "node",
"args": ["/Users/you/workplace/projects/security-mcp/server.js"],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN"
},
"tools": ["*"]
}
}
}Windows 示例(your-org-repo\.github\mcp.json):
{
"mcpServers": {
"security-mcp": {
"type": "local",
"command": "node",
"args": ["C:\\Users\\you\\workplace\\projects\\security-mcp\\server.js"],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN"
},
"tools": ["*"]
}
}
}从组织仓库根目录启动 Copilot CLI。首次使用时,在提示时确认文件夹信任,以便加载项目 MCP 服务器。
在交互式会话中,你也可以运行 /mcp add,选择 STDIO,然后输入 node /absolute/path/to/security-mcp/server.js。
11. GitHub Copilot CLI — fix-vuls 技能
GitHub Copilot 技能必须位于以技能命名的文件夹中,并使用名为 SKILL.md 且带有 YAML 前置元数据的文件。
将
fix-vuls.md复制到你的组织仓库中:
macOS:
mkdir -p your-org-repo/.github/skills/fix-vuls
cp /absolute/path/to/security-mcp/fix-vuls.md your-org-repo/.github/skills/fix-vuls/SKILL.mdWindows(PowerShell):
New-Item -ItemType Directory -Force your-org-repo\.github\skills\fix-vuls
Copy-Item C:\absolute\path\to\security-mcp\fix-vuls.md your-org-repo\.github\skills\fix-vuls\SKILL.md在
SKILL.md的最顶部添加此前置元数据块:
---
name: fix-vuls
description: Fetch open GitHub code scanning alerts, apply minimal local fixes, validate with build/tests, and loop until alerts are resolved or blocked. Use when asked to fix vulnerabilities, code scanning alerts, CVEs, or /fix-vuls.
---在组织仓库中启动 Copilot CLI 并重新加载技能:
cd your-org-repo
copilot/skills reload
/skills list运行修复:
Use the /fix-vuls skill to fetch open code scanning alerts for this repo and fix them locally.12. IntelliJ IDEA — MCP 服务器(Copilot 小部件)
先决条件:
安装了最新 GitHub Copilot 插件的 IntelliJ IDEA
在 Copilot Chat 中启用了 Agent 模式(MCP 工具在 Agent 模式下可用)
组织仓库作为 IntelliJ 项目打开(包含
.env文件的文件夹)如果你的组织使用 Copilot Business/Enterprise,则必须启用 Copilot 中的 MCP 服务器策略
通过 Copilot Chat 小部件配置
在 IntelliJ IDEA 中打开你的组织仓库。
点击状态栏(右下角)中的 GitHub Copilot 图标。
选择 打开聊天。
在聊天面板中,将模式下拉菜单切换到 Agent。
点击聊天面板底部的工具图标(配置你的 MCP 服务器)。
点击 添加 MCP 工具(或 添加更多工具...)。
在
mcp.json编辑器中,添加下面的security-mcp服务器条目。使用 Command + S(macOS)或 Ctrl + S(Windows)保存文件。如果工具没有立即出现,请重启 IDE。
再次点击工具图标,确认
list_code_scanning_alerts列在security-mcp下。
替代方法 — 从状态栏打开 MCP 设置
点击状态栏中的 GitHub Copilot 图标。
选择 编辑设置。
打开 模型上下文协议 → 配置。
使用下面的相同服务器条目编辑
mcp.json并保存。
security-mcp 的 mcp.json 条目
macOS:
{
"servers": {
"security-mcp": {
"command": "node",
"args": ["/Users/you/workplace/projects/security-mcp/server.js"],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN"
}
}
}
}Windows:
{
"servers": {
"security-mcp": {
"command": "node",
"args": ["C:\\Users\\you\\workplace\\projects\\security-mcp\\server.js"],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN"
}
}
}
}将 args 路径替换为你克隆的 security-mcp 文件夹。如果打开的 IntelliJ 项目中存在 .env,你可以省略 env,让 dotenv 从项目根目录加载 GITHUB_TOKEN。
在 Agent 模式下测试
在 Copilot Chat(Agent 模式)中,运行:
Use the security-mcp tool to list open code scanning alerts for this current GitHub repo. Detect owner and repo from git remote.13. IntelliJ IDEA — fix-vuls 技能
IntelliJ Agent 模式使用与 Copilot CLI 相同的 Agent Skills 布局。
将
fix-vuls.md复制到你的组织仓库中:
macOS:
mkdir -p your-org-repo/.github/skills/fix-vuls
cp /absolute/path/to/security-mcp/fix-vuls.md your-org-repo/.github/skills/fix-vuls/SKILL.mdWindows(PowerShell):
New-Item -ItemType Directory -Force your-org-repo\.github\skills\fix-vuls
Copy-Item C:\absolute\path\to\security-mcp\fix-vuls.md your-org-repo\.github\skills\fix-vuls\SKILL.md在
SKILL.md顶部添加 YAML 前置元数据(与第 11 节相同):
---
name: fix-vuls
description: Fetch open GitHub code scanning alerts, apply minimal local fixes, validate with build/tests, and loop until alerts are resolved or blocked. Use when asked to fix vulnerabilities, code scanning alerts, CVEs, or /fix-vuls.
---如果技能没有立即出现,请重新打开项目或重启 IntelliJ。
在 Copilot Chat(Agent 模式)中,运行:
Use the /fix-vuls skill to fetch open code scanning alerts for this repo and fix them locally.当此仓库中的 fix-vuls.md 更新时,重新将其复制到组织仓库中的 .github/skills/fix-vuls/SKILL.md(保留前置元数据块)。
最终生命周期
Developer runs /fix-vuls (Claude Code, Cursor, or Copilot Agent mode)
↓
Agent detects GitHub repo
↓
Security MCP fetches Code Scanning alerts
↓
Agent triages, researches CVEs, patches, and validates (loop)
↓
Agent reports summary (fixed / blocked / pending rescan)
↓
Developer reviews diff, commits, pushes, and raises PR manuallyThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
Alicense-quality-maintenanceProvides tools for autonomous CVE detection, enrichment, and remediation across managed repositories using GHSA and NVD data. It enables automated triage and pull request creation for dependency fixes based on configurable severity policies.- AlicenseAqualityCmaintenanceVisual CVE audit dashboard for npm, Python, Go, and Rust projects. Scans your project manifests (package-lock.json, requirements.txt, go.sum, Cargo.lock) against OSV.dev live data, opens a browser dashboard for human review, then applies fixes only after explicit confirmation. Supports multi-service monorepos in one command.4354MIT
- Flicense-qualityCmaintenanceScans Python, Node.js, Java/Spring, and PHP dependency manifests for known vulnerabilities using OSV and GitHub Advisory APIs.
- AlicenseAqualityAmaintenanceLocal-only GitHub Actions and CI maintenance scanner for AI-built apps. Exposes scan, explanation, and fix-planning tools to MCP clients; modifies nothing and makes no outbound requests by default.3632MIT
Related MCP Connectors
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/P-Shreyas-Maersk/security-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server