llm-web-guard
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@llm-web-guard scan this project for exposed API keys and prompt injection risks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
llm-web-guard
Defensive security checks for the AI features you ship.
llm-web-guard is a CLI, GitHub Action and MCP server for Claude, Cursor and
other AI assistants. It finds security and cost mistakes in LLM-powered web
apps, maps them to the OWASP LLM Top 10 and can ask a real model for a second
opinion.
It is defensive by design: it reads local source files, never sends a request to your application and never executes project code.
What it catches
ID | Severity | Check |
LWG001 | Critical | Hardcoded OpenAI, Anthropic, OpenRouter, Google, Groq, Perplexity or xAI keys. |
LWG002 | Critical | Provider keys exposed through |
LWG003 | Medium | Model calls without |
LWG004 | Low | Model calls without a timeout or abort signal. |
LWG005 | High | User input interpolated into a system prompt. |
LWG006 | High | Model output passed to |
LWG007 | Medium | AI API routes with no obvious authentication check. |
LWG008 | Medium | AI API routes with no obvious rate limit, quota or credit check. |
LWG009 | High | Wildcard CORS on an AI endpoint. |
Checks are deterministic and run locally. LWG007 and LWG008 are explicitly heuristic: they tell you to review, not that a vulnerability is proven.
Related MCP server: MCP Shield
Install
With uv:
uv tool install git+https://github.com/htsecurity/llm-web-guard.gitOr with pipx:
pipx install git+https://github.com/htsecurity/llm-web-guard.gitCLI
# Scan the current project
llm-web-guard scan
# Scan a specific app
llm-web-guard scan ./apps/web
# JSON or SARIF for CI/code scanning
llm-web-guard scan --format json --output report.json
llm-web-guard scan --format sarif --output llm-web-guard.sarif
# Fail only on critical findings, or do not fail at all
llm-web-guard scan --fail-on critical
llm-web-guard scan --fail-on none
# See available local and hosted models
llm-web-guard modelsExit codes:
0: no finding at or above the--fail-onthreshold.1: a finding reached the threshold.2: invalid input, path or AI configuration.
AI review (real models, optional)
The deterministic scan never needs an API key. To get a second opinion on the highest-severity findings:
# Local first: uses an installed Ollama model when available
llm-web-guard scan --ai-review --ai-max 3
# Pick a specific local model
llm-web-guard scan --ai-review --ai-provider ollama --model qwen2.5:14b
# Or use OpenRouter
export OPENROUTER_API_KEY=...
llm-web-guard scan --ai-review --ai-provider openrouterWhat happens:
Ollama is tried first when
--ai-provider autois used.If no local model is available, OpenRouter is used when
OPENROUTER_API_KEYis set.Only the finding and a small code window are sent, not the whole project.
The model must return structured JSON with a verdict, confidence, rationale, remediation and an optional patch hint.
Results are cached by input hash.
--ai-maxdefaults to 3 and is capped at 20.
Example with a local model:
AI (ollama/qwen2.5:14b): confirmed (100%) — The API key is exposed in the
client-side code, which is a critical security issue as it can be accessed by
any user of the web application.The CLI prints the provider, model and token usage in JSON output. No AI call is
made unless --ai-review or the MCP review tool is explicitly used.
Environment
Copy .env.example to .env for local use. Real .env files are gitignored.
Variable | Purpose |
| Optional OpenRouter key. |
| Optional model ID. If empty, a low-cost model is selected from the live catalog. |
| Local OpenAI-compatible endpoint. Default: |
| Optional local model ID. |
The models command reads the live OpenRouter catalog and shows prices per 1M
input/output tokens. OpenRouter results are cached for one hour.
Use it from Claude and other MCP clients
The MCP server exposes four tools:
Tool | Purpose |
| Deterministic local scan. No AI calls. |
| Real LLM second opinion on one finding. |
| List local Ollama models and live OpenRouter models. |
| List the checks and OWASP mappings. |
Claude Code:
claude mcp add llm-web-guard -- uvx --from git+https://github.com/htsecurity/llm-web-guard llm-web-guard-mcpClaude Desktop, Cursor and other stdio MCP clients:
{
"mcpServers": {
"llm-web-guard": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/htsecurity/llm-web-guard",
"llm-web-guard-mcp"
]
}
}
}Then ask:
Scan this project for LLM security issues. Do not send code to a model yet.
Review the highest-severity finding with my local Ollama model.
GitHub Action
The action is deterministic and makes no AI calls in CI:
- uses: htsecurity/llm-web-guard@v0.1.0
with:
path: .
fail-on: highSARIF output for GitHub code scanning:
- uses: htsecurity/llm-web-guard@v0.1.0
id: llm-security
with:
path: .
fail-on: none
format: sarif
output: llm-web-guard.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: llm-web-guard.sarifPrivacy and safety
The scanner reads source files only. It does not execute code, install dependencies, browse your app or send HTTP requests to it.
Secret-looking values are redacted in output.
AI review is opt-in and sends only the finding and a small code window.
Use
--ai-provider ollamato keep review data on your machine.No telemetry, analytics or background jobs.
Limitations
This is a static heuristic scanner, not a penetration test or a guarantee that an app is secure.
It does not prove exploitability. Findings marked
mediumconfidence need a human review.It does not understand every framework, custom wrapper or authorization model.
It does not replace dependency scanning, secret scanning, auth testing or a full OWASP ASVS review.
Development
git clone https://github.com/htsecurity/llm-web-guard.git
cd llm-web-guard
uv sync
uv run pytest
uv run ruff check .
uv run ruff format --check .The test suite includes a deliberately vulnerable Next.js fixture, a safe fixture, SARIF validation, an MCP stdio client test and mocked AI responses. CI runs on Python 3.11 and 3.13.
License
MIT. See LICENSE.
Available Tools
4 toolsmodelsA
List available Ollama models and current OpenRouter models with prices.
Inputs: provider. Returns: object
reviewB
Ask a real LLM to review one finding and a small code snippet.
The snippet is sent to the selected provider. Use provider=ollama to keep it on this machine. The default is local Ollama first, then OpenRouter.
Inputs: finding (required), code_context (required), model, provider. Returns: object
rulesA
List the deterministic checks and their OWASP LLM mappings.
Inputs: no named parameters. Returns: object
scanC
Scan a local project for LLM web security issues. Read-only, no AI calls.
Inputs: path. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: scan runs the deterministic static pass, review does a single LLM-backed deep dive on one finding, while models and rules are pure informational lookups. The scan vs. review boundary is spelled out explicitly (read-only/no AI calls vs. snippet sent to a provider), so misselection is unlikely.
All names are single lowercase tokens with no case/style drift, which is predictable. The only inconsistency is grammatical: scan/review are verbs while models/rules are bare nouns that implicitly mean list_models/list_rules.
Four tools is a tight, well-scoped surface for a small security scanner: detection, AI-assisted triage, provider discovery, and rule enumeration. No tool looks redundant or like filler, and nothing essential is obviously missing at this scale.
The lifecycle (list rules -> scan -> inspect providers -> review a finding) is coherent and has no dead ends. Minor gaps: no way to enumerate/export the findings from a scan in structured form, and no configuration/baseline management for suppressions or provider defaults.
Maintenance
Related MCP Connectors
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Scan prompts for injection attacks, redact PII, and audit LLM SDK usage from any MCP client
Security, SEO and AI-visibility scanner for web apps · free scans and focused checks via MCP.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that audits other MCP servers. Run MCPWatch security scans from inside Claude Code or any MCP-compatible agent with 10 OWASP MCP Top 10 aligned checks and A-F letter grades.MIT
- AlicenseCqualityDmaintenanceSecurity scanner and MCP server that catches dangerous patterns in MCP servers and AI agent projects, such as leaked secrets, shell execution, and prompt-injection text. Runs as both a CLI and MCP server with CI-friendly severity gates.21MIT
- AlicenseCqualityCmaintenanceA local-first, authorization-gated MCP server for web security assessment that transforms URLs into traceable, reviewable reports and integrates with Claude Code and local LLMs.15MIT
- AlicenseNot gradedqualityCmaintenanceA read-only MCP server that lets an agent audit its own environment by discovering local MCP configurations and skill folders on Windows, macOS, and Linux and running offline static checks for prompt injection, hidden instructions, hardcoded secrets, dangerous commands, unpinned packages, and excessive filesystem or transport permissions. It exposes tools to scan everything discovered, list configurations, vet a single skill, or analyze supplied text, returning text, JSON, SARIF, or HTML findings with CI-friendly severity levels.7 npmMIT