Provides deterministic security scanning for prompt injections, secrets, PII, code vulnerabilities, and malicious URLs locally or via cloud intelligence.
Also known as mlawsonking/MCP
- Stars
- 1
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- 0.3.0
- Last commit
- Nov 15, 2026
- License
- MIT
What is agent-guards MCP?
agent-guards provides deterministic security scanning for prompt injections, secrets, PII, code vulnerabilities, and malicious URLs locally or via cloud intelligence.
Summary generated from the project's README
About agent-guards MCP server
Agent-guards provides a deterministic security layer for developers using AI agents. It functions as an MCP stdio server that runs locally on your machine to scan for prompt injections, secrets, PII, code vulnerabilities, and malicious URLs. Because the system relies on regex rules, published lists, and parsers rather than an LLM, every verdict is consistent and includes the specific rules version used for the detection.
Users can run the server via npx without needing any API keys or accounts. The system distinguishes between local engines that work entirely offline and cloud-based tools that require network access for checks like package vulnerability lookups, sanctions screening, or breached password verification. This design ensures that if a network-dependent check cannot be performed, the tool reports a failure rather than incorrectly passing the input as safe.
Beyond the MCP server, the package includes a command line interface for scanning files or directories and a pre-commit hook for staged-diff scanning. It also offers a library for programmatic integration, featuring specialized tools like safeFetch to prevent DNS rebinding during URL requests.
What you can do with it
- 1Detect prompt injection attacksScan untrusted text for instruction-override, jailbreak, or tool-poisoning patterns and Unicode obfuscation tricks.
- 2Identify leaked credentials and PIIFind sensitive information in text and ensure the actual values are removed from the output via redaction.
- 3Audit code for vulnerabilitiesRun regex-based scans on Python or JavaScript files to find potentially dangerous code patterns.
- 4Secure external URL fetchingUse a guarded fetch method to prevent SSRF and DNS rebinding when accessing untrusted domains.
Written from the project's README. Every use case is checked against a quote from it.
How to install agent-guards MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall agent-guards MCP in Claude Code
$ claude mcp add agent-guards -- npx -y agent-guardsInstall agent-guards MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"agent-guards": {
"command": "npx",
"args": [
"-y",
"agent-guards"
]
}
}
}Install agent-guards MCP in VS Code
.vscode/mcp.json
{
"servers": {
"agent-guards": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"agent-guards"
]
}
}
}Install agent-guards MCP in VS Code CLI
$ code --add-mcp '{"name":"agent-guards","type":"stdio","command":"npx","args":["-y","agent-guards"]}'Install agent-guards MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"agent-guards": {
"command": "npx",
"args": [
"-y",
"agent-guards"
]
}
}
}Install agent-guards MCP in Codex
$ codex mcp add agent-guards -- npx -y agent-guardsInstall agent-guards MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.agent-guards] command = "npx" args = ["-y", "agent-guards"]
Install agent-guards MCP in Gemini CLI
$ gemini mcp add -s user agent-guards npx -- -y agent-guardsInstall agent-guards MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"agent-guards": {
"command": "npx",
"args": [
"-y",
"agent-guards"
]
}
}
}Automated checks
Ran Nov 14, 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 sourceagent-guards names mlawsonking/mcp as sourcenpmjs.com/package/agent-guards ↗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 agent-guardsPass
- No critical advisory in the package or its dependencies100 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubagent-guards core
The detection engines behind Package Guard, Agent Firewall, Payment Guard, Email Guard, Code Guard and Agent Web Tools, in one package, running on your machine.
Everything here is deterministic: regex rules, published lists, and parsers. No model is called in any detection path, so the same input gives the same verdict and every verdict names the rules version that produced it.
Run it
npx agent-guards
That starts an MCP stdio server with every tool from all six products. No configuration, no API key, no account.
npx agent-guards --offline # local engines only
npx agent-guards --only code-guard # one product
npx agent-guards --list # what you get, and which tools need the network
npx agent-guards --disable check_ip,check_password
The same package installs the guard CLI:
npx --yes --package agent-guards guard scan src/
npx --yes --package agent-guards guard diff
npx --yes --package agent-guards guard stats --json
pre-commit
This repository publishes a staged-diff hook for the pre-commit framework.
It needs Node 18 or newer. Add this to .pre-commit-config.yaml:
repos:
- repo: https://github.com/mlawsonking/MCP
rev: main # pin this to a commit SHA in a shared repository
hooks:
- id: agent-guards-diff
Then run pre-commit install. The hook scans added lines only and uses the rules in that pinned
checkout. It does not call a model or send file contents anywhere. A second manual hook,
agent-guards-scan, scans the whole working tree when you run
pre-commit run agent-guards-scan --hook-stage manual.
Local and cloud, and why the difference matters
Local tools run entirely on your machine. The text you scan never leaves it.
| Local, works offline | Needs the network |
|---|---|
| prompt-injection and Unicode-obfuscation scanning | package existence, age and vulnerabilities (npm, PyPI, OSV) |
| secret and PII detection, with redaction | sanctions and scam-list screening (OFAC lists, blocklists) |
| code and diff scanning | breached-password lookup (Have I Been Pwned) |
| URL structure analysis | domain age, ASN, blocklist reputation |
| email parsing, spoof heuristics, header reading | SPF/DMARC/MX records, disposable-domain list |
Cloud tools say which service they call in their own tool description. With --offline, they report
that they could not check. They do not return a verdict.
That distinction is the whole design. A check that did not run is not a pass. This codebase shipped the opposite once: four endpoints answered "not sanctioned", "no known vulnerabilities", "not a honeypot" and "safe" when the lookup behind each had failed or was never attempted. A security tool that says "clear" when it means "I don't know" is worse than no tool.
What it catches, and what it does not
The injection scanner matches known instruction-override, jailbreak, prompt-leak, exfiltration and tool-poisoning phrasings, and the Unicode tricks used to hide them: zero-width characters, bidi overrides, the Unicode tag block, hidden CSS, instructions in HTML comments. It is a deterministic pattern scanner, not a classifier. Novel phrasing gets through. Anyone who reads the rules can write around them. It is one layer, not a wall.
The secret scanner matches 22 credential formats plus generic assignments and 3 PII patterns. A
secret in a format it does not know, or split across lines, is not detected. What it does guarantee
is that the value it found is gone from the redacted output, not just the label next to it.
The code scanner is 31 regex rules across JS/TS and Python. No parser, no data flow, no taint
tracking, so exec(cmd) with a bare variable does not fire while exec("ls " + dir) does. That is a
deliberate limit and there is a test pinning it.
Sanctions screening covers the EVM-format OFAC address lists. Honeypot checks only cover the chains honeypot.is actually simulates.
Using it as a library
const guards = require('agent-guards');
guards.injection.scan(untrustedText); // { risk, score, verdict, findings, rules_version }
guards.secrets.scan(text); // { found, verdict, findings, redacted, rules_version }
guards.code.scanDiff(unifiedDiff, 'py'); // findings against new-file line numbers
await guards.safeFetch(url); // SSRF-guarded: pins the resolved IP, rechecks every hop
safeFetch is the one to reach for whenever you fetch a URL you did not choose. It resolves the
hostname once, refuses the request if anything it resolves to is private or loopback, and connects
to that exact address, so there is no second lookup for DNS rebinding to poison. It re-checks every
redirect hop and never pools sockets, because a pooled connection skips the pin.
Rule updates
The rules go stale. Addresses get sanctioned, packages get pulled from npm for shipping malware, and none of that reaches you if the rules only change when you reinstall. So about once a day the server and the CLI ask the rules feed whether there is a newer ruleset, and apply it if there is.
A pull sends two things: which surface asked (cli, plugin, mcp or facade) and the rules
version you already have.
GET /api/rules/latest?surface=mcp&have=2026.07.31
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 you keep the rules you had. Rules never roll back to an older version on their own.
guard update --status # what is in use, and when it last checked
guard update # pull now
Every verdict carries rules_provenance, which is either bundled or feed@<version>, so you can
always tell which ruleset produced a result.
To turn updates off: --offline, AGENT_GUARDS_NO_FEED=1, or {"feed": false} in
~/.agent-guards/config.json. AGENT_GUARDS_FEED_URL points it somewhere else. With updates off
everything still works on the rules compiled into the package.
The bundle format, the verification steps, and how the malicious-package list is curated are in rules/README.md.
Tests
npm test
Offline suites only. Anything that asserts against a third-party endpoint is run by hand, because a suite that goes red at random teaches everyone to ignore red.
Licence
MIT.
agent-guards MCP questions
How do I add agent-guards MCP to Claude Code?
Run claude mcp add agent-guards -- npx -y agent-guards in your terminal. Add --scope user to make it available in every project.
How do I add agent-guards MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
Does this server require an API key or account?
No, it starts with no configuration, no API key, and no account required.
Can I run the security checks without an internet connection?
Yes, you can run the server in offline mode using the --offline flag to use local engines only.
How does the server handle sensitive data during scans?
Local tools run entirely on your machine, ensuring scanned text never leaves it, and the secret scanner provides redacted output.
Is the detection based on AI models?
No, the detection is deterministic using regex rules, published lists, and parsers, meaning no model is called in any detection path.