Scans AI-generated code snippets or diffs for security vulnerabilities like injection, hardcoded secrets, and unsafe deserialization.
Also known as mlawsonking/MCP, @mlawsonking/code-guard-mcp
- Stars
- 1
- Tools
- 3
- Downloads, 30 days
- —
- Latest version
- 1.3.0
- Last commit
- Nov 15, 2026
- License
- MIT
What is Code Guard MCP?
Code Guard scans AI-generated code snippets or diffs for security vulnerabilities like injection, hardcoded secrets, and unsafe deserialization. It exposes 3 tools, such as scan_code, scan_diff, list_rules.
Summary generated from the project's README
About Code Guard MCP server
Scanning AI-generated code snippets or diffs for security vulnerabilities is the primary function of this tool. It acts as a fast first pass for coding agents to check their work for issues like injection, hardcoded secrets, and unsafe deserialization before code is committed or executed. The server uses rule-based regex matching rather than a full static analysis parser, making it a lightweight way to catch common mistakes in JS/TS and Python.
Developers can integrate this into clients like Claude Desktop, Cursor, or Claude Code by adding it to their MCP configuration using npx. It provides three specific tools: scan_code for individual snippets, scan_diff for analyzing added lines in a unified diff, and list_rules to view the 32 available rule entries. While it lacks data flow or taint tracking, it can identify SSRF, weak crypto, disabled TLS verification, and personal data like US SSNs or credit card numbers.
Because it relies on regex, the server processes text line by line, though the hardcoded-credential patterns are an exception that run over the entire source. It automatically checks for rule updates once a day via a signed feed to ensure the latest security patterns are applied without compromising user privacy.
What you can do with it
- 1Verify AI code snippetsAsk the agent to scan a newly generated Python function for security flaws before running it.
- 2Detect hardcoded credentialsIdentify if any private keys or API keys were accidentally included in the source code.
Written from the project's README. Every use case is checked against a quote from it.
How to install Code Guard MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall Code Guard MCP in Claude Code
$ claude mcp add code-guard-mcp -- npx -y @mlawsonking/code-guard-mcpInstall Code Guard MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"code-guard-mcp": {
"command": "npx",
"args": [
"-y",
"@mlawsonking/code-guard-mcp"
]
}
}
}Install Code Guard MCP in VS Code
.vscode/mcp.json
{
"servers": {
"code-guard-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@mlawsonking/code-guard-mcp"
]
}
}
}Install Code Guard MCP in VS Code CLI
$ code --add-mcp '{"name":"code-guard-mcp","type":"stdio","command":"npx","args":["-y","@mlawsonking/code-guard-mcp"]}'Install Code Guard MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"code-guard-mcp": {
"command": "npx",
"args": [
"-y",
"@mlawsonking/code-guard-mcp"
]
}
}
}Install Code Guard MCP in Codex
$ codex mcp add code-guard-mcp -- npx -y @mlawsonking/code-guard-mcpInstall Code Guard MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.code-guard-mcp] command = "npx" args = ["-y", "@mlawsonking/code-guard-mcp"]
Install Code Guard MCP in Gemini CLI
$ gemini mcp add -s user code-guard-mcp npx -- -y @mlawsonking/code-guard-mcpInstall Code Guard MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"code-guard-mcp": {
"command": "npx",
"args": [
"-y",
"@mlawsonking/code-guard-mcp"
]
}
}
}Code Guard MCP tools 3
Detected from the READMEscan_codescan_difflist_rules
| scan_code | — | |
| scan_diff | — | |
| list_rules | — |
Automated checks
Ran Nov 13, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablemlawsonking/mcp is public and reachablegithub.com/mlawsonking/mcp ↗Pass
- Package names this repository as its source@mlawsonking/code-guard-mcp names mlawsonking/mcp as sourcenpmjs.com/package/@mlawsonking/code-guard-mcp ↗Pass
- Build provenance (Sigstore attestation)No build attestation published for this releaseNot checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-12github.com/mlawsonking/mcp ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from @mlawsonking/code-guard-mcpPass
- No critical advisory in the package or its dependencies99 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model3 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubcode-guard-mcp
An MCP server that scans code for security bugs. A coding agent calls it on the code or diff it just produced, before committing or running it. Rule-based, no LLM, free.
More than half of new code is AI-assisted now, and a fair amount of it ships with the usual problems: injection, hardcoded secrets, disabled TLS checks, unsafe deserialization. This catches the common cases in one call. Treat it as a fast first pass, not a substitute for a real security review.
Install
Add it to your MCP client config (Claude Desktop, Cursor, Claude Code, and so on):
{ "mcpServers": { "code-guard": { "command": "npx", "args": ["-y", "@mlawsonking/code-guard-mcp"] } } }
Tools
scan_code: scan a snippet. Returns a verdict (pass, review, or block) and a list of findings, each with the rule, category, severity, line number, and a suggested fix. Covers command, code, and SQL injection, SSRF, hardcoded secrets and API keys, weak crypto, unsafe deserialization (pickle, yaml), disabled TLS verification, XSS or template injection, and personal data left in source (email, US SSN, card number).scan_diff: the same scan, but only on the added lines of a unified diff, with correct new-file line numbers. Useful inside a commit loop. It only reads added lines, so a pattern spanning an added line and an untouched one is not seen.list_rules: the full rule catalog, so you can see what it checks and what it doesn't. 32 entries: the 31 code rules, plus one groupedhardcoded-*entry covering 22 credential patterns and 3 personal-data patterns.
Languages
JS/TS and Python. That is the whole list. 11 rules are JS/TS, 14 are Python, 6 are language-agnostic. There is no Go, Ruby, PHP, Java or Rust ruleset. A language value it doesn't recognise is ignored and the language is sniffed from the source instead, which returns one of three answers: js, py or unknown. Which one depends on what the file happens to contain. import java.util.List; reads as Python, a Go file with a const line reads as JavaScript, a Go file with only func and import "fmt" lands on unknown. Unknown runs all 31 rules against every line, which catches more and flags more things that are not bugs.
What it doesn't do
The 31 code rules are regexes matched one line at a time. No parser, no data flow, no taint tracking, so it isn't static analysis in the sense a SAST tool means it. It reads text. db.query("SELECT ... " + id) is caught on one line and missed the moment you split it across two. The word DES on a line trips weak-cipher, comment or variable name included. The hardcoded-* patterns are the exception: those run over the whole source, so a multi-line private-key block is still caught. A pass means none of the rules matched, not that the code is safe.
Rule updates
About once a day this server asks the rules feed whether there is a newer ruleset, and applies it if
there is. The request carries two things: which surface asked, which here is facade, and the rules
version already installed. No machine id, no user id, no file names, nothing you scanned.
Bundles are signed with Ed25519 and verified against a public key compiled into this package, so it
does not matter which mirror served one. A bundle that fails its signature, its schema, or its ReDoS
check is discarded and the rules you already had stay in place. --offline turns updates off, as
does AGENT_GUARDS_NO_FEED=1 or {"feed": false} in ~/.agent-guards/config.json. The bundle
format and how to verify one yourself: https://github.com/mlawsonking/MCP/blob/main/rules/README.md
Same input always gives the same output. It calls the API at https://code-guard-api.vercel.app (set CODE_GUARD_API to point at your own copy). One of six agent guards in this repo: package-guard, agent-firewall, payment-guard, email-guard, code-guard, and web-tools. MIT.
Code Guard MCP questions
How do I add Code Guard MCP to Claude Code?
Run claude mcp add code-guard-mcp -- npx -y @mlawsonking/code-guard-mcp in your terminal. Add --scope user to make it available in every project.
How do I add Code Guard MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does Code Guard MCP provide?
It exposes 3 tools, including scan_code, scan_diff, list_rules.
What security vulnerabilities does it detect?
It identifies command, code, and SQL injection, SSRF, hardcoded secrets, weak crypto, unsafe deserialization, disabled TLS verification, XSS, and personal data.
Which programming languages are supported?
The server supports JS/TS and Python, with specific rulesets for each and a language-agnostic set.
Is this a full SAST tool?
No, it is a rule-based text scanner using regex rather than a full parser or data flow analysis.
How are rule updates handled?
The server checks for a newer ruleset approximately once a day and applies signed updates automatically.