Skip to main content
Glama

passkey-mcp

Zero-plaintext secrets for AI coding agents and the terminal.

Store API keys and credentials in your native OS Keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service) and inject them into MCP servers and CLI processes at runtime—with real-time output masking and zero secrets in config files, shell history, or LLM context.

PyPI Python 3.10+ MCP Compatible OS Keychain Native Zero Daemons License: MIT

Quickstart · How It Works · AI Agent Workflows · Security Model · Documentation Wiki


Positioning: passkey-mcp is a local OS-keychain secret injector—not a team password manager, shared cloud vault, or 1Password replacement. No cloud sync, no background daemon, no telemetry. Alpha (0.11.x).

How It Works

AI coding tools normally store MCP server tokens in plaintext JSON on disk (~/.cursor/mcp.json, ~/.claude.json, claude_desktop_config.json). One command (passkey init) moves those tokens into your OS Keychain, saves a 0o600 backup in <data_dir>/backups/, and rewrites the launch command to inject secrets in memory at startup:

 {
   "mcpServers": {
     "stripe": {
-      "command": "npx",
-      "args": ["-y", "@stripe/mcp"],
-      "env": {
-        "STRIPE_SECRET_KEY": "sk_live_51N..."
-      }
+      "command": "passkey",
+      "args": ["run", "--quiet", "stripe", "--", "npx", "-y", "@stripe/mcp"]
     }
   }
 }

Need to leave passkey? Run passkey unwrap at any time to restore inline commands cleanly.


Related MCP server: secrets-mcp-server

60-Second Quickstart

Install

uv tool install passkey-mcp
# or: pipx install passkey-mcp

(Working from a local git clone? Run uv sync && uv run passkey --help.)

Step 1 — Secure Existing MCP Configs in One Command

passkey init --dry-run   # Preview detected plaintext MCP secrets across installed tools
passkey init             # Migrate tokens to OS Keychain and wrap server configs
passkey status           # Verify all servers report 'secured'

Step 2 — Store & Run Your Own Secrets

passkey new stripe                       # Masked input ('•' bullets + live char counter)
passkey run stripe -- pytest             # Inject into child env with stdout/stderr masking

Step 3 — Onboard Your AI Coding Agents

# Install PreToolUse secret-guard hooks + SKILL.md / .mdc / AGENTS.md rules in one shot
passkey hook install --tool all --with-skill

Add passkey-mcp-server to your MCP client (claude mcp add passkey -- passkey-mcp-server) or drop this into your client's mcp.json:

{
  "mcpServers": {
    "passkey": {
      "command": "passkey-mcp-server"
    }
  }
}

Once connected, agents gain 13 secret-free MCP tools (passkey_find, passkey_project_status, passkey_request_secret, passkey_entry_info, passkey_preflight_run, passkey_doctor, ...) and 3 guided @mcp.prompt() playbooks (setup-project-secrets, debug-missing-credential, migrate-exposed-mcp-configs).


AI Agent Workflows

1. Real-Time Stream Scrubbing (SecretMasker)

Even if a test crash, traceback, or rogue print(os.environ) dumps an injected token, passkey scrubs raw UTF-8 and JSON-escaped secret values (len >= 4, across pipe chunk boundaries) before they reach terminal scrollback or LLM context:

$ passkey run -q stripe -- python3 -c 'import os; print("Token:", os.environ["STRIPE_SECRET_KEY"])'
Token: <concealed by passkey>

2. Out-of-Band Native OS Secret Popups (passkey_request_secret)

When an entry is missing—or an API returns 401 Unauthorized on an expired key—your agent doesn't stall or ask you to paste secrets into chat. It triggers a native macOS/Linux hidden-input dialog directly on your desktop that saves straight into your OS Keychain:

# Missing credential -> pops native hidden dialog ("Passkey - Secret Request")
passkey request stripe_dev --fields STRIPE_SECRET_KEY,WEBHOOK_SECRET --policy session \
  --hint "Stripe Dashboard -> Developers -> API keys" --json

