Skip to main content
Glama

terminal-reader-mcp

An MCP server that gives Claude Desktop read-only access to your terminal output. No more copy-pasting errors — just ask Claude to check your terminal.

Quickstart

1. Clone and install

git clone https://github.com/chrisvin-jabamani/terminal-reader-mcp.git
cd terminal-reader-mcp
npm install

2. Add the cap function to your shell

The MCP server can only read files — it can't see your terminal directly. The cap function wraps your commands and saves their output to a log file that Claude can read.

Open your shell config:

open ~/.zshrc

Paste this at the bottom:

# Capture terminal output for Claude
cap() {
  local log_file="$HOME/.terminal_history.log"
  local exit_code
  
  echo "---CMD---" >> "$log_file"
  echo "$ $*" >> "$log_file"
  echo "---OUTPUT---" >> "$log_file"
  
  "$@" 2>&1 | tee -a "$log_file"
  exit_code=${pipestatus[1]}
  
  echo "" >> "$log_file"
  echo "---EXIT:$exit_code---" >> "$log_file"
  echo "---END---" >> "$log_file"
  
  return $exit_code
}

Save, then reload:

source ~/.zshrc

3. Configure Claude Desktop

Open the config:

open ~/Library/Application\ Support/Claude/claude_desktop_config.json

Add the terminal-reader server:

{
  "mcpServers": {
    "terminal-reader": {
      "command": "node",
      "args": ["/FULL/PATH/TO/terminal-reader-mcp/index.js"]
    }
  }
}

Replace /FULL/PATH/TO/ with where you cloned the repo.

4. Restart Claude Desktop

Quit completely (Cmd+Q) and reopen.

5. Test it

cap echo "hello from terminal"

Ask Claude: "what was my last terminal command?"


Related MCP server: Tmux MCP Server

Usage

Prefix commands with cap when you want Claude to see them:

cap npm run dev
cap python script.py
cap cargo build

Commands without cap are not captured.

Available Tools

5 tools
clear_historyClear Terminal HistoryB

Clear the captured terminal history log file.

Inputs: no named parameters.

get_last_commandGet Last CommandA

Get the most recent terminal command and its output. Use this to see what the user just ran in their terminal.

Inputs: no named parameters.

get_last_errorGet Last ErrorA

Get the last terminal command only if it failed (non-zero exit code). Returns nothing if the last command succeeded.

Inputs: no named parameters.

get_recent_commandsGet Recent CommandsC

Get the last N terminal commands and their outputs.

Inputs: count.

search_outputSearch Terminal OutputB

Search through recent terminal output for a specific pattern or error message.

Inputs: pattern (required), count.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: clear_history manages the log file, get_last_command retrieves the most recent command and output, get_last_error specifically targets failed commands, get_recent_commands provides a configurable history view, and search_output enables pattern matching. The descriptions make it easy to differentiate between them.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case: clear_history, get_last_command, get_last_error, get_recent_commands, and search_output. This uniformity makes the tool set predictable and easy to understand at a glance.

    Tool Count5/5

    With 5 tools, this server is well-scoped for its purpose of reading terminal history. Each tool serves a specific function in the workflow, from basic retrieval to advanced search, without being overly sparse or bloated. The count aligns perfectly with the domain's needs.

    Completeness4/5

    The tool set covers core operations for terminal history reading: clearing, retrieving recent and specific commands, handling errors, and searching. A minor gap is the lack of a tool to capture or stream live terminal output, but the existing tools provide a complete surface for historical analysis that agents can work with effectively.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables Claude Desktop to interact with and view tmux session content, allowing AI assistants to read from, control, and observe terminal sessions.
      13
      589 npm
      306
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Monitors development commands and exposes terminal output to Claude in real-time, allowing AI assistants to see errors, logs, and stack traces without copy-pasting.
      10 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A VSCode and Cursor extension that captures real-time terminal output and exposes it to AI assistants via the Model Context Protocol. It enables agents to proactively monitor logs, command execution, and errors without requiring manual copy-pasting from the user.
      3
      MIT