Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-terminal-server

MCP.Pizza Chef: RichardTheuws

The mcp-terminal-server is a secure and configurable terminal server implementation for the Model Context Protocol (MCP). It allows controlled execution of shell commands and npm operations such as install and script running, with built-in timeout handling and environment variable management. The server enforces security by restricting commands to an allowed list and supports working directory control. It is designed for seamless integration with MCP clients, providing Typescript support and flexible configuration to suit development workflows. This server enables safe, automated terminal interactions within MCP-powered AI workflows.

Use This MCP server To

Execute shell commands securely within MCP workflows Run npm install and npm scripts programmatically Manage environment variables for terminal commands Control working directory for command execution Enforce command whitelisting for security Handle command execution timeouts automatically Integrate terminal operations into AI-assisted development

README

@modelcontextprotocol/server-terminal

Terminal server implementation for Model Context Protocol (MCP). Provides secure and controlled access to terminal commands and npm operations.

Features

  • Execute shell commands with full control
  • Built-in npm operations (install, run scripts)
  • Timeout handling
  • Security through allowed commands list
  • Environment variables management
  • Working directory control
  • Typescript support

Installation

npm install @modelcontextprotocol/server-terminal

Configuration

Add to your MCP config:

{
  "terminal": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-terminal"],
    "autoApproveScope": ["execute_command", "npm_install", "npm_run"],
    "config": {
      "allowedCommands": ["npm", "node", "git"],
      "defaultTimeout": 30000,
      "defaultCwd": "/your/project/path",
      "environmentVariables": {
        "NODE_ENV": "development"
      }
    }
  }
}

Usage

// Execute command
const result = await terminal.executeCommand('ls', ['-la'], {
  cwd: '/some/path'
});

// Install npm package
await terminal.install('typescript');

// Run npm script
await terminal.runScript('build');

// Direct npm commands
await terminal.dev();  // npm run dev
await terminal.build();  // npm run build

mcp-terminal-server FAQ

How do I install the mcp-terminal-server?
Install it via npm using 'npm install @modelcontextprotocol/server-terminal'.
How does the server ensure security when executing commands?
It uses an allowed commands list to restrict which shell commands can be run, preventing unauthorized operations.
Can I customize environment variables for commands?
Yes, you can configure environment variables in the server settings to be used during command execution.
How is command execution timeout handled?
The server supports a default timeout setting that automatically terminates commands running longer than the specified duration.
Is it possible to control the working directory for commands?
Yes, you can specify the default working directory in the configuration to control where commands execute.
Does the server support npm operations?
Yes, it includes built-in support for npm install and running npm scripts securely.
Can I use this server with different MCP clients?
Yes, it is designed to integrate seamlessly with any MCP client supporting the protocol.
Is Typescript supported for development?
Yes, the server provides Typescript support for easier integration and development.