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?"


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.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrisvin-jabamani/terminal-reader-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server