# Expired credential -> fires macOS Notification banner + "Passkey - Rotate Secret" modal
passkey request resend --fields RESEND_API_KEY \
  --reason "HTTP 401 Unauthorized: API token expired" \
  --hint "Resend Dashboard -> API Keys -> Create API Key" --json

The agent receives only {"ok": true, "status": "updated", "fields_saved": ["RESEND_API_KEY"], "rotated": true}—never the secret.

3. Biometric Touch ID Session Leases (policy = session)

First-run onboarding (passkey) lets you choose your global default-policy (passkey config default-policy <mode>), and you can switch individual entries or your entire keychain (passkey policy --all <mode> [--exclude-mcp]) anytime:

Policy

Biometric Behavior

Ideal Use Case

session (macOS Touch ID default)

1 Touch ID tap unlocks the calling agent session (10m default TTL, bound to (ancestor_pid, start_time))

CLI/agent APIs (stripe, aws, jamf, gh) across 20-turn coding loops

allow (YOLO / Headless — MCP & Windows/Linux default)

Headless OS Keychain access (0 extra prompts; still scrubbed by SecretMasker & guarded by .env.passkey trust)

Background IDE-boot MCP servers (passkey init) & fastest local dev

prompt (Strict Step-Up)

Touch ID on every single invocation unless an explicit passkey lease grant is active

Production databases, billing, & root credentials

# Switch all CLI/agent entries to 1-tap Session Touch ID while keeping background MCP servers headless
passkey policy --all session --exclude-mcp --yes

# Or switch everything to zero-prompt YOLO mode (requires 1 Touch ID tap on policy relaxation; blocked for AI agents)
passkey policy --all allow --yes

Asymmetric Policy Step-Up: Tightening policies (allow -> session, session -> prompt) requires zero prompts, while relaxing any entry or default-policy (prompt -> session/allow, session -> allow) is hard-blocked (POLICY_DOWNGRADE_FORBIDDEN) for AI agents/MCP and requires 1-tap Touch ID / OS auth in your terminal.

4. Zero-Config Repo Execution (passkey project init + passkey exec)

Commit a secret-free .env.passkey pointer manifest to git so humans and agents never have to stitch entry names together:

# Scan .env.example (refuses live .env!), map matching keychain entries, and write .env.passkey
passkey project init

# Run from anywhere inside the repo — HMAC-verified against trusted_projects.json
passkey exec -q -- pytest

5. Peer-to-Peer Encrypted Token Sharing (passkey share + passkey upload)

Hand a credential set to a teammate over Slack/Teams without writing files to disk or pasting plaintext keys:

# Sender: fuzzy-match entry, copy compact AAD-authenticated pk1:... token to clipboard (120s auto-clear),
# and print a random 8-word Scrypt passphrase for a separate channel
passkey share stripe_dev

# Recipient: paste the pk1:... token & passphrase at masked prompts, preview fields, and save to keychain
passkey upload

Security Model

┌───────────────────────────────────────────────────────────────────────────┐
│ AI Agent / LLM Context (Claude Code, Cursor, Gemini CLI, Codex, VS Code)  │
│  • Sees ONLY: entry names, field keys, policy, lease status (`--json`)    │
│  • Blocked from `.env`, `*.backup`, `*.enc`, `passkey get` via PreToolUse │
│  • Receives child stdout/stderr with secrets -> `<concealed by passkey>`  │
└───────────────────────────────┬───────────────────────────────────────────┘
                                │  MCP stdio / CLI subprocess
                                ▼
