mcpField
@
@modelcontextprotocol/server-terminal

@modelcontextprotocol/server-terminal

Local
github.com/RichardTheuwsDeveloper Tools5Updated 99w ago

About @modelcontextprotocol/server-terminal

@modelcontextprotocol/server-terminal is an MCP server for controlled terminal access. It supports shell commands and npm operations, with command allowlisting, timeouts, environment variables, and working-directory control.

Key features

  1. 01Run shell commands
  2. 02Perform npm operations
  3. 03Restrict allowed commands
  4. 04Configure command timeouts
  5. 05Set environment and working directory

Use cases

  1. 01Running approved terminal commands
  2. 02Installing npm packages
  3. 03Executing npm scripts in a chosen directory

MCP support

It exposes terminal command execution and npm operations as tools for MCP clients, with configurable command restrictions and execution settings.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"terminal-server": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-terminal"
]
}
}
}
Run commandnpx -y @modelcontextprotocol/server-terminal

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@modelcontextprotocol/server-terminal

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.