SuperAPI AI Directory

terminal-history-mcp

Local full-text search over zsh, bash and fish history, with secret redaction and optional capture of cwd, exit code and duration.

Open website

About this tool

terminal-history-mcp is used to search the local machine's shell history (zsh / bash / fish) in an MCP client, with data kept entirely local.

Purpose:

  • Answer questions related to command history, such as "When was the last time I ssh'd to the staging server", "Show recent failed commands", "What did I run in /etc/nginx yesterday", "What was that long docker compose argument I used three weeks ago", "Show the command chain around kubectl apply".

Main capabilities:

  • Local SQLite FTS5 full-text search.
  • Supports zsh, bash, and fish history sources.
  • Performs secret redaction before storage.
  • Optionally captures the working directory, exit code, and duration of commands to support queries such as recent_in_dir and failed_commands.

How to use:

  • Build from a clone: git clone … && npm install && npm run build && npm link .
  • Integrate with Claude Code, or integrate with other MCP clients, that is, any environment that supports stdio MCP server configuration.
  • Use instantly via MCPize without local installation:https://mcpize.com/mcp/terminal-history
  • Capture cwd and exit code (recommended): by default, zsh/bash history files only store the command itself; to unlock recent_in_dir and failed_commands, you need to install a shell hook. This hook appends pipe-delimited lines to ~/.terminal-history-mcp/extended.log, and they can be read after reindexing. It is recommended to review the code snippet before installing.

Data and security:

  • All local: the database is located at ~/.terminal-history-mcp/history.db and will not be uploaded.
  • Secrets are sanitized before insertion; detected patterns include: GitHub PAT (ghp_, gho_, etc.), OpenAI keys (sk-), Slack tokens (xox[baprs]-), AWS access keys (AKIA…), Authorization: Bearer/Basic <value>, X--Token/Key/Secret headers, environment variables containing TOKEN/KEY/SECRET/PASSWORD/API_KEY, CLI arguments --token=…, --api-key …, -k …, URL basic authentication https://user:pass@host、JWT(eyJ..*)。
  • If a leak is found, it can be reported via an issue. After upgrading the redaction patterns, you can clear and reindex.

License: MIT, see LICENSE for details.

Limitations: the current material does not provide the supported platform scope, performance metrics, or security guarantees beyond the redaction patterns above; charging models and prices are not mentioned.