Terminal MCP Server

Terminal MCP Server

通过Claude Desktop执行终端命令的MCP Server。

Terminal MCP Server Quick Start Guide

Overview

Terminal MCP Server lets you execute terminal commands through Claude Desktop using the Model Context Protocol.

Prerequisites

  • Node.js v18+
  • TypeScript
  • Claude Desktop

Setup

Installation

git clone https://github.com/stat-guy/terminal.git
cd terminal
npm install
npm run build

Configure Claude Desktop

Edit your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add:

{
  "mcpServers": {
    "terminal": {
      "command": "node",
      "args": [
        "[PATH_TO_REPO]/dist/index.js"
      ],
      "env": {
        "PERMISSION_REQUIRED": "true"
      }
    }
  }
}

Replace [PATH_TO_REPO] with your actual repository path.

Important: Restart Claude Desktop after configuration.

Usage

Ask Claude to perform terminal commands:

  • Execute ls -la to see files in my current directory
  • What's my current working directory?
  • Change to my Downloads folder

Available Tools

  • execute_command: Run any terminal command with arguments
  • change_directory: Change working directory (maintains state)
  • get_current_directory: Get current directory path
  • get_terminal_info: Show shell, user, platform, and command history

Development

Monitor changes with:

npm run watch

After code changes:

npm run build

Security

  • User permission required for command execution
  • Environment control via configuration
  • Timeout and error handling included

License

MIT