Skip to main content
Glama

Terminal MCP

Cross-platform MCP server for managing visible terminal sessions.

Features

  • Cross-platform: Supports macOS, Windows, Linux, and WSL

  • Visible terminals: Opens real terminal windows that users can see and interact with

  • Multiple sessions: Manage multiple terminal sessions simultaneously

  • Auto-cleanup: Automatically closes terminals when MCP server stops

Related MCP server: MCP Terminal Server

Installation

Since this package is not published on PyPI, install it directly from the repository:

uv pip install "git+https://github.com/Hor1zonZzz/terminal-mcp.git"

Option 2: Install from a local clone

git clone https://github.com/Hor1zonZzz/terminal-mcp.git
cd terminal-mcp
uv pip install -e .

Usage

Claude Desktop Configuration

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "terminal": {
      "command": "uv",
      "args": ["run", "terminal-mcp"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "terminal": {
      "command": "terminal-mcp"
    }
  }
}

Available Tools

terminal_create_or_get

Create a new visible terminal window or get an existing one by name.

Parameters:

  • name (optional): Name for the terminal session

  • working_dir (optional): Working directory for the terminal

Returns: Session ID, name, platform, and status message

terminal_send_input

Send input (command or text) to a terminal.

Parameters:

  • session_id: The terminal session ID

  • text: The command/text to send

terminal_get_output

Get the output from a terminal.

Parameters:

  • session_id: The terminal session ID

  • lines (optional): Number of lines to retrieve (default: 100, max: 1000)

terminal_list

List all active terminal sessions.

terminal_close

Close a terminal session.

Parameters:

  • session_id: The terminal session ID to close

Platform Support

Platform

Terminal Used

macOS

Terminal.app (via AppleScript)

Windows

Windows Terminal (wt.exe) or cmd.exe

Linux

gnome-terminal, konsole, xfce4-terminal, xterm, etc.

WSL

Windows Terminal from WSL

How It Works

  1. Terminal Creation: Opens a real terminal window using platform-specific methods

  2. Communication: Uses named pipes (Unix) or file polling (Windows) for bidirectional communication

  3. Output Capture: Logs terminal output to temporary files for retrieval

  4. Cleanup: Automatically closes all terminals when the MCP server stops (via atexit and signal handlers)

License

MIT

Available Tools

5 tools
terminal_closeA
DestructiveIdempotent

Close a terminal session.

Closes the terminal window and cleans up associated resources.

Args:
    session_id: The terminal session ID to close.

Returns:
    dict: Contains success status and message.
ParametersJSON Schema
NameRequiredDescriptionDefault
session_idYes

TDQS

A4.2/5.0
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it mentions 'cleans up associated resources,' which clarifies the scope of the destructive action hinted at by destructiveHint=true. It also notes the return format ('dict: Contains success status and message'), providing output expectations not covered by annotations. No contradictions with annotations exist.

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 well-structured and front-loaded with the core purpose, followed by details on behavior, args, and returns. Each sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

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 complexity (destructive action with one parameter), annotations cover safety and idempotency, and the description adds behavioral and output details. However, without an output schema, the description could more fully explain return values (e.g., specific keys in the dict). It is mostly complete but has minor gaps.

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 description adds minimal semantics for the single parameter ('The terminal session ID to close'), but schema description coverage is 0%, so the schema provides no details. The description compensates slightly by explaining the parameter's role, but it lacks format or source guidance (e.g., from terminal_list). Baseline is 3 due to low schema coverage and partial compensation.

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 action ('Close a terminal session') and resource ('terminal window and associated resources'), distinguishing it from sibling tools like terminal_create_or_get (create/get), terminal_get_output (read output), terminal_list (list sessions), and terminal_send_input (send input). It provides a complete picture of what the tool does.

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 implies usage context by specifying it closes a terminal session, suggesting it should be used when a session is no longer needed. However, it does not explicitly state when not to use it (e.g., while actively using the terminal) or name alternatives like terminal_list to find session IDs, leaving some guidance gaps.

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

terminal_create_or_getA
Idempotent

Create a new visible terminal window or get an existing one by name.

The terminal opens in a visible window that the user can interact with directly.
Commands sent to this terminal will be executed in that visible window.

Args:
    name: Optional name for the terminal. If a terminal with this name
          already exists and is still alive, it will be returned instead
          of creating a new one.
    working_dir: Optional working directory for the terminal.
                 If not specified, uses the current working directory.

Returns:
    dict: Contains session_id, name, platform, and a status message.
          Use the session_id for subsequent operations.

Examples:
    - Create unnamed terminal: terminal_create_or_get()
    - Create named terminal: terminal_create_or_get(name="dev-server")
    - Get existing terminal: terminal_create_or_get(name="dev-server")
