# xploitscan-mcp

Model Context Protocol (MCP) server that exposes [XploitScan](https://xploitscan.com) as tools your AI coding agent can call. Scan AI-generated code for vulnerabilities from inside Claude Desktop, Cursor, Windsurf, or any other MCP client.

## What this is

XploitScan is a static security scanner tuned for the kind of code AI coding tools (Cursor, Lovable, Bolt, Replit, Claude Code) produce by default — unprotected webhooks, hardcoded API keys, SQL injection via template literals, missing auth middleware, CORS misconfigurations. 210 rules, all documented at [xploitscan.com/rules](https://xploitscan.com/rules).

This package wraps the same scanner engine in the Model Context Protocol so an AI coding agent can check its own output before writing it to disk. Three tools:

- **`scan_code`** — scan files, return findings with rule IDs, severity, and fix suggestions
- **`explain_rule`** — look up what a specific rule means (e.g., `VC005` = unprotected Stripe webhook)
- **`grade_code`** — single-call "is this safe to ship" — returns a letter grade A+ through F plus summary

Runs locally over stdio. No network calls, no API key required, no telemetry.

## Install

### Claude Desktop

Edit your Claude Desktop config file:

- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

Add the `xploitscan` server under `mcpServers`:

```json
{
  "mcpServers": {
    "xploitscan": {
      "command": "npx",
      "args": ["-y", "xploitscan-mcp"]
    }
  }
}
```

Restart Claude Desktop. The three tools show up in the tool picker.

### Cursor

Cursor reads MCP config from `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "xploitscan": {
      "command": "npx",
      "args": ["-y", "xploitscan-mcp"]
    }
  }
}
```

### Other MCP clients

Any client that supports the standard MCP stdio transport. Command: `npx -y xploitscan-mcp`. No flags.

## Usage

Once wired up, just ask your agent to scan. Examples:

> "Scan the code you just wrote for security issues."
>
> "Is this safe to ship?" *(agent will call `grade_code`)*
>
> "What does VC005 mean?" *(agent will call `explain_rule`)*

The agent decides when to call the tool. If you want explicit invocation, tools can usually be triggered directly from the client's tool picker.

## Tool schemas

### `scan_code`

Input:
```json
{
  "files": [
    { "path": "src/api/login.ts", "content": "..." },
    { "path": "src/db/users.ts", "content": "..." }
  ]
}
```

Output: text summary + structured `{ findings, filesScanned, findingCount }`.

### `explain_rule`

Input:
```json
{ "ruleId": "VC006" }
```

Output: rule title, severity, category, OWASP + CWE mapping, description.

### `grade_code`

Input: same as `scan_code`.

Output: `{ grade, score, summary, findingCount, breakdown, findings }`.

## Relationship to the XploitScan CLI

The MCP server runs the same scanner engine as the XploitScan CLI (`npm i -g xploitscan`) and the web scanner at [xploitscan.com/scan](https://xploitscan.com/scan). Findings are identical across all three surfaces.

For CI, use the [GitHub Action](https://github.com/marketplace/actions/xploitscan-security-scanner). For one-off local scans from the shell, use the CLI. Use this MCP server when you want your AI coding agent to self-check its output.

## Privacy

All analysis runs locally in the subprocess started by your MCP client. Code never leaves your machine. No telemetry. No account required.

## License

MIT.
