Skip to main content
Glama
keychainreader

keychainreader

by Dedoque

keychainreader

A zero-leakage Model Context Protocol (MCP) server for macOS Keychain and Linux Secret Service.

keychainreader allows AI agents (such as OpenCode, Claude Code, Cursor, or Claude Desktop) to discover stored credentials, copy secrets directly to your clipboard, and execute CLI commands with injected environment variables—without ever exposing raw secret values to the LLM context.

Features

  • Zero-Exposure Architecture: Secret values are retrieved locally and never returned in MCP tool responses.

  • Direct Clipboard Transfer: Copies secrets straight to your OS clipboard with automatic TTL-based wiping (default: 30s).

  • Transparent CLI Proxy: Injects secrets into subprocess environment variables (shell=False) and automatically redacts both raw and Base64-encoded secret occurrences from stdout and stderr.

  • Metadata Auto-Discovery: Scans macOS Keychain (security dump-keychain) and Linux Secret Service (secret-tool) for service/account metadata without triggering decryption prompts.

  • SQLite Metadata Index: Stores searchable service names, usernames, and custom tags locally in ~/.cache/keycahainreader/index.sqlite3 (never stores passwords).

Related MCP server: brokre

Requirements

  • Python: 3.12+

  • uv / uvx: Recommended for zero-setup execution.

  • macOS: Uses built-in security CLI and pbcopy (works out of the box).

  • Linux: Requires libsecret-tools (secret-tool) and a clipboard utility (wl-clipboard for Wayland or xclip/xsel for X11).

Installation & Usage

Run directly from Git via uvx

uvx --python 3.12 --from git+https://github.com/Dedoque/keychainreader.git keychainreader

Run from a local clone

git clone https://github.com/Dedoque/keychainreader.git
cd keychainreader
uv run keychainreader

MCP Client Configuration

OpenCode (~/.config/opencode/opencode.json)

Add via CLI:

opencode mcp add keychainreader --global -- uvx --python 3.12 --from git+https://github.com/Dedoque/keychainreader.git keychainreader

Or add manually to ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "keychainreader": {
        "type": "local",
        "command": [
          "uvx",
          "--python",
          "3.12",
          "--from",
          "git+https://github.com/Dedoque/keychainreader.git",
          "keychainreader"
        ]
      }
    }
  }
}

Claude Desktop / Cursor (mcp.json)

{
  "mcpServers": {
    "keychainreader": {
      "command": "uvx",
      "args": [
        "--python",
        "3.12",
        "--from",
        "git+https://github.com/Dedoque/keychainreader.git",
        "keychainreader"
      ]
    }
  }
}

Available MCP Tools

Tool

Description

sync_keychain_index

Scans OS Keychain / Secret Service metadata and updates the local SQLite index.

search_secrets

Searches indexed secrets by service, username, or tags. Returns metadata only.

save_secret_metadata

Registers or updates tags for an existing Keychain entry in the search index.

copy_secret_to_clipboard

Copies the secret value to the system clipboard and wipes it after auto_clear_sec.

run_cli_with_secret

Runs a CLI command (list[str], shell=False) with the secret injected into env_var_name and redacts outputs.

Security Model

  1. No Secret Echoing: None of the MCP tools return plaintext credentials to the model.

  2. Process Isolation: CLI commands execute via subprocess.run(..., shell=False) with argument lists to prevent shell expansion attacks (e.g., echo \$TOKEN).

  3. Output Sanitization: Both raw and Base64-encoded representations of the injected secret are scrubbed (***REDACTED***) from stdout and stderr before returning to the client.

  4. Blocked Dump Binaries: Direct environment inspection commands (env, printenv, set, export) are blocked by default.

Credits

This project was developed with the assistance of Google AI (Gemini).

License

This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      A cross-platform secrets manager that stores named credential sets in the system keychain and injects them as environment variables, enabling secure secret management for AI coding assistants and CLI tools.
      13
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Local credential broker that enables AI agents to securely run CLI tools like SSH and MySQL without exposing passwords to the AI context, environment variables, or process listings.
      3
      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
      B
      maintenance
      Enables AI agents to scan and audit environment files for leaked secrets, sanitize them, encrypt/decrypt vaults, and run processes with zero-disk secret injection.
      MIT