Skip to main content
Glama
weidwonder

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)

ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesCommand to execute. Before running commands, it's best to determine the system type (Mac, Linux, etc.)
envNoEnvironment variables
hostNoHost to connect to (optional, if not provided the command will be executed locally)
sessionNoSession 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
usernameNoUsername for SSH connection (required when host is specified)

TDQS

B3.1/5.0
Behavior2/5

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.

Conciseness4/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines3/5

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. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedexecute_command

TDQS

B3.2/5.0
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 issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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
    A
    maintenance
    MCP server giving AI agents full SSH access with persistent sessions, structured command output, SFTP file transfer, and port forwarding.
    18
    10
    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
    19
    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.
    69
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/weidwonder/terminal-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server