# Keystash

> Keystash is an open-source MCP server for security. macOS Keychain secret broker where an agent can use your API keys but never read them. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** macOS, CLI, self-hosted
- **Website:** https://pypi.org/project/keystash/
- **Repository:** https://github.com/thu-lawyer/keystash
- **MCP Registry name:** io.github.thu-lawyer/keystash
- **Categories:** security, developer tools
- **Listing updated:** 2026-11-16

## About

keystash is built on one rule: the agent manages keys it cannot see. Values go into the macOS login Keychain and are never written to a file the tool owns, printed or returned by any interface. Only metadata such as name, tags, rotation schedule and allowed URLs sits on disk in a 0600 JSON file. The README stresses that there is no secret_read tool and no CLI command that echoes a value; the code path does not exist.

The MCP server speaks stdio only and opens no socket. It exposes six tools to list entries, store or rotate a value the user types into a native hidden dialog, generate a strong value and return only a fingerprint, call a pre-approved URL with a credential, and delete an entry after a confirmation dialog. Names must follow a SERVICE_ENV_PURPOSE pattern, and rotation intervals let keystash doctor report entries that are overdue.

It installs from PyPI, relies on macOS tools such as security, osascript and pbcopy, and uses Touch ID when a value is actually needed. The README is bilingual, in Chinese and English.

## Features

- **No read tool:** No tool or CLI command returns a stored value to the agent.
- **Keychain storage:** Values live in the macOS login Keychain; only metadata is on disk.
- **Restricted secret use:** secret_use can only call URLs approved per entry.
- **Secret generation:** Generates strong values and returns a fingerprint only.
- **Rotation tracking:** Metadata records rotation intervals and doctor flags overdue entries.
- **Stdio only:** The server opens no network socket.

## Good for

- Let an agent call an API with your key without exposing the key
- Rotate keys on a schedule through an assistant
- Generate and store a new credential without seeing it
- Audit which keys are past their rotation date

## Install

### Claude Code (Terminal)

```sh
claude mcp add keystash -- uvx keystash
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "keystash": {
      "command": "uvx",
      "args": [
        "keystash"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "keystash": {
      "command": "uvx",
      "args": [
        "keystash"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "keystash": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "keystash"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "keystash": {
      "command": "uvx",
      "args": [
        "keystash"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "keystash": {
      "command": "uvx",
      "args": [
        "keystash"
      ]
    }
  }
}
```

## Tools

- `secret_list`: Lists entries with name, tags, rotation dates and allowed URLs.
- `secret_store`: Stores a value the user types into a dialog.
- `secret_rotate`: Replaces a value the same way.
- `secret_generate`: Generates a strong value and stores it, returning a fingerprint.
- `secret_use`: Calls an allowed URL with the credential and returns the reply.
- `secret_delete`: Erases the entry and its Keychain item after a confirmation dialog.

## FAQ

### Can the agent read my keys?

No. The README says there is no secret_read tool and no code path that returns a value.

### Where are values stored?

In the macOS login Keychain; metadata is plain JSON on disk.

### How many tools does it expose?

Six: list, store, rotate, generate, use and delete.

### How do I install it?

pip install keystash or uv tool install keystash, then run keystash mcp.

### Is Keystash free?

Yes. Keystash is open source, so you can use and self-host it for free.

### How do I add Keystash to Claude Code?

Run this command in your terminal: claude mcp add keystash -- uvx keystash

### What are the best alternatives to Keystash?

The closest alternatives to Keystash are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/keystash
