Skip to main content

Secure secret vault for AI agents via Model Context Protocol (MCP)

Project description

Keysmith MCP 🔐

PyPI version Tests Passing License: MIT

Secure secret vault for AI agents using the Model Context Protocol (MCP). Give your agents access to what they need, without compromising your master password or exposing long-lived credentials.

Why Keysmith?

AI agents and autonomous systems often need access to API keys, database credentials, or other secrets to perform tasks. Most current solutions involve:

  1. Environment Variables: Hard to manage, visible to all processes, and persist indefinitely.
  2. Hardcoding: Dangerous and bad practice.
  3. Complex Vaults (HashiCorp/1Password): Overkill for local agent development, often requiring complex CLI authentication.

Keysmith is designed to be the "Goldilocks" solution: simple enough for a single developer, yet secure enough to protect your most sensitive keys.

Key Features

  • Strong Encryption: Uses Fernet (AES-128-CBC) with key derivation via PBKDF2 (SHA-256, 480k iterations).
  • Time-To-Live (TTL): Automatically expires secrets after a set period. Great for temporary agent access.
  • Audit Logging: Every single access (or attempted access) is logged to ~/.keysmith/audit.log.
  • MCP Native: Implements the Model Context Protocol, making it plug-and-play with any MCP-compatible environment or autonomous agent.
  • Multi-Agent Swarms: Designed to support multiple agents on the same machine reading from the same vault simultaneously.

    [!NOTE] Multi-agent file locking currently requires Unix/macOS. Windows support is planned for v0.2.

Installation

pip install keysmith-mcp

Quickstart

  1. Initialize the vault:

    keysmith init
    

    This will prompt you for a master password and create your encrypted vault in ~/.keysmith/.

  2. Add a secret:

    # Permanent secret
    keysmith add OPENAI_KEY sk-your-key
    
    # Secret that expires in 3 hours (180 minutes)
    keysmith add GITHUB_TOKEN ghp_your_token --ttl 180
    
    # Short-lived secret for a single task (30 minutes)
    keysmith add STRIPE_KEY sk_live_... --ttl 30
    
  3. Configure your MCP Client: Add Keysmith to your MCP host configuration file (e.g., mcp_config.json or your custom agent settings):

    {
      "mcpServers": {
        "keysmith": {
          "command": "keysmith",
          "args": ["serve"],
          "env": { "KEYSMITH_PASSWORD": "your-master-password" }
        }
      }
    }
    

Security Model

Keysmith follows a simple but robust security model:

  • At Rest: Your data is stored in ~/.keysmith/vault.enc, encrypted with a key derived from your master password + a unique salt.
  • In Memory: The MCP server requires the KEYSMITH_PASSWORD environment variable. It decrypts the vault into memory only when the server starts.
  • Agent Visibility:
    • list_secrets: Agent sees only the names (e.g., STRIPE_KEY), never the values.
    • get_secret: Agent gets the value. This action is permanently recorded in the audit log.
    • add_secret: Agent can store new temporary credentials.
    • revoke_secret: Agent can "self-destruct" a key after use.

Comparison

Feature 1Password / Vault Env Vars Keysmith
Setup Complexity High Low Low
Agent Integration Via custom SDKs Native Native (MCP)
Audit Logs Yes (Enterprise) No Yes (Built-in)
Auto-Expiry No No Yes (TTL)
Local First Mostly Cloud Yes Yes
Multi-Agent Support No No Yes

Roadmap

  • OS keychain integration (macOS Keychain, Windows Credential Locker)
  • Local web dashboard for audit log visualization
  • .env file importer

License

MIT - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keysmith_mcp-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keysmith_mcp-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file keysmith_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: keysmith_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for keysmith_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32bde50eadd0af8bf1abb5a6a02b91c716e27e4807e0a25e4a80f0ab89dce8fe
MD5 c9f30c9db337412b427a7d423ec22e67
BLAKE2b-256 ba655d034d06f0fd4a7f012b5ab4c31076b0434f532fc7e09f35d3f8873f6d78

See more details on using hashes here.

File details

Details for the file keysmith_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: keysmith_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for keysmith_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb185e1a9e16b39f7654df1051b904b309ca0b67f733921fee47bed295d05e15
MD5 f28e26720d38ae4cbabf167c6cddc1e7
BLAKE2b-256 fbedc40bb29fe077d3c2c5912bbe1bf5c38f5d26ab3484b2e2887dcdc3fda7b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page