# MCP Security Audit & PR Gate: Claude Code & Cursor

> Audit MCP configuration in Claude Code, Cursor and GitHub Actions: find plaintext secrets, stop a repository approving its own servers, and add a pull-request gate that blocks unsafe MCP and unpinned action changes.

MCP Security Audit & PR Gate: Claude Code & Cursor is a paid AI agent skill on Agensi by luckystore1, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [luckystore1](https://www.agensi.io/creators/luckystore1)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-12-05
- Security: scan passed (2026-12-05); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/mcp-security-audit-pr-gate-claude-code-cursor
- Tags: security, devops, code-review, mcp, mcp-security, claude-code, cursor

## What it does

- Find plaintext secrets in MCP configs and settings files and point to the exact line
- Replace them with ${VAR} (Claude Code) or ${env:NAME} (Cursor), after rotating the exposed key
- Stop a repository approving its own MCP servers with disabledMcpjsonServers and --strict-mcp-config
- Add a read-only GitHub Actions gate that blocks unsafe MCP, settings and unpinned action changes
- Explain every check against documented CVEs and OWASP Secure Coding with AI controls

## Who it's for

- **DevOps engineers rolling out Claude Code or Cursor:** A one-pass audit that finds committed tokens and auto-approved servers before the rollout, plus a gate that keeps them out afterwards Try: "Audit this repo's MCP configuration and tell me what to fix before we turn Claude Code on for the team"
- **Security engineers reviewing AI agent setup:** A findings table with file, line and fix, and every check traced to a CVE or an OWASP control Try: "Review our .claude and .cursor config for the patterns in CVE-2025-54135 and CVE-2026-47751"
- **Maintainers running claude-code-action in CI:** Pinned-action checks, the fork-PR gap closed, and a gate that refuses secret-bearing or unpinned config Try: "Check our agent workflow for unpinned actions and add the MCP pull-request gate"

## About this skill

MCP servers are configuration that runs code. A .mcp.json, a .cursor/mcp.json or a .claude/settings.json entry names the command that starts on a developer's laptop and on your CI runner, with that machine's permissions and secrets. Those files live in the repository, so a pull request can change them: a new server, a new hook, a token pasted into a header, or an action tag that quietly moves.

This pack is the audit and the guard rail around that.

What it does
1. Inventories every MCP and agent configuration file in the repository and shows what runs, and with which secrets.
2. Finds plaintext credentials in env values, headers, URLs and arguments, and migrates them to ${VAR} (Claude Code) or ${env:NAME} (Cursor) - after telling you to rotate the exposed key first, because deleting a line does not delete a secret from git history.
3. Hardens the approval path: enableAllProjectMcpServers false, approval by name only, and every unreviewed server in disabledMcpjsonServers, which rejects it in every permission mode and in headless runs where no prompt can appear.
4. Adds a pull-request gate that runs with only contents: read and pull-requests: read, never checks out the PR, and blocks a literal credential, an ANTHROPIC_BASE_URL override, an auto-approve switch, an unpinned uses: line and a pull_request_target checkout of the PR head. Hooks, unpinned npx packages and edits to CLAUDE.md are flagged for the reviewer.
5. Ships CODEOWNERS rules so a named owner reviews .mcp.json, .claude/, .cursor/ and .github/workflows/.

### Why not just prompt the agent

A prompt can produce a plausible audit of one repository today. It will not run the same checks next week, will not fail a build, and will not leave anything behind. This is the checklist, the settings file and the CI job that survive after the chat closes.
### Grounded in documented incidents

- CVE-2025-54135 (CurXecute) and CVE-2025-54136 (MCPoison): Cursor's name-bound MCP trust, fixed in 1.3.9 and 1.3.
- CVE-2025-59536: Claude Code running project configuration before the startup trust dialog, fixed in 1.0.111.
- CVE-2026-47751: claude-code-action reading .mcp.json from a pull request, fixed in 1.0.74.
- OWASP Secure Coding with AI, section 4 (MCP and tool security) and section 11 (CI/CD agents and confused-deputy risk).

Every check in the reference names the version it was checked against and links the advisory.

### What it will not do

It is not a sandbox, and not a scanner that proves safety. A secret with no recognisable shape, a base64 payload or an instruction written in prose in CLAUDE.md passes every check. A clean run means nothing matched, not that the repository is safe.
### Why it reads environment variables

Env vars are read, never collected. The gate workflow uses only the runner's own GH_TOKEN, GITHUB_REPOSITORY, the PR number, the head SHA and GITHUB_STEP_SUMMARY: it reads the pull request through the GitHub API and writes the step summary, with no checkout of the PR and no secret of its own. The audit reads variable names inside config `env` blocks so it can tell a pasted secret from a `${VAR}` reference, and it redacts any value it finds. Nothing is uploaded.

### Related skills

- [MutantGate: Diff Mutation Testing for PRs](https://www.agensi.io/skills/mutantgate-diff-mutation-testing-for-prs) (free) - mutation-tests only the lines a PR changed and returns the survivors. The scan this pack builds on.
- [MutantGate Survivor Pack: Test-Gen Prompts & PR Gate Kit](https://www.agensi.io/skills/mutantgate-survivor-pack-test-gen-prompts-pr-gate-kit) ($12) - template pack that turns those survivors into tests, with a GitHub Actions gate workflow and a monorepo preset.

## Requires

- Python 3 (on the GitHub Actions runner)
- GitHub CLI (gh, on the runner)
- ripgrep (rg, for local audits)

Env vars are read, never collected: the workflow uses the runner's GH_TOKEN, GITHUB_REPOSITORY, PR number, head SHA and GITHUB_STEP_SUMMARY to read the PR and write the summary. The audit reads names in config env blocks to spot pasted secrets; it prints no value and uploads nothing.

## Technical details

Files: SKILL.md, workflows/mcp-config-pr-gate.yml, templates/CODEOWNERS.mcp, templates/claude-strict-mcp.json, templates/cursor-mcp-hardened.json, templates/settings-hardened.json, references/cve-and-owasp-checklist.md, examples/audit-report-example.md.

Reads: .mcp.json, .claude.json, .claude/settings.json, .claude/settings.local.json, .claude/, .cursor/mcp.json, CLAUDE.md, AGENTS.md, .github/workflows/*.yml.

Uses: Claude Code settings keys disabledMcpjsonServers, enabledMcpjsonServers and enableAllProjectMcpServers; claude --strict-mcp-config --mcp-config; Cursor ${env:NAME} interpolation; GitHub Actions with contents: read and pull-requests: read only.

The gate is one workflow with an embedded Python 3 script (standard library only). It calls the GitHub REST API through the gh CLI already installed on GitHub-hosted runners: no checkout, no third-party action, no npm install, no secret of its own.

Setup: copy the workflow, merge the CODEOWNERS rules, make the check required, copy the hardened settings, and pin anthropics/claude-code-action to a commit SHA.

Versions checked: Claude Code 1.0.111+, Cursor 1.3.9+ (1.3+ for CVE-2025-54136), claude-code-action 1.0.74+, python3 and gh on the runner, ripgrep locally.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the MCP Security Audit & PR Gate: Claude Code & Cursor skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does MCP Security Audit & PR Gate: Claude Code & Cursor do?

Audit MCP configuration in Claude Code, Cursor and GitHub Actions: find plaintext secrets, stop a repository approving its own servers, and add a pull-request gate that blocks unsafe MCP and unpinned action changes.

### Which AI agents support MCP Security Audit & PR Gate: Claude Code & Cursor?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use MCP Security Audit & PR Gate: Claude Code & Cursor?

Connect your AI agent to Agensi through MCP, then ask it to use MCP Security Audit & PR Gate: Claude Code & Cursor on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