ParametersJSON Schema
NameRequiredDescriptionDefault
nameNo
working_dirNo

TDQS

A4.4/5.0
Behavior4/5

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

The description adds valuable behavioral context beyond annotations. Annotations indicate readOnlyHint=false (mutation), openWorldHint=true (can create new resources), idempotentHint=true (safe to retry), and destructiveHint=false (non-destructive). The description elaborates on behavior: terminals are 'visible' and user-interactive, commands execute in that window, and it explains the idempotent behavior (returns existing terminal if alive). It does not mention rate limits or auth needs, but provides useful operational details.

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 well-structured and front-loaded: the first sentence states the purpose, followed by behavioral details, parameter explanations, return info, and examples. Each sentence earns its place by adding value (e.g., explaining visibility, idempotency, parameter defaults, usage of session_id). No wasted words.

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 moderate complexity (mutation with idempotency), rich annotations, and no output schema, the description is largely complete. It covers purpose, behavior, parameters, returns, and examples. However, it lacks explicit error handling or edge cases (e.g., what happens if terminal name conflicts or working_dir is invalid), and the return dict fields are listed but not fully explained (e.g., what 'platform' means).

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?

With 0% schema description coverage (schema only has titles 'Name' and 'Working Dir'), the description fully compensates by explaining both parameters. It clarifies that 'name' is optional and used for idempotent retrieval, and 'working_dir' is optional with a default (current directory). This adds essential meaning beyond the bare schema, though it could specify format constraints (e.g., path syntax).

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: 'Create a new visible terminal window or get an existing one by name.' It specifies the verb (create/get), resource (terminal window), and distinguishes it from siblings like terminal_close (closing), terminal_get_output (reading output), terminal_list (listing), and terminal_send_input (sending input).

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 this tool: to open or retrieve a visible terminal window. It implies usage through examples (e.g., creating unnamed/named terminals, getting existing ones) but does not explicitly state when to use alternatives like terminal_list for listing or terminal_close for closing, nor does it mention exclusions (e.g., when not to create a new terminal).

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

terminal_get_outputA
Read-onlyIdempotent

Get the output from a terminal.

Retrieves the recent output from the terminal's history. This includes
both command inputs and their outputs.

Args:
    session_id: The terminal session ID returned by terminal_create_or_get.
    lines: Number of lines to retrieve from the end (default: 100, max: 1000).

Returns:
    dict: Contains success status, session_id, and the output text.

Examples:
    - Get last 100 lines: terminal_get_output(session_id="abc123")
    - Get last 50 lines: terminal_get_output(session_id="abc123", lines=50)

Note:
    Output may have a slight delay as it's captured asynchronously from
    the terminal process.
ParametersJSON Schema
NameRequiredDescriptionDefault
session_idYes
linesNo

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false. The description adds valuable behavioral context beyond annotations: it explains that output includes both command inputs and outputs, mentions a slight delay due to asynchronous capture, and specifies default/max lines. This enhances understanding of the tool's 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 well-structured and front-loaded with purpose, followed by detailed sections (Args, Returns, Examples, Note). Every sentence adds value: no repetition or fluff, and information is efficiently organized for clarity.

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

Completeness5/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, no output schema, and rich annotations, the description is complete. It covers purpose, usage, parameters, return values, examples, and behavioral notes. The annotations handle safety and idempotency, while the description fills in operational details adequately.

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?

Schema description coverage is 0%, so the description carries full burden. It effectively explains both parameters: session_id's source (from terminal_create_or_get) and lines' purpose (number to retrieve from the end), default (100), and max (1000). This adds meaningful semantics beyond the bare schema.

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 specific verbs ('Get the output', 'Retrieves the recent output') and resource ('from a terminal'). It distinguishes from siblings by focusing on output retrieval rather than session management (terminal_create_or_get, terminal_close), listing (terminal_list), or input sending (terminal_send_input).

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 usage: it's for retrieving terminal output, with session_id from terminal_create_or_get. However, it doesn't explicitly state when NOT to use it or name alternatives for similar functions, though siblings suggest distinct purposes.

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

terminal_listA
Read-onlyIdempotent

List all active terminal sessions.

Returns information about all terminal sessions that are currently
open and active.

Returns:
    dict: Contains a list of terminal sessions with their details.
ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.6/5.0
Behavior4/5

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

The description adds useful behavioral context beyond annotations. Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false, covering safety and idempotency. The description adds that it returns 'all terminal sessions that are currently open and active', specifying scope and state, and describes the return format as a dict with session details, which is valuable since there's no output schema.

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

Conciseness4/5

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