┌───────────────────────────────────────────────────────────────────────────┐
│ passkey Broker (In-Memory, Zero Background Daemons)                       │
│  1. Verifies repo manifest SHA-256 against HMAC `trusted_projects.json`   │
│  2. Enforces `allow` | `session` (`proc_pidinfo` lineage) | `prompt` ACL  │
│  3. Reads secret payload from OS Keychain (`service="passkey"`)           │
│  4. Injects env vars into child process ONLY & scrubs output streams      │
│  5. Appends caller-attributed record to HMAC hash-chained `audit.log`     │
└───────────────────────────────────────────────────────────────────────────┘
  • OS Keychain at Rest: Credentials, config values, and all four internal 256-bit HMAC keys (__audit_hmac_key__, __lease_hmac_key__, __trust_hmac_key__, __policy_hmac_key__) live in your OS Keychain—<data_dir> (0o700) stores 0o600 secret-free metadata (entries.json v2) and HMAC-anchored policy overrides (policies.json) so discovery, <TAB> completion, --dry-run preflight, and O(1) bulk policy switching trigger zero secret Keychain prompts.

  • Authenticated Portability (pk1: & PK01): passkey share / passkey upload exchange compact URL-safe pk1:... tokens authenticated with AES-256-GCM ("pk1:" + header AAD) + Scrypt (N=2^20, r=8, p=1), while passkey export --encrypt and passkey share -o write O_EXCL, 0o600 PK01 bundles.

  • Tamper-Evident Audit Chain: Every operation records actor attribution (human vs. agent client) in an HMAC-SHA256 hash chain (passkey audit --verify).

  • Pre-Execution Agent Guardrails: passkey hook check blocks agent file/shell reads of .env, *.backup, *.enc, passkey get, passkey share/upload/receive, policy mutations (passkey policy <entry> <mode>, passkey policy --all, passkey config default-policy <mode>), explicit access-pass mutations (passkey access / passkey lease grant & revoke), and plaintext passkey export (exit code 2).

  • Loopback-Only Browser Broker: passkey browser-fill verifies exact (scheme, host, port) ORIGIN match over direct loopback CDP WebSockets (127.0.0.1) before injecting login fields outside LLM context.

  • Honest Boundaries: Same-UID processes on an unlocked machine share user-level OS privileges (and on macOS pipx/venv installs, Keychain ACLs bind to the underlying python3 binary). See SECURITY.md for the full threat model and vulnerability reporting policy.


Supported MCP Clients & CLI Wrappers

Category

Supported Integrations

MCP Clients (passkey init / status)

Claude Code (claude) · Claude Desktop (claude_desktop) · Cursor (cursor) · VS Code (vscode) · Gemini CLI (gemini) · Windsurf (windsurf) · Cline (cline) · OpenCode (opencode) · Zed (zed)

Agent Hooks & Skills (hook / skill)

Claude Code (.claude/settings.json, SKILL.md) · Cursor (.cursor/hooks.json, passkey.mdc) · Gemini CLI (.gemini/settings.json, SKILL.md) · Universal (AGENTS.md)

CLI Plugins (passkey plugin init)

claude · codex · openai · gemini · cursor-agent · gh · aws · wrangler · vercel · stripe

Keep GITHUB_TOKEN, AWS_SECRET_ACCESS_KEY, ANTHROPIC_API_KEY, and OPENAI_API_KEY out of ~/.zshrc permanently with scoped CLI wrappers (session > .passkey.toml > global > auto):

passkey plugin init gh                      # Bind 'gh' CLI to your 'github' keychain entry
passkey plugin init aws --scope dir         # Bind 'aws' per-repo inside committable .passkey.toml
passkey plugin run gh -- pr status          # Injects GH_TOKEN & scrubs output streams

Data Storage Locations

Platform

Metadata Directory (0o700 dir, 0o600 files — zero secret values on disk)

macOS

~/Library/Application Support/passkey/

Linux

$XDG_CONFIG_HOME/passkey/ or ~/.config/passkey/

Windows

%APPDATA%\passkey\

(Override anytime with PASSKEY_DATA_DIR. Upgrading passkey-mcp via pipx or uv tool preserves every stored keychain entry, policy, lease, and audit record.)


Documentation Wiki

Explore the complete documentation in docs/Home.md:

Guide

Topics Covered

Wiki Home

30-second architecture overview & "Choose Your Path" router

01 — Quickstart

pipx / uv setup, first-run onboarding, passkey init, doctor, and unwrap

02 — Managing Secrets

Masked input shortcuts (Ctrl+R/Tab, Ctrl+U), fields vs. config, rotation, templates, and bundles

