Terminal History Mcp

Created By
HasanJahidula month ago
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".
Overview

Terminal History MCP

Search your shell history (zsh / bash / fish) from Claude Code, Cursor, Cline, Zed, or any MCP client. Local-only. SQLite FTS5. Secret-redacted before storage.

demo

Why

  • "What was that long docker compose flag I used 3 weeks ago?"
  • "When did I last ssh into staging?"
  • "Show failed commands today."
  • "What did I run yesterday in /etc/nginx?"
  • "Show context around kubectl apply."

grep ~/.zsh_history | sort | uniq is not memory. This is.

Install

npm install -g terminal-history-mcp
terminal-history-mcp index           # one-time backfill
terminal-history-mcp install-hook    # opt-in: capture cwd / exit / duration

Or zero-install via npx:

{
  "mcpServers": {
    "terminal-history": {
      "command": "npx",
      "args": ["-y", "terminal-history-mcp"]
    }
  }
}

Tools

ToolPurpose
reindexRe-parse history files + extended log into FTS5 DB
search_historyFTS5 keyword + prefix search over command history
recent_in_dirCommands run in a given working directory
failed_commandsNon-zero-exit commands since timestamp
command_chains±5min context window around matches

Privacy / Security

  • Local-only. Nothing leaves your machine. DB at ~/.terminal-history-mcp/history.db.
  • Secrets redacted BEFORE insert — defense in depth, raw SQLite browse can't leak.
  • 11 ordered patterns: GitHub PATs (ghp_*), OpenAI keys (sk-*), Slack tokens, AWS access keys, generic Token:/Key:/Secret:/ApiKey: headers, Authorization: Bearer/Basic, env-style FOO_TOKEN=val, CLI flags (--token=val, -k val), URL basic-auth (https://user:pass@host), JWTs.
  • WAL mode — concurrent shell sessions safe.

Shell support

ShellHistory parseHook capture (cwd / exit / duration)
zsh✅ (EPOCHREALTIME)
bash✅ (awk ms math)
fish✅ (date +%s%N)

Tech

  • TypeScript (ESM), Node 18+
  • better-sqlite3 (sync, no callback hell)
  • FTS5 + porter + unicode61 — Unicode-safe, stems plurals
  • Hash-based dedupe (sha1(shell|ts|cmd)) — idempotent reindex
  • Zero network calls

Pairs with

localhost-mcp — what's currently running on which port. Together: full dev environment memory for AI agents (what you ran + what's running).

Source

Server Config

{
  "mcpServers": {
    "terminal-history": {
      "command": "npx",
      "args": [
        "-y",
        "terminal-history-mcp"
      ]
    }
  }
}
Project Info
Created At
a month ago
Updated At
a month ago
Author Name
HasanJahidul
Star
-
Language
-
License
-
Category

Recommend Servers

View All
Voyei

3 hours ago
AI Work Market — USDC settlement rails for AI labor on Base Mainnet)
@Dario (DME)

AI Work Market is a USDC escrow protocol on Base Mainnet, designed for autonomous AI agents to find work, post jobs, and settle payments without humans in the loop. This MCP server exposes 10 tools: **Escrow lifecycle** - `create_intent_quote` — get calldata + gas estimate for funding a new escrow intent - `submit_proof_quote` — get calldata for the seller to submit a proof URI - `release_funds_quote` — get calldata for the buyer to release payment (or claim/refund) **x402 single-call binding** - `x402_consume` — replaces the 5-step x402 flow with one HMAC-signed POST that returns a delivery URL **Onboarding & discovery** - `agent_onboard` — generate a signed agent card with marketplace attestation - `agent_search` — tf-idf search over the live agent catalog - `agent_reputation` — server-side reputation from on-chain Released/Refunded/Disputed events **Live state** - `system_status` — live on-chain state (nextIntentId, accumulatedFees, contract balance, owner) - `escrow_rules` — contract semantics, lifecycle, call guides, failure modes - `events_subscribe` — SSE stream of new on-chain intent events All endpoints are serverless (Vercel) and return their schema on GET. No browser, no wallet UI required for an agent to integrate. The protocol takes a 1% commission on every settlement; the rest goes to the seller. The full AgentCard is at `/.well-known/agent-card.json` (A2A-compatible). The OpenAPI 3.0.3 spec is at `/.well-known/openapi.json` with `components.securitySchemes` (none, hmacX402). `robots.txt` allows GPTBot, ClaudeBot, anthropic-ai, PerplexityBot, Google-Extended, Applebot-Extended, CCBot, Amazonbot.

13 hours ago