terminal-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@terminal-mcp-serverrun 'df -h' on prod-server"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Terminal MCP Server
The Terminal MCP Server is a Model Context Protocol (MCP) server designed to facilitate remote and local command execution, with robust SSH capabilities. It allows your AI models or other applications to securely execute commands on remote hosts via SSH or locally, providing a powerful way to interact with various systems.
Highlights
Secure SSH Command Execution: Execute commands on remote servers securely using SSH, with support for SSH alias config file parsing. Automatically parses your
~/.ssh/configfile to retrieve connection details like HostName, User, IdentityFile, Passphrase, and Port, simplifying SSH management.Local Command Execution: Run commands directly on the local machine where the MCP server is running.
Session Management with Timeout: Maintains persistent SSH sessions with configurable timeouts for efficient command execution and resource management.
Environment Variable Support: Pass environment variables to both remote and local commands.
Default Directory for Local Commands: Configure a
DEFAULT_DIRenvironment variable to specify the starting directory for local command execution.
Related MCP server: mcp-ssh
Features
Remote Command Execution: Connects to remote hosts via SSH and executes specified commands.
Local Command Execution: Executes commands on the local machine.
SSH Configuration Parsing: Reads and interprets
~/.ssh/configfor streamlined connection setup.Connection Pooling: Reuses existing SSH connections to minimize overhead.
Error Handling and Retries: Implements retry mechanisms for connection attempts and robust error reporting.
Usage
Installation
Clone the repository:
git clone https://github.com/ptbsare/terminal-mcp-server.git cd terminal-mcp-serverInstall dependencies:
npm installBuild the project:
npm run build
Running the Server
To start the MCP server:
npm startThe server will listen for incoming MCP requests.
SSH Configuration
Ensure your SSH configuration (~/.ssh/config) is set up correctly for the hosts you wish to connect to. The server will automatically parse this file.
Example ~/.ssh/config:
Host my_remote_server
HostName your_remote_server_ip_or_hostname
User your_username
IdentityFile ~/.ssh/id_rsa
Port 22
# Passphrase your_passphrase (uncomment and set if your key is encrypted)Using with Claude (or other AI models)
To integrate this MCP server with Claude, you need to configure Claude to connect to a local MCP server.
Start the Terminal MCP Server as described above.
Configure Claude: In your Claude environment, you will typically add a tool definition that points to this MCP server. The exact configuration steps depend on the Claude interface or API you are using.
To configure the MCP server for Claude, you would typically create a JSON file (e.g.,
mcp_server.json) with the following structure:{ "mcpServers": { "terminal-mcp-server": { "command": "npm", "args": [ "--prefix", "/path/to/terminal-mcp-server", "run", "start" ] } } }This server provides a single tool:
execute_command.Tool:
execute_commandDescription: Executes a shell command on a remote host via SSH or locally.
Parameters:
command(string, required): The shell command to execute.host(string, optional): The SSH host alias from your~/.ssh/configto execute the command on. If not provided, the command will be executed locally.env(object, optional): Environment variables to set for the command execution. Keys and values should be strings.
Save this JSON content as
mcp_server.json(or any other name) and provide it to Claude's MCP configuration. The exact method for providing this configuration depends on your Claude environment (e.g., via a specific UI, API call, or configuration file).
Local Command Default Directory
You can set an environment variable DEFAULT_DIR before starting the terminal-mcp-server to specify the default working directory for local commands.
Example:
DEFAULT_DIR="/workdir" npm startThis will make all local commands executed via the MCP server start in /workdir unless explicitly overridden.
Available Tools
1 toolexecute_commandC
Execute commands on remote hosts or locally (This tool can be used for both remote hosts and the current machine)
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Environment variables | |
| host | No | Host to connect to (optional, if not provided the command will be executed locally) | |
| command | Yes | Command to execute. Before running commands, it's best to determine the system type (Mac, Linux, etc.) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden of disclosure. It does not mention that command execution can be destructive, require permissions, or produce side effects. The only behavioral detail (remote/local) is already evident from the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is short, but the parenthetical 'This tool can be used for both remote hosts and the current machine' repeats the first clause. This redundancy is somewhat inefficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a command execution tool with no output schema and no annotations, the description is severely lacking. It does not explain return values, error handling, or the potential for system-altering effects, which is essential for a tool of this power.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The tool description adds no parameter-level detail, but the schema descriptions for command, host, and env are clear and include relevant context like checking system type.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it executes commands on remote hosts or locally, which is a specific verb+resource combination. There are no sibling tools to differentiate from, so the clarity is sufficient.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description mentions it works for remote and local hosts, but provides no guidance on when to use this tool versus alternatives or when not to use it. No exclusions or preconditions are given.
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 tool update
v0.0.1- First observed
execute_command
TDQS
There is only one tool, so no ambiguity exists between tools. The tool's purpose is clearly stated to execute commands on remote or local hosts.
The single tool is named 'execute_command', which follows a clear verb_noun pattern. Consistency is trivially maintained with only one tool.
The server provides a single tool, which feels thin for a terminal server. While the tool is broad, additional tools for file operations or process management would be expected.
The tool covers basic command execution, which is the core functionality. However, it lacks features like interactive session handling, background process management, or file transfer, which are common gaps for terminal servers.
Maintenance
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
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Secure tunneling, reverse proxy and remote access for local applications.
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables SSH connections and remote command execution with persistent session management and real-time browser-based terminal monitoring. Supports multiple simultaneous SSH sessions with command history tracking and live WebSocket streaming of terminal output.6MIT
- AlicenseBqualityDmaintenanceEnables secure SSH connections to remote servers for executing shell commands and managing active sessions. It supports authentication via passwords or private keys and provides optional host-based access control.4210MIT
- AlicenseCqualityFmaintenanceEnables SSH remote command execution on remote machines with persistent connections, supporting automatic key discovery and connection pooling.230MIT
- FlicenseNot gradedqualityCmaintenanceEnables remote server management via SSH, including command execution, file transfer (SFTP), and interactive shell sessions, with support for multiple hosts.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ptbsare/terminal-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server