Skip to main content
Glama
README.md
# 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

```bash
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:
```bash
open ~/.zshrc
```

Paste this at the bottom:

```bash
# 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:
```bash
source ~/.zshrc
```

### 3. Configure Claude Desktop

Open the config:
```bash
open ~/Library/Application\ Support/Claude/claude_desktop_config.json
```

Add the terminal-reader server:

```json
{
  "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

```bash
cap echo "hello from terminal"
```

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

---

## Usage

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

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

Commands without `cap` are not captured.

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
ResponsivenessNo issues