SuperAPIAI Directory

phantom-secrets

github.com · AI security

Phantom Secrets is a local credential protection tool for AI coding agents, provided as the command-line program phantom and the MCP server phantom-mcp. It moves managed secret values from a project's .env into a local vault and leaves phm_ placeholders in place; AI agents and applications read only placeholders. When running an application, phantom exec starts a local proxy at 127.0.0.1 and injects the real values from the vault only into authentication headers matching routes. It supports MCP configuration for Claude Code, Cursor, Windsurf, Codex, and Gemini CLI, and provides diagnostic commands that do not leak secret values, such as phantom check log scanning and phantom agent doctor security rating. Local use requires no account, DNS modification, or custom CA; the vault preferentially uses the operating system credential store, otherwise it uses an encrypted file.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsWindows · Linux

About this tool

Phantom Secrets is a credential-layer tool in the AshlrAI open-source ecosystem, with the goal of preventing AI coding agents from leaking API keys when reading repositories, generating tool calls, or writing files. It is installed via the phantom command and comes with the phantom-mcp server, which can be used independently.

Purpose and principles Phantom Secrets replaces managed secret values in .env with phm_ placeholders and moves the real values into a local vault. Agents and applications read placeholders; when an application is run via phantom exec, the tool starts a local proxy at 127.0.0.1 and adds the values from the vault only to fixed authentication headers matching routes. Placeholders are not resolved in client request headers or request bodies. After the session ends, the proxy bearer becomes invalid; placeholders in the project remain until the user rotates them.

Main capabilities

  • phantom init: detects secrets in the project, moves them into the vault, and rewrites .env to phm_ placeholders; when there is no .env, phantom init --empty can be used.
  • phantom list: prints only secret names.
  • phantom agent doctor: rates the repository from unsafe to compliance-ready.
  • phantom check --log: reads agent records or logs, reporting file, line number, and credential shape without printing secrets.
  • phantom status --json, phantom list --json, phantom why OPENAI_API_KEY --json: output information that does not contain secret values.
  • phantom setup --client claude|cursor|windsurf|codex|gemini: writes the MCP configuration for the corresponding client; --print can output a snippet for use by other clients.
  • The MCP server provides read-only metadata inspection and gated lifecycle operations; MCP responses do not return real secret values.
  • The vault preferentially uses the operating system credential store; when unavailable, it uses an encrypted file. Linux keyutils entries are not retained after a reboot; on a Linux desktop with a graphical interface, phantom vault migrate-linux can be used to migrate to Secret Service.

Usage

  1. Download the archive for your system from the v0.8.11 release assets, verify the .sha256, put phantom and phantom-mcp on your PATH, and check with phantom --help.
  2. Run phantom init in the project directory to protect .env.
  3. Run phantom list and phantom agent doctor to check the results.
  4. Run phantom setup --client <client> to configure MCP, then restart the client and have it call phantom_status and phantom_list_secrets; do not ask it to display secret values.
  5. Run the application via commands such as phantom exec -- npm start.

Use cases Intended for developers using AI coding agents such as Claude Code, Cursor, Windsurf, Codex, and Gemini CLI who want to keep real API keys out of conversation logs, tool calls, and generated files when agents read the repository.

Limitations and caveats

  • Does not cover unmanaged files, other processes running as the same user, or processes that already hold a live agent bearer.
  • Unmanaged key files that the developer has not placed in .env remain readable.
  • Access to the OS keychain by the same user is outside the documented boundary.
  • As of 2026-11-24, the public Homebrew tap still provides v0.7.9, which lacks phantom agent doctor --json.
  • The Windows archive is not Authenticode-signed; the pre-commit hook is an sh script, so commits must be made from a terminal that includes Git sh.exe, or run phantom check --staged.
  • 0.8.11 has no network package runner fallback; if neither local runtime is executable, it fails closed.
  • In the current version, provider grant-related live issuance, registration exchange, refresh, renewal, and revocation are hard-rejected before credentials are read or a network connection is established; do not expect vendor-side changes.
  • MCP tools that write state, retrieve or use credentials, or initiate vendor or network requests are disabled by default and can only reach the confirmation and one-time approval token gate when the operator sets PHANTOM_MCP_EFFECTS=trusted-terminal in the server environment outside the agent's authority.
  • Local use requires no Phantom Cloud account; cloud backup is a separate hosted service and is not required for local use.
  • The officially provided leak-rate assessment is a scripted worst-case test, not an LLM measurement; it only measures where keys may appear and does not represent how often models actually search for them; it is a single-machine test with no external audit.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools