goldmembrane/cleaner-code

๐Ÿ”’ Security
0 Views
0 Installs

๐Ÿ“‡ ๐Ÿ  ๐ŸŽ ๐ŸชŸ ๐Ÿง - AI code security scanner MCP server. Detects 9 categories of threats in AI-generated code (invisible Unicode, Trojan Source, homoglyphs, Glassworm steganography, rules file backdoors, dependency typosquatting, obfuscation) using static analysis plus CodeBERT deep learning. Runs locally, free tier.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "goldmembrane-cleaner-code": {
      "command": "npx",
      "args": [
        "-y",
        "goldmembrane-cleaner-code"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

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 license: ISC Node

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

CapabilityDetails
Invisible character detection30+ Unicode variants including Zero-Width Space, Mongolian Vowel Separator
BiDi / Trojan SourceFull CVE-2021-42574 coverage
Homoglyph detectionCyrillic/Greek/Latin confusables (CVE-2021-42694)
Unicode steganographyGlassworm-style whitespace payloads
Rules file backdoorsScans .cursorrules, CLAUDE.md, .claude/, Cursor rules
Dependency scanningTyposquatting + suspicious install scripts in package.json
Obfuscation detectioneval + base64, reverse shells, packed payloads
AI deep analysisCodeBERT transformer classifier with confidence scores
MCP native6 MCP tools, stdio transport
Local-firstNo code uploaded โ€” runs entirely on your machine

MCP Tools

CodeSafer exposes six tools to your MCP client:

ToolPurpose
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

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

Related MCP Servers

13bm/GhidraMCP

๐Ÿ โ˜• ๐Ÿ  - MCP server for integrating Ghidra with AI assistants. This plugin enables binary analysis, providing tools for function inspection, decompilation, memory exploration, and import/export analysis via the Model Context Protocol.

๐Ÿ”’ Security1 views
123Ergo/unphurl-mcp

๐Ÿ“‡ โ˜๏ธ - URL intelligence for AI agents. 13 tools for security signals and data quality: redirect behaviour, brand impersonation detection, domain age, SSL validation, parked detection, URL structural analysis, DNS enrichment.

๐Ÿ”’ Security0 views
82ch/MCP-Dandan

๐Ÿ ๐Ÿ“‡ ๐Ÿ  ๐ŸŽ ๐ŸชŸ ๐Ÿง - Real-time security framework for MCP servers that detects and blocks malicious AI agent behavior by analyzing tool call patterns and intent across multiple threat detection engines.

๐Ÿ”’ Security0 views
9hannahnine-jpg/arc-gate-mcp

๐Ÿ - Runtime governance for MCP tool calls. Blocks prompt injection and capability abuse before tool results reach your agent.

๐Ÿ”’ Security0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

Last checked: 7/29/2026, 12:28:56 PM

Unclaimed listing (imported or pending owner verification). Claim it โ†’
โ˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.