03 — Running & Injecting

passkey run, passkey exec, passkey:// $VAR URIs, inject, ephemeral .env FIFOs, and CLI plugin wrappers

04 — Onboarding AI Agents

Connecting passkey-mcp-server, guard hooks, 3-turn autonomous workflow, and verification prompt

05 — Team Workflows

Committable .env.passkey & .passkey.toml manifests, HMAC repo trust, and inline pk1: share / upload

06 — Security & Biometrics

Threat model, OS boundaries, allow / session / prompt Touch ID policies, leases, and audit.log

07 — Browser Agent Autofill

Loopback Chrome DevTools (CDP) login & cookie autofill (passkey browser-fill)

08 — CLI Command Reference

All commands, subcommands, global flags, PASSKEY_OUTPUT=json, settings, and exit codes

09 — MCP Tools & Prompts

All 13 FastMCP tools, schemas, ToolAnnotations, config gates, and 3 @mcp.prompt() playbooks

10 — Troubleshooting & FAQ

Fixes for macOS Keychain ACL prompts, Seatbelt sandboxes, Linux keyrings, stale FIFOs, and unwrap recovery

Essential Commands Cheat Sheet

passkey new <entry>                        # Create an entry via masked interactive prompt
passkey find <ENV_VAR> --json              # Reverse-lookup which entry stores an env var
passkey request <entry> -f <VAR> --json    # Capture/rotate a secret via native OS popup
passkey project init                       # Generate committable .env.passkey from .env.example
passkey exec -q -- <command>               # Auto-inject repo manifest secrets with output masking
passkey run -q <entry> -- <command>        # Inject explicit entry secrets into any command
passkey policy <entry> session             # Require 1 Touch ID tap per 10m agent session
passkey policy --all session --exclude-mcp # Enable Session Touch ID while keeping MCP servers headless
passkey access                             # Interactive Access Menu (grant day pass, list, revoke, policy)
passkey access <entry> d                   # Grant an 8-hour workday pass with 1 Touch ID tap
passkey access --all d --exclude-mcp       # Unlock all protected non-MCP entries for an 8h workday
passkey config default-policy session      # Set default policy for new/requested/uploaded entries
passkey share <entry>                      # Copy encrypted pk1: share token + 8-word passphrase
passkey upload                             # Decrypt a pasted pk1: token into OS Keychain
passkey init                               # Migrate plaintext MCP server tokens to OS Keychain
passkey doctor --deep                      # Verify Keychain, PATH, configs, and HMAC audit chain
passkey audit --verify                     # Cryptographically verify tamper-evident audit.log

Development & License

Requires Python 3.10+ and uv (see CONTRIBUTING.md and docs/architecture.mmd):

uv sync
uv run pytest -q
uv run ruff check passkey/ tests/

MIT License — see LICENSE and SECURITY.md.

Available Tools

13 tools
passkey_audit_recentA
Read-onlyIdempotent

Return recent sanitized audit log records with caller attribution.

Secret values and HMAC key material are never included.

Args: limit: Maximum number of recent records to return (default: 20, max: 100)

Returns: List of sanitized audit log entries (most recent first)

Inputs: limit. Returns: result

passkey_cdp_autofillA

Deterministically fill credentials into a local Chrome DevTools browser tab.

Disabled by default; enable explicitly via passkey config mcp-browser-broker on. Verifies exact scheme + host + port match against the entry's ORIGIN config before touching any secret fields, and never returns secret values.

