← Toutes les actualités
security4 min de lecture

Make your AI coding agent scan for security issues before you ship

Par Seaworthy · 3 octobre 2026

Keys hanging in a door lock

Photo by Matt Clark on Unsplash

The gap between writing and checking

If you code with an agent, you already know the rhythm. It writes a feature, you skim the diff, the tests stay green, you merge. The part nobody does is the fourth step: check the thing for security problems before it ships.

I include myself here. I have merged AI-written code with a hardcoded API key because the diff looked clean and I was in a hurry. The tooling gap is real. Vulnerability scanners live in CI pipelines, and CI runs after the code is already written. By the time a scanner complains, the agent that caused the problem is three tasks back and nobody remembers which change it was.

There is a better place for the check: inside the agent's own loop, while it is still working on the code. That is what the Model Context Protocol (MCP) makes practical.

Give the agent a scan tool, not a lecture

Telling an agent to "write secure code" changes little. It will nod, agree, and produce the same code. What changes behaviour is giving it a tool: something it can call, get results from, and act on in the same session. MCP is the protocol that lets a local process expose tools to clients like Claude Code and Cursor. The process runs on your machine, talks over stdio, and the client discovers its tools automatically.

A security scanner fits this shape well. Scanning is read-only, it runs locally, and it returns structured findings. So the loop becomes: the agent writes code, calls the scan tool on the project directory, reads the findings, fixes what it broke, and scans again. Nobody has to remember to run anything.

Wiring it up

Add the scanner to your client's MCP config. Claude Code reads a .mcp.json file in the project root, Cursor reads .cursor/mcp.json, and Claude Desktop reads claude_desktop_config.json. All three use the same shape:

{
  "mcpServers": {
    "seaworthy": {
      "command": "npx",
      "args": ["-y", "seaworthycode", "mcp"]
    }
  }
}

VS Code does the same in .vscode/mcp.json with a "servers" top-level key. Once the config is in place, restart the client and the tools appear. Then change how you prompt: instead of "add the feature", say "add the feature and scan the project before you tell me it is done."

What this catches in practice

Two things, and they are different.

The first is the classic static-analysis catch: hardcoded secrets, committed .env files, SQL built by string concatenation, missing auth on a route, permissive CORS. Agents produce these constantly. Not because models are bad, but because training data is full of tutorial code where none of these things ever mattered.

The second is more interesting: the agent has context. When the scanner reports missing rate limiting on POST /login, the agent that just wrote that route can fix it in the same session, with the design still in its head. A scanner report in CI is a message from a stranger. A finding inside the agent loop is a note to self.

That second part is the real reason to bother with MCP. Closing the loop turns findings from a to-do list into a repair job that finishes in seconds.

Where it falls short

Be honest about the limits, because the marketing is not.

Static analysis misses whole classes of problems. Access-control logic, business rules, anything that only misbehaves at runtime: none of that shows up in a static scan. A clean result is not a security audit, and "the scanner passed" is not a sentence to repeat to your customers.

A long-lived MCP server process is also another thing running on your machine, so read what a server does before you add it. Tool descriptions are written by whoever published the server, and your agent tends to trust them. Ours reads the directory it is pointed at and its only outbound call is license authentication, but hold every server you install to that standard, including this one.

Scanning on every change also burns tokens and time. Point the agent at the directory it changed rather than the whole monorepo, and keep scans on explicit request instead of auto-invoking one after every edit.

Try it this week

Pick a project where an agent writes most of the code. Add a scan tool to the config, then change your prompt habit: "add the feature and scan the project before you call it done." The first scan will find something you did not expect, and that moment is the whole argument.

Seaworthy ships an MCP server exactly like this, and the free tier needs no account.

Cet article a été généré par IA et résume des sources publiquement disponibles.

Par les créateurs de Seaworthy

Seaworthy analyse votre dépôt pour détecter les problèmes abordés dans des articles comme celui-ci.

Failles de sécurité, secrets exposés et mauvaises configurations détectés avant le déploiement. Gratuit, aucun compte requis.

$ npx seaworthycode