概要
What is Terminal History MCP?
Terminal History MCP lets AI coding agents search your local shell history (zsh, bash, fish) using SQLite FTS5 full‑text search. Commands are secret‑redacted before storage and never leave your machine.
How to use Terminal History MCP?
Install globally with npm, then run terminal-history-mcp index for a one‑time backfill and terminal-history-mcp install-hook to capture working directory, exit code, and duration. Alternatively, use zero‑install via npx by adding it to your mcpServers configuration. Tools available: reindex, search_history, recent_in_dir, failed_commands, command_chains.
Key features of Terminal History MCP
- Local‑only SQLite FTS5 search of shell history
- Supports zsh, bash, and fish shells
- Secrets redacted before storage
- Tools for search, recent commands, failures, chains
- Idempotent reindex with hash dedupe
- Zero network calls, fully offline
Use cases of Terminal History MCP
- Recall long or forgotten commands from weeks ago
- Investigate failed commands with non‑zero exit codes
- Find commands run in a specific working directory
- Get context windows around matching commands
- Pair with localhost‑MCP for full dev environment memory
FAQ from Terminal History MCP
What shells does Terminal History MCP support?
It supports zsh, bash, and fish. All three have both history parsing and optional hook‑based capture for exit code, duration, and working directory.
How is privacy managed?
Data stays entirely local. Secrets are redacted before insertion using 11 ordered patterns (GitHub PATs, OpenAI keys, AWS keys, etc.). The database is at ~/.terminal-history-mcp/history.db.
Does Terminal History MCP require an internet connection?
No. It makes zero network calls and runs fully offline.
How do I install Terminal History MCP?
Install via npm install -g terminal-history-mcp, then index your history. Or skip installation by using npx -y terminal-history-mcp in your MCP client configuration.
What data is captured with the hook?
The optional hook captures the current working directory, exit code, and execution duration for each command, enriching the searchable history.