The description is concise and well-structured: it starts with the core purpose, elaborates on scope and return details, and uses clear sentences. However, the 'Returns:' section is slightly redundant with the prior sentence, slightly reducing efficiency.

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 low complexity (0 parameters, no output schema) and rich annotations, the description is mostly complete. It explains what the tool does and what it returns. A minor gap is lack of error handling or edge case info, but overall it provides sufficient context for an agent to use it effectively.

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?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description appropriately doesn't discuss parameters, as none exist, and focuses on the tool's function and output instead.

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: 'List all active terminal sessions' specifies the verb (list) and resource (terminal sessions). It distinguishes from siblings like terminal_close (close) and terminal_create_or_get (create/get), but doesn't explicitly contrast with terminal_get_output (get output) or terminal_send_input (send input), which are different operations.

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, context for usage, or exclusions. For example, it doesn't clarify if this should be used before terminal_get_output to identify sessions, or if it's only for monitoring purposes.

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

terminal_send_inputA
Destructive

Send input (command or text) to a terminal.

The input is sent to the visible terminal window and executed there.
The user can see the command being executed in real-time.

Args:
    session_id: The terminal session ID returned by terminal_create_or_get.
    text: The text/command to send. This will be executed as a shell command.

Returns:
    dict: Contains success status, session_id, and the sent text.

Examples:
    - Run a command: terminal_send_input(session_id="abc123", text="ls -la")
    - Start a server: terminal_send_input(session_id="abc123", text="npm start")
    - Run Python: terminal_send_input(session_id="abc123", text="python script.py")

Note:
    The command is executed asynchronously. Use terminal_get_output to
    retrieve the results after the command completes.
ParametersJSON Schema
NameRequiredDescriptionDefault
session_idYes
textYes

TDQS

A4.6/5.0
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it notes that commands execute asynchronously, users can see execution in real-time, and results must be retrieved with terminal_get_output. Annotations indicate destructiveHint=true (mutation) and readOnlyHint=false (write operation), which align with the description's 'send' and 'execute' actions, with no contradiction.

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 well-structured and front-loaded, starting with a clear purpose, followed by usage notes, args, returns, examples, and a critical note. Each sentence adds value without redundancy, such as explaining asynchronous execution and result retrieval, making it efficient and easy to parse.

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 complexity (destructive, asynchronous execution) and lack of output schema, the description is largely complete: it covers purpose, usage, parameters, returns, and key behavioral notes. However, it doesn't explicitly address error handling or security implications (e.g., command injection risks), leaving minor 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?

With 0% schema description coverage, the description compensates by explaining both parameters: session_id is 'returned by terminal_create_or_get' and text is 'the text/command to send' that 'will be executed as a shell command'. This adds meaningful semantics beyond the bare schema, though it doesn't detail constraints like text length or session_id format.

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 ('send') and resource ('input to a terminal'), distinguishing it from siblings like terminal_close (closes sessions), terminal_create_or_get (creates/retrieves sessions), terminal_get_output (retrieves results), and terminal_list (lists sessions). It specifies that input is sent to a visible terminal window for execution.

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 provides explicit guidance on when to use this tool (e.g., to run commands, start servers, or execute Python scripts) and when not to use it (e.g., use terminal_get_output to retrieve results after command completion). It also references terminal_create_or_get as a prerequisite for obtaining session_id, effectively distinguishing it from alternatives.

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

TDQS

A4.3/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no ambiguity. terminal_create_or_get creates/retrieves sessions, terminal_send_input sends commands, terminal_get_output retrieves output, terminal_list shows active sessions, and terminal_close terminates sessions. The boundaries between these operations are well-defined and non-overlapping.

Naming Consistency5/5

All tools follow a perfect verb_noun pattern with 'terminal_' prefix and snake_case throughout. The naming is highly predictable: terminal_create_or_get, terminal_send_input, terminal_get_output, terminal_list, terminal_close. This consistency makes the tool set immediately understandable.

Tool Count5/5

Five tools is ideal for this terminal management domain. The set covers the complete lifecycle: create/retrieve, send input, get output, list sessions, and close sessions. Each tool earns its place with no redundancy, and the count is neither too sparse nor overwhelming for the scope.

Completeness5/5

The tool surface provides complete CRUD/lifecycle coverage for terminal management. It supports creating/retrieving terminals, sending commands, getting output, listing active sessions, and closing sessions. There are no obvious gaps or dead ends for agents working with terminal operations.

Maintenance

ActivityInactive
ResponsivenessNo issues

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
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with terminal environments through multiple concurrent PTY sessions. Supports cross-platform terminal operations including command execution, session management, and real-time communication.
    27
    3
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Provides cross-platform terminal access through MCP, enabling AI assistants to create and manage interactive terminal sessions, execute commands, and capture visual snapshots on Windows, Linux, and macOS.
    1
    MIT
  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables interactive terminal sessions within Claude Code and Desktop, allowing users and AI to execute commands and manage multiple tabs.
    2

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/Hor1zonZzz/terminal-mcp'

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