Search local zsh, bash, and fish history with SQLite FTS5, metadata capture, and pre-insert secret redaction.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Terminal History MCP.
reindexRe-parses the local shell history files (`~/.zsh_history`, `~/.bash_history`) and the hook's extended log into the SQLite index. Idempotent — already-indexed commands are skipped by hash, so it is safe to call repeatedly. Run it after a burst of shell activity to make recent commands searchable. Reads only local files; writes only to `~/.terminal-history-mcp/`. Takes no arguments. Returns counts of parsed / inserted / skipped entries.
search_historyRead-only. Full-text search (SQLite FTS5, stemmed, Unicode-aware) over all indexed shell commands. Supports keyword and prefix queries — e.g. `docker build`, `git reb*`. Returns the most recent matches first, each with timestamp, shell, cwd, and exit code when available. Local index only; nothing is sent anywhere. If a query returns nothing you may need `reindex` first.
recent_in_dirRead-only. Lists the most recent commands that were run with a given working directory — answers "what was I doing in this project?". Requires the shell hook to have been installed (legacy entries have no cwd and won't appear). Returns newest first with timestamps and exit codes. Local index only.
failed_commandsRead-only. Lists recent commands that exited non-zero — a quick "what just broke?" feed. Optionally restrict to commands after a given epoch-millisecond timestamp. Requires the shell hook for exit-code capture (legacy entries have no exit code). Newest first. Local index only.
command_chainsRead-only. For each command matching `query`, returns the commands run within a time window around it (default ±5 min) — surfacing multi-step sequences like `cd → npm run build → deploy`. Useful for reconstructing "how did I do X last time?". Returns up to `limit` chains, each a time-ordered list of command rows. Local index only.
Search your shell history (zsh / bash / fish) from Claude Code, Cline, Cursor, Zed, or any MCP client. Local-only. SQLite FTS5. Secret-redacted before storage.

/etc/nginx?"kubectl apply."(Or run from a clone: git clone … && npm install && npm run build && npm link.)
Anywhere that takes a stdio MCP server config:
Use this MCP server instantly with no local installation:
Or connect at: https://mcpize.com/mcp/terminal-history
By default zsh/bash history files store only the command. To unlock recent_in_dir and failed_commands, install the shell hook:
The hook appends pipe-delimited lines to ~/.terminal-history-mcp/extended.log. Reindex picks them up.
To inspect the snippet first:
To remove:
| Tool | What it does |
|---|---|
search_history(query, limit) | FTS5 keyword + prefix match across all history |
recent_in_dir(cwd, limit) | Last N commands in a working dir (needs hook) |
failed_commands(since_ts_ms, limit) | Commands with non-zero exit (needs hook) |
command_chains(query, window_ms, limit) | For each match, list commands within ±5 min |
reindex | Re-parse history files + extended log |
Everything is local. The DB lives at ~/.terminal-history-mcp/history.db. Nothing is uploaded.
Secrets are scrubbed before insert. Detected patterns:
ghp_*, gho_*, …)sk-*)xox[baprs]-*)AKIA…)Authorization: Bearer/Basic <value>X-*-Token: …, X-*-Key: …, X-*-Secret: … headersTOKEN / KEY / SECRET / PASSWORD / API_KEY--token=…, --api-key …, -k …https://user:pass@hosteyJ.*.*)If you find a leak, please open an issue. To wipe and re-index after upgrading patterns:
MIT — see LICENSE.
Factual signals from GitHub, npm, and our automated checks — not a rating.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/hasanjahidul-terminal-history-mcp)<a href="https://allmcps.com/mcp/hasanjahidul-terminal-history-mcp"><img src="https://allmcps.com/api/badge/hasanjahidul-terminal-history-mcp?style=directory" alt="Terminal History MCP on AllMCPs" /></a>