Terminal History MCP

Terminal History MCP

Developers: Search your zsh, bash, or fish shell history from Claude Code, Cline, Cursor, Zed, or any MCP client using tools like search_history (full-text with timestamp/CWD/exit code), recent_in_dir, failed_commands, and command_chains for multi-step sequences. Reindex after new activity. Local-only SQLite FTS5 with secrets redacted before storage.

Category
Visit Server

README

<p align="center"> <img src="logo.svg" alt="terminal-history-mcp logo" width="160" height="160"> </p>

terminal-history-mcp

MCPize mcp.so CI npm version License: MIT

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.

demo

What you can ask

  • "When did I last ssh into the staging server?"
  • "Show recent failed commands."
  • "What did I run yesterday in /etc/nginx?"
  • "What's that long docker compose flag I used 3 weeks ago?"
  • "Show command chains around kubectl apply."

Install

npm install -g terminal-history-mcp
terminal-history-mcp index           # one-time backfill from existing history

(Or run from a clone: git clone … && npm install && npm run build && npm link.)

Wire to Claude Code

claude mcp add --scope user terminal-history -- terminal-history-mcp
claude mcp list

Wire to other MCP clients

Anywhere that takes a stdio MCP server config:

{
  "mcpServers": {
    "terminal-history": {
      "command": "terminal-history-mcp"
    }
  }
}

Connect via MCPize

Use this MCP server instantly with no local installation:

npx -y mcpize connect @HasanJahidul/terminal-history --client claude

Or connect at: https://mcpize.com/mcp/terminal-history

Capture cwd + exit code (recommended)

By default zsh/bash history files store only the command. To unlock recent_in_dir and failed_commands, install the shell hook:

terminal-history-mcp install-hook zsh    # or bash, or fish
exec $SHELL                              # reload

The hook appends pipe-delimited lines to ~/.terminal-history-mcp/extended.log. Reindex picks them up.

To inspect the snippet first:

terminal-history-mcp print-hook zsh

To remove:

terminal-history-mcp uninstall-hook zsh

Tools

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

Privacy

Everything is local. The DB lives at ~/.terminal-history-mcp/history.db. Nothing is uploaded.

Secrets are scrubbed before insert. Detected patterns:

  • GitHub PATs (ghp_*, gho_*, …)
  • OpenAI keys (sk-*)
  • Slack tokens (xox[baprs]-*)
  • AWS access keys (AKIA…)
  • Authorization: Bearer/Basic <value>
  • X-*-Token: …, X-*-Key: …, X-*-Secret: … headers
  • Env vars containing TOKEN / KEY / SECRET / PASSWORD / API_KEY
  • CLI flags --token=…, --api-key …, -k …
  • URL basic-auth https://user:pass@host
  • JWTs (eyJ.*.*)

If you find a leak, please open an issue. To wipe and re-index after upgrading patterns:

rm ~/.terminal-history-mcp/history.db*
terminal-history-mcp index

Development

git clone https://github.com/hasanjahidul/terminal-history-mcp
cd terminal-history-mcp
npm install
npm run build
npm test

License

MIT — see LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured