Terminal MCP Server
Servidor MCP de terminal
El Servidor Terminal MCP es un servidor de Protocolo de Contexto de Modelo (MCP) que permite ejecutar comandos en hosts locales o remotos. Proporciona una interfaz sencilla pero potente para que los modelos de IA y otras aplicaciones ejecuten comandos del sistema, ya sea en el equipo local o en hosts remotos mediante SSH.
Características
Ejecución de comandos locales : ejecuta comandos directamente en la máquina local
Ejecución remota de comandos : ejecute comandos en hosts remotos a través de SSH
Persistencia de sesión : Compatibilidad con sesiones persistentes que reutilizan el mismo entorno de terminal durante un tiempo específico (predeterminado 20 minutos)
Variables de entorno : establezca variables de entorno personalizadas para los comandos
Múltiples métodos de conexión : Conéctese a través de stdio o SSE (eventos enviados por el servidor)
Related MCP server: mcp-remote-ssh
Instalación
Instalación mediante herrería
Para instalar terminal-mcp-server para Claude Desktop automáticamente a través de Smithery :
npx -y @smithery/cli install @weidwonder/terminal-mcp-server --client claudeInstalación manual
# 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 buildUso
Iniciando el servidor
# Start the server using stdio (default mode)
npm start
# Or run the built file directly
node build/index.jsIniciar el servidor en modo SSE
El modo SSE (eventos enviados por el servidor) le permite conectarse al servidor de forma remota a través de HTTP.
# Start the server in SSE mode
npm run start:sse
# Or run the built file directly with SSE flag
node build/index.js --ssePuede personalizar el servidor SSE con las siguientes opciones de línea de comandos:
Opción | Descripción | Por defecto |
| El puerto para escuchar | 8080 |
| La ruta del punto final | /sse |
| El host al que vincularse | host local |
Ejemplo con opciones personalizadas:
# Start SSE server on port 3000, endpoint /mcp, and bind to all interfaces
node build/index.js --sse --port 3000 --endpoint /mcp --host 0.0.0.0Esto iniciará el servidor y escuchará conexiones SSE en http://0.0.0.0:3000/mcp .
Pruebas con MCP Inspector
# Start the MCP Inspector tool
npm run inspectorLa herramienta execute_command
La herramienta execute_command es la funcionalidad principal proporcionada por Terminal MCP Server, utilizada para ejecutar comandos en hosts locales o remotos.
Parámetros
Parámetro | Tipo | Requerido | Descripción |
dominio | cadena | Sí | El comando a ejecutar |
anfitrión | cadena | No | El host remoto al que conectarse. Si no se proporciona, el comando se ejecutará localmente. |
nombre de usuario | cadena | Obligatorio cuando se especifica el host | El nombre de usuario para la conexión SSH |
sesión | cadena | No | Nombre de sesión, predeterminado: "predeterminado". El mismo nombre de sesión reutilizará el mismo entorno de terminal durante 20 minutos. |
entorno | objeto | No | Variables de entorno, el valor predeterminado es un objeto vacío |
Ejemplos
Ejecutar un comando localmente
{
"command": "ls -la",
"session": "my-local-session",
"env": {
"NODE_ENV": "development"
}
}Ejecución de un comando en un host remoto
{
"host": "example.com",
"username": "user",
"command": "ls -la",
"session": "my-remote-session",
"env": {
"NODE_ENV": "production"
}
}Configuración con asistentes de IA
Configuración con código Roo
Abra VSCode e instale la extensión Roo Code
Abra el archivo de configuración de Roo Code:
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.jsonAgregue la siguiente configuración:
Para el modo estándar (conexión local)
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}Para el modo SSE (conexión remota)
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}Reemplace localhost:8080/sse con su dirección de servidor, puerto y punto final reales si los ha personalizado.
Configuración con Cline
Abra el archivo de configuración de Cline:
~/.cline/config.jsonAgregue la siguiente configuración:
Para el modo estándar (conexión local)
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}Para el modo SSE (conexión remota)
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}Configuración con Claude Desktop
Abra el archivo de configuración de Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.jsonAgregue la siguiente configuración:
Para el modo estándar (conexión local)
{
"mcpServers": {
"terminal-mcp": {
"command": "node",
"args": ["/path/to/terminal-mcp-server/build/index.js"],
"env": {}
}
}
}Para el modo SSE (conexión remota)
{
"mcpServers": {
"terminal-mcp-sse": {
"url": "http://localhost:8080/sse",
"headers": {}
}
}
}Mejores prácticas
Ejecución de comandos
Antes de ejecutar comandos, es mejor determinar el tipo de sistema (Mac, Linux, etc.)
Utilice rutas completas para evitar problemas relacionados con las rutas
Para las secuencias de comandos que necesitan mantener el entorno, utilice
&¶ conectar varios comandosPara comandos de larga ejecución, considere usar
nohuposcreen/tmux
Conexión SSH
Asegúrese de que la autenticación basada en clave SSH esté configurada
Si falla la conexión, verifique si existe el archivo de clave (ruta predeterminada:
~/.ssh/id_rsa)Asegúrese de que el servicio SSH se esté ejecutando en el host remoto
Gestión de sesiones
Utilice el parámetro de sesión para mantener el entorno entre comandos relacionados
Para operaciones que requieren entornos específicos, utilice el mismo nombre de sesión
Tenga en cuenta que las sesiones se cerrarán automáticamente después de 20 minutos de inactividad.
Manejo de errores
Los resultados de la ejecución del comando incluyen tanto stdout como stderr
Verifique stderr para determinar si el comando se ejecutó correctamente
Para operaciones complejas, agregue pasos de verificación para garantizar el éxito
Notas importantes
Para la ejecución remota de comandos, se debe configurar previamente la autenticación basada en clave SSH
Para la ejecución de comandos locales, los comandos se ejecutarán en el contexto del usuario que inició el servidor.
El tiempo de espera de la sesión es de 20 minutos, después de los cuales la conexión se cerrará automáticamente.
Available Tools
1 toolexecute_commandB
Execute commands on remote hosts or locally (This tool can be used for both remote hosts and the current machine)
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Command to execute. Before running commands, it's best to determine the system type (Mac, Linux, etc.) | |
| env | No | Environment variables | |
| host | No | Host to connect to (optional, if not provided the command will be executed locally) | |
| session | No | Session name, defaults to 'default'. The same session name will reuse the same terminal environment for 20 minutes, which is useful for operations requiring specific environments like conda. | default |
| username | No | Username for SSH connection (required when host is specified) |
TDQS
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 that commands can be executed remotely or locally and hints at session reuse for 20 minutes, but it lacks critical details such as security implications, error handling, output format, or potential side effects. This leaves significant gaps for a tool that executes arbitrary commands.
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 a single, efficient sentence that front-loads the core functionality. It avoids unnecessary details and stays focused on the tool's scope, though it could be slightly more structured by explicitly separating remote and local use cases.
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?
Given the complexity of executing commands (which can have security and system impacts), the lack of annotations, and no output schema, the description is insufficient. It fails to address critical aspects like return values, error conditions, or safety warnings, making it incomplete for informed tool usage.
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?
The input schema has 100% description coverage, so the baseline is 3. The description does not add any meaningful parameter semantics beyond what is already documented in the schema, such as explaining the 'command' parameter's system dependencies or the 'session' parameter's environmental implications in more depth.
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 the tool's purpose as executing commands on remote hosts or locally, specifying both the verb ('execute') and the resource ('commands'). It distinguishes between remote and local execution contexts. However, without sibling tools, it cannot demonstrate differentiation from alternatives, preventing 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.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by mentioning both remote and local contexts, but it does not provide explicit guidance on when to choose one over the other or any prerequisites. For example, it notes host is optional for local execution but does not clarify when remote execution is preferable or what conditions might affect it.
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.
1 tool update
v1.0.0- First observed
execute_command
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool 'execute_command' has a clear, singular purpose that cannot be confused with any other tool in the set.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'execute_command' follows a standard verb_noun pattern, and there are no other tools to cause inconsistency.
A single tool for a terminal server is too few for the apparent scope, as terminal operations typically involve multiple commands and actions. This minimal set may cause agents to struggle with complex tasks that require more granular control.
The tool surface is severely incomplete for a terminal server domain. It lacks essential operations such as listing files, navigating directories, managing processes, or handling input/output streams, making it inadequate for typical terminal workflows.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
1Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants full SSH/SFTP remote operations — session management, command execution, interactive shells, file transfers, port forwarding, and system diagnostics.2MIT
- AlicenseAqualityAmaintenanceMCP server giving AI agents full SSH access with persistent sessions, structured command output, SFTP file transfer, and port forwarding.1811MIT
- AlicenseAqualityDmaintenanceAn MCP server that gives AI agents SSH access to remote machines through your local OpenSSH client, enabling remote command execution, file transfer, persistent shell sessions, and port forwarding.17169 PyPI24MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents SSH capabilities to execute commands, transfer files, and inspect remote systems through a preconfigured host list.41 npmMIT