How to make Claude Code check its own code for security issues
A five-minute setup that gives Claude Code a security scanner as an MCP tool, so it scans after every change and fixes what it finds. Works alongside the built-in /security-review.
Claude Code is very good at writing code and reasonably good at reviewing it when you ask. What it does not do on its own is check every change against a fixed list of security mistakes. This post sets that up. When you are done, Claude will scan after it writes code, tell you what it found in plain English, and offer to fix it.
It takes about five minutes. You need Node.js 18 or newer and a project folder that Claude Code already works in.
What you are adding
The Model Context Protocol, MCP, is how Claude Code talks to outside tools. SixthWall ships an MCP server that exposes three tools:
scan_codescans the project, or the files you name, and returns findings with fixes.explain_findingexplains a specific rule in beginner terms.security_scorereturns a 0 to 100 score for the project.
The scanner runs on your machine. Nothing is uploaded and there is no account.
Step 1: run init
In the project folder:
npx @sixthwall/cli init
This does four things:
- Writes a
.mcp.jsonin the project that registers the SixthWall server. - Adds a short section to your
CLAUDE.mdtelling Claude to runscan_codeafter it writes or changes code. - Installs a git pre-commit hook.
- Runs a first scan and prints the results.
Step 2: restart Claude Code and approve the server
Project-scoped MCP servers need a one-time approval. Restart Claude Code in the project and say yes when it asks whether to trust the server listed in .mcp.json.
Step 3: ask for a scan
Type:
scan my code for security issues
Claude calls scan_code and reports what it found. Each finding includes what is wrong, what someone could do with it, and the smallest fix. Because Claude has the fix in front of it, the natural next message is "fix the first one", and it will.
From then on, because of the CLAUDE.md section, Claude tends to scan on its own after it finishes a task. If it does not, asking works.
Does this replace /security-review?
No, and you should keep using both. Claude's built-in review reasons about your code and can catch things no fixed rule can. SixthWall complements it with checks that fire the same way every time, a score you can watch over sessions, and, when the paid tier launches, testing against the live deployed app. A good habit is to run /security-review before a big release and let SixthWall run continuously.
What it checks today
Fifteen rules for JavaScript and TypeScript, aimed at what AI-generated code gets wrong most often: hardcoded API keys, secrets shipped to the browser, missing auth on routes, SQL built from user input, passwords stored in plain text, tokens that never expire, insecure cookies, wide-open CORS, missing rate limits, verbose errors, and a few more. The full list with examples is on the rules page.
If something is a false alarm
Add a line to .sixthwall/ignore in the form path/to/file.ts:AI-RULE-ID and the scanner skips that rule in that file. The file is meant to be committed so the whole team shares it.
Using Cursor, Windsurf or Copilot instead?
The MCP server works in any client that supports MCP, but automatic configuration during init is Claude Code only for now. The CLI and the pre-commit hook work everywhere. There are short guides for Cursor, Windsurf and Copilot.