Codesafer MCP Server

Scans AI-generated code for invisible Unicode, Trojan Source, and supply-chain threats.

Local serverstdio

What is the Codesafer MCP server?

Scans AI-generated code for invisible Unicode, Trojan Source, and supply-chain threats. That is what the codesafer mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

AI coding assistants generate code fast — but who's checking it for hidden threats?

  • Invisible Unicode characters — injected into identifiers (30+ variants)
  • BiDi / Trojan Source — attacks that reorder how code is displayed vs. executed (CVE-2021-42574)
  • Homoglyphs — — Cyrillic characters masquerading as Latin (CVE-2021-42694)
  • Glassworm-style Unicode steganography — hiding payloads in whitespace
  • Rules file backdoors — planted in .cursorrules, CLAUDE.md, and other AI config files
  • Typosquatted dependencies — in package.json

Getting it running

Installation goes through your MCP client rather than a global install: point it at npm on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

The tools it exposes

The server publishes 7 tools. What each one is for:

  • scan_file — Scan a single file for hidden malicious code patterns
  • scan_directory — Recursively scan a directory across all source files
  • scan_rules_file — Scan an AI configuration/rules file for prompt injection and Rules File Backdoor attacks
  • check_dependencies — Check package.json for typosquatting, suspicious install scripts, and dependency risks
  • ai_analyze — Deep AI analysis using the trained CodeBERT model (classifies chunks as malicious/benign with confidence)
  • explain_finding — Get detailed explanation of a specific threat category, with attack scenarios and remediation
  • Prerequisites — The Prerequisites tool exposed by this server

What it needs from you

  • Node.js 18 or later - An MCP-compatible client (Claude Code, Cursor, VS Code + Copilot, Cline)

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

How it compares

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Codesafer's toolset — scan_file, scan_directory, scan_rules_file and 4 more — is a fair guide to whether it matches your workflow. It is maintained by goldmembrane; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Available tools

ToolWhat it does
scan_fileScan a single file for hidden malicious code patterns
scan_directoryRecursively scan a directory across all source files
scan_rules_fileScan an AI configuration/rules file for prompt injection and Rules File Backdoor attacks
check_dependenciesCheck package.json for typosquatting, suspicious install scripts, and dependency risks
ai_analyzeDeep AI analysis using the trained CodeBERT model (classifies chunks as malicious/benign with confidence)
explain_findingGet detailed explanation of a specific threat category, with attack scenarios and remediation
PrerequisitesThe Prerequisites tool exposed by this server.

How to install the Codesafer MCP server

**Cursor** (`.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "codesafer": {
      "command": "node",
      "args": ["/absolute/path/to/cleaner-code/dist/index.js"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js 18 or later - An MCP-compatible client (Claude Code, Cursor, VS Code + Copilot, Cline)

Example prompts to try

  • Use Codesafer to scan file.
  • Use Codesafer to scan directory.
  • Use Codesafer to scan rules file.

Frequently asked questions

It connects Codesafer to MCP-compatible AI assistants such as Claude and Cursor, exposing 7 tools (scan_file, scan_directory, scan_rules_file, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Codesafer directly.