Args: entry_name: Name of the passkey entry containing ORIGIN and credentials cdp_url: Loopback CDP WebSocket URL (e.g., ws://127.0.0.1:9222)

Returns: Dictionary with {"filled": bool, "origin": str, "fields_injected": [...]}

Inputs: cdp_url (required), entry_name (required).

passkey_doctorA
Read-onlyIdempotent

Run diagnostics on passkey and MCP configurations.

Checks for common issues including:

  • Config file existence and validity for all detected tools

  • Passkey command availability in PATH

  • Keychain access permissions

  • MCP servers with missing passkey entries

  • MCP servers with exposed secrets

  • (deep=True) entry age analysis and bundle file permissions

Args: deep: Include extended checks (entry age, bundle permissions)

Returns: Dictionary with diagnostic results

Inputs: deep.

passkey_entry_infoA
Read-onlyIdempotent

Inspect complete non-sensitive metadata for a passkey entry without exposing values.

Read-only: never triggers Touch ID, never decrements active lease uses, and never exposes secret or config values.

Args: entry_name: Name of the passkey entry (e.g., "stripe")

Returns: Dictionary with exists, policy ('allow', 'session', or 'prompt'), has_active_lease, will_prompt_biometric, fields (secret key names), config_keys, and timestamps.

Inputs: entry_name (required).

passkey_fieldsA
Read-onlyIdempotent

List field names in a passkey entry (without revealing values or logging a secret read).

Returns the names of secret fields stored in the specified entry. Prefer passkey_entry_info when you also need config_keys, policy, and has_active_lease.

Args: entry_name: Name of the passkey entry (e.g., "slack")

Returns: List of field names (e.g., ["SLACK_TOKEN", "SLACK_COOKIE"])

Raises: Exception: If entry not found or keychain access fails

Inputs: entry_name (required). Returns: result

passkey_findA
Read-onlyIdempotent

Reverse-lookup which passkey entries store given environment variable names.

Matches exact names, service-specific aliases (e.g., GH_TOKEN <-> GITHUB_TOKEN), and entry-scoped generic fields (e.g., RESEND_API_KEY -> resend/API_KEY) across both secret fields and config keys without reading or exposing values.

Args: vars: Environment variable names to find (e.g., ["RESEND_API_KEY", "GH_TOKEN"]) from_file: Optional path to a safe template file (e.g., ".env.example")

Returns: Dictionary with matches, results, resolved_entries, missing_vars, and suggested_run_command.

Inputs: vars, from_file.

passkey_listB
Read-onlyIdempotent

List all available passkey entries.

Returns the names of all secret entries stored in the system keychain. Each entry can contain multiple key-value secret pairs.

Returns: List of entry names (e.g., ["slack", "github", "aws"])

Inputs: no named parameters. Returns: result

passkey_preflight_runA
Read-onlyIdempotent

Dry-run preflight for passkey run without spawning a process or exposing values.

Validates that all requested entries, --env-file mappings, passkey:// references, active leases, and optional command executable are ready.

Args: entries: Entry names to inject (e.g., ["stripe", "github"]) env_files: Optional dotenv/reference files to validate command: Optional command argv to verify executable availability

Returns: Secret-free preflight dictionary with ready, injected_env_vars, entries_missing, will_prompt_biometric, and remediation steps.

Inputs: entries (required), command, env_files.

passkey_project_statusA
Read-onlyIdempotent

Inspect repo secret manifest (.env.passkey / .passkey.toml), HMAC trust, and readiness.

Auto-discovers the project manifest up to the enclosing git root, verifies whether its SHA-256 digest is trusted in trusted_projects.json, and preflights all referenced entries and passkey:// URIs without exposing any secret values.

Args: project_dir: Project directory to inspect (default: current directory) command: Optional command argv to verify executable availability

Returns: Secret-free dictionary with manifest_found, trusted, trust_status, ready, injected_env_vars, will_prompt_biometric, and remediation steps.

Inputs: command, project_dir.

passkey_request_secretA
Idempotent

Prompt the human user via an out-of-band native OS hidden dialog to save or rotate secrets.

Opens a secure macOS/Linux password dialog directly on the user's desktop, stores the entered value(s) straight into the OS keychain, and returns only field names and status — secret values NEVER enter AI context or tool output. Automatically skips fields that already exist unless overwrite=True or an error/expiry reason is provided (which triggers a native rotation notification + Passkey - Rotate Secret prompt and stamps last_rotated).

Args: entry_name: Keychain entry name to create or update (e.g., "stripe_dev") fields: Environment variable / field names to capture (max 10) policy: Optional access policy ('allow', 'session', or 'prompt'; defaults to default-policy; policy relaxations below an existing entry's policy or default-policy are rejected) hint: Optional short hint shown in the dialog (e.g., where to find the key) reason: Optional error/expiry reason (e.g., "401 Unauthorized: token expired") timeout: Seconds to wait before timing out (5-300, default: 120) overwrite: Re-prompt even if requested fields already exist

Returns: Secret-free dictionary with ok, status ('created'|'updated'|'already_exists'), entry, fields_saved, fields_present, policy, and optional rotated/last_rotated.

Inputs: fields (required), entry_name (required), hint, policy, +3 more.

passkey_statusA
Read-onlyIdempotent

Show security status of MCP servers across all detected tools.

Analyzes configs for Claude, Gemini, VS Code, Cursor, OpenCode, Windsurf, Cline, and Zed to identify which MCP servers have their secrets secured via passkey and which still have credentials exposed in plaintext.

Returns: Dictionary with per-tool server status and summary counts

Inputs: no named parameters.

passkey_validate_referencesA
Read-onlyIdempotent

Validate passkey:/// secret references in a template or env file.

Checks whether every referenced entry and field exists in the keychain without exposing any secret values, and reports prompt-gated entries lacking a lease.

Args: file_path: Path to a template or .env.passkey file containing passkey:// references

Returns: Dictionary with {"valid": bool, "checked": int, "missing": [...], "prompt_entries_without_lease": [...]}

Inputs: file_path (required).

passkey_wrap_serverA
Idempotent

Update MCP config files to use passkey wrapper for a server.

Prerequisites: Entry must already exist in passkey keychain.

Args: server_name: Name of the server (must match passkey entry) config_paths: Config files to update (default: all detected configs)

Returns: - configs_updated: List of updated config paths - configs_skipped: List of configs where server not found - errors: Any errors encountered

Inputs: server_name (required), config_paths.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 13 tools

    Disambiguation3/5

    The core actions (request_secret, wrap_server, list, find, audit_recent, cdp_autofill) are clearly distinct, but the set contains a cluster of overlapping read-only checkers: passkey_status, passkey_doctor, passkey_project_status, passkey_preflight_run, and passkey_validate_references all answer variations of 'is this configured/ready?'. passkey_fields also openly overlaps passkey_entry_info (its description even says to prefer entry_info for richer output), so an agent can reasonably hesitate between several tools.

    Naming Consistency4/5

    All 13 tools share a consistent passkey_ prefix and snake_case, which makes them instantly recognizable as one family. There is minor word-order drift (verb_noun like passkey_request_secret / passkey_wrap_server versus noun-first like passkey_entry_info / passkey_project_status / passkey_audit_recent), but the style is readable and predictable overall.

    Tool Count5/5

    13 tools sits squarely in the well-scoped range, and each one maps to a recognizable stage of the secret-management workflow (capture, discover, validate, wrap, audit, autofill). Nothing looks like filler, and the surface is not so large that selection becomes a burden.

    Completeness3/5

    Creation/rotation, listing, lookup, validation, wrapping, diagnostics, and auditing are covered thoroughly, but lifecycle teardown is missing: there is no delete/remove entry tool, no way to change an entry's policy after creation, and no lease acquire/release management despite leases being referenced throughout. Agents hitting those needs will dead-end and have to fall back to the CLI.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      A GitHub-native secrets manager that allows AI assistants to securely manage, generate, and validate credentials without exposing sensitive values in conversation history. It supports secret scanning, environment diffing, and secure command execution by injecting masked variables directly into the runtime environment.
      8
      10 npm
      2
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables AI agents to securely store and manage encrypted secrets locally while using them indirectly through environment-variable injection or file writes, so plaintext values never enter the agent's context.
      8
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables Claude Code to use locally encrypted, multi-tenant credentials by running commands with injected secrets, writing .env files, materializing files, and making HTTP requests, while scrubbing values from all output so they never enter the chat. Also supports sealed retrieval and saving through native dialogs or an auto-clearing clipboard, role-based credential selection, versioning, rollback, archiving, and a full audit log.
      MIT