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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Clear') which implies a destructive mutation, but doesn't specify whether this is reversible, requires permissions, affects system performance, or what happens post-execution (e.g., confirmation message, error handling). For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence that states the tool's purpose without any fluff or redundancy. It's front-loaded with the key action ('Clear') and efficiently specifies the target. Every word earns its place, making it highly concise and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive operation with no parameters) and the lack of annotations and output schema, the description is incomplete. It doesn't address critical context such as the effect of clearing (e.g., permanent deletion, system impact), success/failure responses, or safety warnings. For a mutation tool with no structured support, more behavioral details are needed to adequately inform an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately avoids mentioning any. A baseline of 4 is applied for zero-parameter tools, as the description correctly focuses on the tool's action without unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Clear') and the target resource ('the captured terminal history log file'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'get_last_command' or 'search_output', but the verb 'Clear' strongly implies a destructive operation versus their read-only nature, providing some implicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether history must exist), exclusions (e.g., irreversible effects), or direct comparisons to siblings like 'get_recent_commands' for viewing history. Usage is implied only by the tool's name and purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions retrieving command and output but lacks details on permissions, rate limits, or what happens if no recent command exists. It does not disclose behavioral traits beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core purpose and followed by usage context. Every sentence earns its place with no wasted words, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is minimal but covers the basic operation. It lacks details on return format, error handling, or dependencies, which could be important for a tool interacting with terminal history. Adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add param info, which is appropriate, but baseline is 4 for zero parameters as it avoids redundancy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific verb ('get') and resource ('most recent terminal command and its output'), distinguishing it from siblings like 'get_recent_commands' (plural) and 'get_last_error' (error-specific). It explicitly identifies what the tool retrieves.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use it ('to see what the user just ran in their terminal'), but does not explicitly state when not to use it or name alternatives like 'get_recent_commands' for multiple commands. It implies usage based on recency.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly describes the tool's behavior: it returns the last terminal command only if it failed (non-zero exit code), and returns nothing if the last command succeeded. This covers the core behavioral trait effectively, though it doesn't mention potential edge cases like what happens if no commands have been run.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the tool's purpose, condition for use, and return behavior. Every word earns its place, with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is nearly complete. It explains what the tool does, when to use it, and what it returns. The only minor gap is the lack of output format details (e.g., whether it returns a string, object, or error message), but for a simple tool like this, the description is sufficient for an agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's behavior. A baseline of 4 is applied for tools with 0 parameters, as no additional semantic information is required.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('last terminal command'), and distinguishes it from siblings by specifying 'only if it failed (non-zero exit code)'. This differentiates it from tools like 'get_last_command' or 'get_recent_commands' that might return commands regardless of exit status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('only if it failed') and implies when not to use it (if the last command succeeded, it 'Returns nothing'). It also distinguishes from siblings by focusing on failed commands only, unlike 'get_last_command' which presumably returns the last command regardless of exit code.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_recent_commandsGet Recent CommandsC

Get the last N terminal commands and their outputs.

ParametersJSON Schema
NameRequiredDescriptionDefault
countNoNumber of recent commands to retrieve (1-20)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states what the tool retrieves but doesn't disclose important traits like whether it's read-only, how commands are ordered (e.g., chronological), if outputs are truncated, or any rate limits. This is inadequate for a tool with potential complexity in command history retrieval.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that retrieves historical data. It lacks details on return format (e.g., list structure, timestamps), error handling, or how 'recent' is defined (e.g., time-based vs. count-based), leaving significant gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'count' fully documented in the schema. The description adds no additional parameter semantics beyond implying 'N' corresponds to 'count', so it meets the baseline of 3 without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('last N terminal commands and their outputs'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_last_command' or 'search_output', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_last_command' or 'search_output'. There's no mention of context, prerequisites, or exclusions, leaving the agent to infer usage from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_outputSearch Terminal OutputB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
patternYesText pattern to search for (case-insensitive)
countNoNumber of recent commands to search through

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions searching 'recent terminal output' but doesn't specify what 'recent' means, whether results are paginated, if there are rate limits, or how errors are handled. This leaves significant gaps in understanding the tool's behavior beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that efficiently conveys the core functionality without unnecessary words. It's appropriately sized and front-loaded with the main purpose, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search functionality with 2 parameters), no annotations, and no output schema, the description is minimally complete. It covers the basic purpose but lacks details on behavioral traits, output format, and differentiation from siblings, leaving room for improvement in guiding the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (pattern and count). The description adds no additional parameter semantics beyond what's in the schema, such as search algorithm details or pattern matching behavior. The baseline score of 3 reflects adequate but minimal value added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as searching through recent terminal output for patterns or error messages, using specific verbs ('search through') and resources ('terminal output'). However, it doesn't explicitly differentiate from sibling tools like get_last_error or get_recent_commands, which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like get_last_error (for specific errors) or get_recent_commands (for command history), leaving the agent to infer usage context without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedclear_history
    • First observedget_last_command
    • First observedget_last_error
    • First observedget_recent_commands
    • First observedsearch_output

TDQS

A3.7/5.0
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
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    F
    maintenance
    Enables Claude Desktop to interact with and view tmux session content, allowing AI assistants to read from, control, and observe terminal sessions.
    13
    256
    299
    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.
    15
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    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

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