You want Claude to integrate Stripe. You want Cursor to build your OpenAI pipeline. But your API keys are in .env, and AI can read them.
GitGuardian found 39.6 million secrets leaked on GitHub in 2025. AI-assisted commits leak at 2x the baseline rate.
Phantom fixes this in one command.
The Problem
When you use AI coding tools, your .env secrets enter the LLM context window:
- Claude Code reads .env to understand your project
- Cursor indexes your workspace files
- Copilot suggests code containing your keys
Those keys can leak via session logs, prompt injection, or training data.
The Solution: Phantom Tokens
$ npx phantom-secrets init
One command:
- Reads your .env and detects real secrets
- Stores them in your OS keychain (encrypted)
- Rewrites .env with worthless phantom tokens
- Auto-configures Claude Code MCP server
Your .env now looks like:
OPENAI_API_KEY=phm_a7f3b9e2c1d4f6a8...
STRIPE_SECRET_KEY=phm_2ccb5a1e9f8d7b3c...
These tokens are worthless. Safe to leak. Safe for AI to read.
How It Works
When your code makes an API call, Phantom's local proxy intercepts it:
- AI writes code using phantom tokens
- Code calls
http://127.0.0.1:PORT/openai/v1/chat/completions - Proxy replaces
phm_...with your real API key - Forwards the request over TLS to the real API
- Your code works perfectly. AI never knew.
$ phantom exec -- node app.js
# Proxy running on 127.0.0.1:54321
# Real keys injected at network layer
Works With Every AI Tool
Phantom ships an MCP server with 9 tools. Works with Claude Code, Cursor, Windsurf, and Codex.
Claude Code:
$ claude mcp add phantom-secrets-mcp -- npx phantom-secrets-mcp
Cursor / Windsurf / Codex:
{"phantom": {"command": "npx", "args": ["phantom-secrets-mcp"]}}
Once configured, just tell your AI: "protect my API keys" — it handles everything.
Cloud Sync
Sync your vault across machines with end-to-end encryption:
$ phantom login # GitHub OAuth
$ phantom cloud push # Encrypted upload
$ phantom cloud pull # On another machine
The server never sees your plaintext secrets. ChaCha20-Poly1305 encryption with keys that never leave your device.
Try It
$ npx phantom-secrets init
- Website: phm.dev
- GitHub: ashlrai/phantom-secrets
- MIT licensed, open source, free forever
New since launch: cloud sync, export/import, streaming proxy support, team vaults, and MCP tools for Claude Code, Cursor, Windsurf, and Codex.
Top comments (0)