Featured

Deploy OpenClaw in 60 seconds β€” 20% off logoDeploy OpenClaw in 60 seconds β€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger β†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger β†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free β†’
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free β†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data β€” no proxies, no parsers, no maintenance.

Start building free β†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it β€” secured from day one.

Get it set up for you β†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free β†’
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here β†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

cleaner-code MCP server](https://glama.ai/mcp/servers/goldmembrane/cleaner-code/badges/score.svg)](https://glama.ai/mcp/servers/goldmembrane/cleaner-code) πŸ“‡ 🏠 🍎 πŸͺŸ 🐧 - AI code security scanner MCP server.

README.md

CodeSafer (cleaner-code)

AI code security scanner as a Model Context Protocol (MCP) server. Detects hidden threats in AI-generated code that traditional linters miss.

![npm](https://modelcontextprotocol.io) ![license: ISC](#license) ![Node](https://nodejs.org)

Website: codesafer.org  Β·  MCP Clients: Claude Code, Cursor, VS Code + Copilot, Cline

---

Why CodeSafer?

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

Recent supply-chain attacks show that malicious code can hide in ways human reviewers and traditional linters routinely miss:

  • 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
  • Obfuscation patterns β€” eval + base64, reverse shells, packed payloads

CodeSafer scans for all of these before the code runs on your machine.

---

How it works

CodeSafer runs as a local MCP server. Your AI client (Claude Code, Cursor, etc.) calls its tools when reviewing or generating code, and findings are returned inline.

Hybrid detection:

  1. 8 static analysis scanners β€” deterministic rules for known attack categories (fast, zero false-negatives on the patterns they cover).
  2. CodeBERT deep analysis β€” transformer model classifies code chunks as malicious/benign with confidence scores. Catches obfuscated or novel patterns that static rules miss.

Nothing leaves your machine. The AI analysis runs locally against a tokenizer server.

---

Features

| Capability | Details | |---|---| | Invisible character detection | 30+ Unicode variants including Zero-Width Space, Mongolian Vowel Separator | | BiDi / Trojan Source | Full CVE-2021-42574 coverage | | Homoglyph detection | Cyrillic/Greek/Latin confusables (CVE-2021-42694) | | Unicode steganography | Glassworm-style whitespace payloads | | Rules file backdoors | Scans .cursorrules, CLAUDE.md, .claude/, Cursor rules | | Dependency scanning | Typosquatting + suspicious install scripts in package.json | | Obfuscation detection | eval + base64, reverse shells, packed payloads | | AI deep analysis | CodeBERT transformer classifier with confidence scores | | MCP native | 6 MCP tools, stdio transport | | Local-first | No code uploaded β€” runs entirely on your machine |

---

MCP Tools

CodeSafer exposes six tools to your MCP client:

| Tool | Purpose | |---|---| | 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 |

---

Installation

Prerequisites

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

From source

git clone https://github.com/goldmembrane/cleaner-code.git
cd cleaner-code
npm install
npm run build

Configure your MCP client

Claude Code (~/.claude.json or project .mcp.json):

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

Cursor (.cursor/mcp.json):

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

Restart your client, and CodeSafer tools will appear in the tool picker.

---

Usage

Once configured, ask your AI client things like:

  • "Scan this file for hidden security issues."
  • "Check the dependencies in package.json for typosquatting."
  • "Scan .cursorrules for a rules-file backdoor."
  • "Run a deep AI analysis of src/auth.ts."
  • "Explain what a Trojan Source attack is and how to fix the finding above."

The client will call the appropriate MCP tool and return findings with severity, line numbers, and remediation guidance.

---

Free tier & Plans

CodeSafer is free to use. Static analysis (scan_file, scan_directory, scan_rules_file, check_dependencies, explain_finding) has no limits.

AI deep analysis (ai_analyze) includes 10 free runs per session. Paid plans for higher AI quotas are available at codesafer.org.

---

Detection categories

CodeSafer detects threats across 9 categories:

  1. Invisible Unicode characters β€” 30+ variants including Zero-Width Space, Zero-Width Joiner
  2. BiDi / Trojan Source attacks β€” CVE-2021-42574
  3. Homoglyphs β€” Cyrillic/Greek characters masquerading as Latin (CVE-2021-42694)
  4. Unicode steganography β€” Glassworm patterns in whitespace
  5. Rules file backdoors β€” malicious instructions in .cursorrules, CLAUDE.md, etc.
  6. Dependency risks β€” typosquatting and suspicious install scripts
  7. Obfuscation patterns β€” eval + base64, packed payloads, reverse shells
  8. Static analysis findings β€” 8 deterministic scanners
  9. AI deep analysis β€” CodeBERT transformer for novel and obfuscated threats

---

Project structure

cleaner-code/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts           # MCP server entry point
β”‚   β”œβ”€β”€ api-server.ts      # Optional HTTP API server
β”‚   β”œβ”€β”€ types.ts           # Scanner interfaces
β”‚   β”œβ”€β”€ utils.ts           # File collection, summary formatting
β”‚   └── scanner/
β”‚       β”œβ”€β”€ invisible.ts       # Invisible Unicode scanner
β”‚       β”œβ”€β”€ bidi.ts            # BiDi / Trojan Source scanner
β”‚       β”œβ”€β”€ homoglyph.ts       # Homoglyph scanner
β”‚       β”œβ”€β”€ encoding.ts        # Encoding / charset scanner
β”‚       β”œβ”€β”€ obfuscation.ts     # Obfuscation pattern scanner
β”‚       β”œβ”€β”€ steganography.ts   # Unicode steganography scanner
β”‚       β”œβ”€β”€ rules-backdoor.ts  # Rules file backdoor scanner
β”‚       β”œβ”€β”€ dependency.ts      # Dependency risk scanner
β”‚       └── ai-analyzer.ts     # CodeBERT deep analyzer
β”œβ”€β”€ ml/                    # ML model assets and tokenizer
β”œβ”€β”€ functions/             # Cloud function deployments
β”œβ”€β”€ deploy/                # Deployment manifests
└── web/                   # Landing page assets

---

License

ISC β€” see the LICENSE file for details.

---

Links

See related servers & alternatives β†’

Related MCP servers

Browse all β†’

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.