
Codesafer
io.github.goldmembranePublished by GitHub account goldmembranev1.0.1Updated Oct 24, 2026
Scans AI-generated code for invisible Unicode, Trojan Source, and supply-chain threats.
Overview
Scans AI-generated code and AI rules files locally for hidden Unicode, Trojan Source, homoglyph, obfuscation, and dependency threats.
- What you can do
- CodeSafer is a local MCP server that exposes six tools: scan_file, scan_directory, scan_rules_file, check_dependencies, ai_analyze, and explain_finding. It combines eight deterministic static scanners for known attack categories with a CodeBERT transformer classifier that scores code chunks as malicious or benign. Findings are returned inline with severity, line numbers, and remediation guidance, and it also inspects AI configuration files such as .cursorrules and CLAUDE.md for planted backdoors.
- When to use it
- Use it when an assistant writes or reviews code and you want a security pass before that code runs, especially for hidden Unicode, BiDi/Trojan Source, homoglyph, steganography, obfuscation, and typosquatted dependency risks. It is also useful for auditing AI rules and config files for injected instructions.
- Requirements
- Node.js 18 or later and an MCP-compatible client such as Claude Code, Cursor, VS Code with Copilot, or Cline. It runs as a local stdio process, typically launched with node pointing at the built entry file. No accounts, API keys, environment variables, or headers are declared.
Installation
In SourceWeft
- Open Codesafer in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
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.
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:
- 8 static analysis scanners — deterministic rules for known attack categories (fast, zero false-negatives on the patterns they cover).
- 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
MCP Tools
CodeSafer exposes six tools to your MCP client:
Installation
Prerequisites
- Node.js 18 or later
- An MCP-compatible client (Claude Code, Cursor, VS Code + Copilot, Cline)
From source
Configure your MCP client
Claude Code (~/.claude.json or project .mcp.json):
Cursor (.cursor/mcp.json):
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
.cursorrulesfor 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:
- Invisible Unicode characters — 30+ variants including Zero-Width Space, Zero-Width Joiner
- BiDi / Trojan Source attacks — CVE-2021-42574
- Homoglyphs — Cyrillic/Greek characters masquerading as Latin (CVE-2021-42694)
- Unicode steganography — Glassworm patterns in whitespace
- Rules file backdoors — malicious instructions in
.cursorrules,CLAUDE.md, etc. - Dependency risks — typosquatting and suspicious install scripts
- Obfuscation patterns —
eval+ base64, packed payloads, reverse shells - Static analysis findings — 8 deterministic scanners
- AI deep analysis — CodeBERT transformer for novel and obfuscated threats
Project structure
License
ISC — see the LICENSE file for details.
Links
- Website: codesafer.org
- Model Context Protocol: modelcontextprotocol.io
- Report issues: GitHub Issues
Source: README.md at commit 1fee55e
Tools
0Version history
1- v1.0.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts