terminal-history-mcp gives AI agents (Claude Code, Cursor, Cline, Zed, any MCP client) full-text search over your shell history.
- Local-only, no cloud — SQLite FTS5 at ~/.terminal-history-mcp/history.db
- Supports zsh, bash, fish
- Captures cwd, exit code, duration via opt-in shell hook
- 11-pattern secret redaction runs BEFORE insert (GitHub PATs, OpenAI keys, AWS, JWTs, bearer tokens, env vars, CLI flags, basic-auth URLs)
- Hash-deduped, idempotent reindex
- WAL mode — safe across parallel sessions
Ask: "When did I last ssh into staging?", "Show failed commands today", "What did I run in /etc/nginx yesterday?", "Show context around kubectl apply".
Server Config
{
"mcpServers": {
"terminal-history": {
"command": "npx",
"args": [
"-y",
"terminal-history-mcp"
]
}
}
}