Terminal MCP Server is a Model Context Protocol (MCP) server that allows executing commands on local or remote hosts. It provides a simple yet powerful interface for AI models and other applications to execute system commands, either on the local machine or on remote hosts via SSH.
To install terminal-mcp-server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @weidwonder/terminal-mcp-server --client claude
# Clone the repository
git clone https://github.com/weidwonder/terminal-mcp-server.git
cd terminal-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Start the server using stdio (default mode)
npm start
# Or run the built file directly
node build/index.js
The SSE (Server-Sent Events) mode allows you to connect to the server remotely via HTTP.
# Start the server in SSE mode
npm run start:sse
# Or run the built file directly with SSE flag
node build/index.js --sse
# Start the MCP Inspector tool
npm run inspector
execute_command
ToolThe execute_command
tool is the core functionality provided by Terminal MCP Server, used to execute commands on local or remote hosts.
Parameter | Type | Required | Description |
---|---|---|---|
command | string | Yes | The command to execute |
host | string | No | The remote host to connect to. If not provided, the command will be executed locally |
username | string | Required when host is specified | The username for SSH connection |
session | string | No | Session name, defaults to "default". The same session name will reuse the same terminal environment for 20 minutes |
env | object | No | Environment variables, defaults to an empty object |
{
"command": "ls -la",
"session": "my-local-session",
"env": {
"NODE_ENV": "development"
}
}
{
"host": "example.com",
"username": "user",
"command": "ls -la",
"session": "my-remote-session",
"env": {
"NODE_ENV": "production"
}
}
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}
~/.cline/config.json
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}
&&
to connect multiple commandsnohup
or screen
/tmux
~/.ssh/id_rsa
)Make LLM can control your PC or Server with ssh or terminal.