Skip to main content
Glama
Terminal MCP Server

Terminal MCP Server

by weidwonder

ターミナルMCPサーバー

鍛冶屋のバッジ

中国語の文書

ターミナルMCPサーバーは、ローカルまたはリモートホスト上でコマンドを実行できるモデルコンテキストプロトコル(MCP)サーバーです。AIモデルやその他のアプリケーションが、ローカルマシン上またはSSH経由のリモートホスト上でシステムコマンドを実行するための、シンプルでありながら強力なインターフェースを提供します。

特徴

  • ローカルコマンド実行: ローカルマシンで直接コマンドを実行する

  • リモートコマンド実行: SSH経由でリモートホスト上でコマンドを実行する

  • セッションの永続性: 指定された時間 (デフォルトは 20 分) にわたって同じ端末環境を再利用する永続セッションのサポート

  • 環境変数: コマンドのカスタム環境変数を設定する

  • 複数の接続方法: stdio または SSE (Server-Sent Events) 経由で接続

Related MCP server: mcp-remote-ssh

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の termin-mcp-server を自動的にインストールするには:

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

SSEモードでサーバーを起動する

SSE (Server-Sent Events) モードでは、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

次のコマンドライン オプションを使用して SSE サーバーをカスタマイズできます。

オプション

説明

デフォルト

--portまたは-p

リッスンするポート

8080

--endpointまたは-e

エンドポイントパス

/sse

--hostまたは-h

バインドするホスト

ローカルホスト

カスタム オプションの例:

# 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.0

これにより、サーバーが起動し、 http://0.0.0.0:3000/mcpで SSE 接続をリッスンします。

MCP Inspectorによるテスト

# Start the MCP Inspector tool
npm run inspector

実行コマンドツール

execute_command ツールは、ターミナル MCP サーバーによって提供されるコア機能であり、ローカル ホストまたはリモート ホストでコマンドを実行するために使用されます。

パラメータ

パラメータ

タイプ

必須

説明

指示

弦

はい

実行するコマンド

ホスト

弦

いいえ

接続先のリモートホスト。指定しない場合は、コマンドはローカルで実行されます。

ユーザー名

弦

ホストを指定する場合は必須

SSH接続のユーザー名

セッション

弦

いいえ

セッション名。デフォルトは「default」。同じセッション名では、同じ端末環境が20分間再利用されます。

環境

物体

いいえ

環境変数、デフォルトは空のオブジェクト

例

ローカルでコマンドを実行する

{
  "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"
  }
}

AIアシスタントを使った設定

Roo Codeでの設定

  1. VSCodeを開いてRoo Code拡張機能をインストールします

  2. Roo Code 設定ファイルを開きます: ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json

  3. 次の構成を追加します。

stdioモード(ローカル接続)の場合

{
  "mcpServers": {
    "terminal-mcp": {
      "command": "node",
      "args": ["/path/to/terminal-mcp-server/build/index.js"],
      "env": {}
    }
  }
}

SSEモード(リモート接続)の場合

{
  "mcpServers": {
    "terminal-mcp-sse": {
      "url": "http://localhost:8080/sse",
      "headers": {}
    }
  }
}

カスタマイズしている場合はlocalhost:8080/sse実際のサーバー アドレス、ポート、エンドポイントに置き換えます。

Clineでの設定

  1. Cline 設定ファイルを開きます: ~/.cline/config.json

  2. 次の構成を追加します。

stdioモード(ローカル接続)の場合

{
  "mcpServers": {
    "terminal-mcp": {
      "command": "node",
      "args": ["/path/to/terminal-mcp-server/build/index.js"],
      "env": {}
    }
  }
}

SSEモード(リモート接続)の場合

{
  "mcpServers": {
    "terminal-mcp-sse": {
      "url": "http://localhost:8080/sse",
      "headers": {}
    }
  }
}

Claude Desktopでの設定

  1. Claude Desktop 設定ファイルを開きます: ~/Library/Application Support/Claude/claude_desktop_config.json

  2. 次の構成を追加します。

stdioモード(ローカル接続)の場合

{
  "mcpServers": {
    "terminal-mcp": {
      "command": "node",
      "args": ["/path/to/terminal-mcp-server/build/index.js"],
      "env": {}
    }
  }
}

SSEモード(リモート接続)の場合

{
  "mcpServers": {
    "terminal-mcp-sse": {
      "url": "http://localhost:8080/sse",
      "headers": {}
    }
  }
}

ベストプラクティス

コマンド実行

  • コマンドを実行する前に、システムの種類 (Mac、Linux など) を確認することをお勧めします。

  • パス関連の問題を回避するためにフルパスを使用する

  • 環境を維持する必要があるコマンドシーケンスの場合は、 &&を使用して複数のコマンドを接続します。

  • 長時間実行されるコマンドの場合は、 nohupまたはscreen / tmuxの使用を検討してください。

SSH接続

  • SSHキーベースの認証が設定されていることを確認する

  • 接続に失敗した場合は、キーファイルが存在するかどうかを確認します(デフォルトのパス: ~/.ssh/id_rsa )

  • リモートホストでSSHサービスが実行されていることを確認してください

セッション管理

  • 関連するコマンド間の環境を維持するには、セッションパラメータを使用します。

  • 特定の環境を必要とする操作の場合は、同じセッション名を使用します。

  • 20分間操作がないとセッションは自動的に終了しますのでご注意ください。

エラー処理

  • コマンド実行結果にはstdoutとstderrの両方が含まれます

  • stderrをチェックして、コマンドが正常に実行されたかどうかを確認します。

  • 複雑な操作の場合は、成功を確実にするために検証手順を追加します

重要な注意事項

  • リモートコマンド実行には、SSHキーベースの認証を事前に設定する必要があります。

  • ローカルコマンド実行の場合、コマンドはサーバーを起動したユーザーのコンテキストで実行されます。

  • セッションタイムアウトは20分で、その後は接続が自動的に閉じられます。

Available Tools

1 tool
execute_commandB

Execute commands on remote hosts or locally (This tool can be used for both remote hosts and the current machine)

Inputs: command (required), env, host, session, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 1 tool

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count2/5

    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.

    Completeness1/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives AI assistants full SSH/SFTP remote operations — session management, command execution, interactive shells, file transfers, port forwarding, and system diagnostics.
      2
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server giving AI agents full SSH access with persistent sessions, structured command output, SFTP file transfer, and port forwarding.
      18
      42 PyPI
      12
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An 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.
      17
      447 PyPI
      42
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives AI agents SSH capabilities to execute commands, transfer files, and inspect remote systems through a preconfigured host list.
      MIT