windows-terminal-mcp
windows-terminal-mcp
MCP (Model Context Protocol)サーバーであり、あらゆるLLMがWindowsターミナル(ローカルシェルおよびリモートSSH接続を含む)でコマンドを実行できるようにします。
機能
cmd、powershell、またはbash(Git Bash) を介したコマンドの実行キーベース認証を使用したSSH経由のリモートコマンド実行
3段階のセキュリティモデル(安全 / 確認 / ブロック)
コマンドごとのタイムアウト設定
Claude DesktopおよびMCP互換クライアントで動作
Related MCP server: Windows CLI MCP Server
インストール
git clone https://github.com/marttinm/windows-terminal-mcp.git
cd windows-terminal-mcp
pip install -e .Windows上でPython 3.11以降が必要です。
設定
Claude Desktopの設定ファイル (%APPDATA%\Claude\claude_desktop_config.json) にサーバーを追加します:
{
"mcpServers": {
"windows-terminal": {
"command": "cmd",
"args": ["/c", "python", "-m", "windows_terminal_mcp.server"]
}
}
}または、スクリプトを直接指定します:
{
"mcpServers": {
"windows-terminal": {
"command": "cmd",
"args": ["/c", "python", "C:/path/to/windows-terminal-mcp/src/windows_terminal_mcp/server.py"]
}
}
}ツール: execute_command
パラメータ
パラメータ | 型 | デフォルト | 説明 |
| string | 必須 | 実行するコマンド。SSHの場合: |
| string |
| シェル: |
| string | — | 作業ディレクトリ(ローカルコマンドのみ) |
| integer |
| タイムアウト(ミリ秒) |
| string | — | SSH秘密鍵へのパス (例: |
レスポンス
{
"stdout": "...",
"stderr": "...",
"exit_code": 0,
"execution_time": 0.42
}使用例
ローカルコマンド
Run: dir C:\Users
Shell: cmd
Run: Get-Process | Select-Object -First 5
Shell: powershell
Run: git status
Shell: bashSSHコマンド
Run: ubuntu@192.168.1.10 "df -h && uptime"
Shell: ssh
SSH key: ~/.ssh/id_rsaRun: ubuntu@192.168.1.10 "docker ps"
Shell: ssh
SSH key: ~/.ssh/my_key
Timeout: 30000セキュリティ
コマンドは3つのレベルに分類されます:
安全 — 直接実行されます
echo, dir, type, git, npm, node, python, pip, curl、およびほとんどの読み取り専用コマンド。
危険 — 実行前にClaudeが警告を表示します
del, rmdir, rm, taskkill, net stop, net start, sc delete, reg add など。
ブロック — 常に拒否されます
format, del /s /q, rd /s /q, reg delete, regedit, shutdown, net user, rm -rf, mkfs, fdisk、および同様の破壊的な操作。
開発
プロジェクト構造
windows-terminal-mcp/
├── src/windows_terminal_mcp/
│ ├── __init__.py
│ ├── server.py # MCP server (main entry point)
│ ├── executor.py # subprocess execution
│ ├── main.py # simple stdin/stdout handler
│ └── security.py # command safety checks
├── tests/
│ └── test_windows_terminal_mcp.py
├── pyproject.toml
├── LICENSE
└── README.mdテストの実行
pip install pytest
pytest tests/ -vPythonモジュールとして使用
from windows_terminal_mcp.server import execute_command
result = execute_command("echo hello", shell="cmd")
print(result)
# {'stdout': 'hello\n', 'stderr': '', 'exit_code': 0, 'execution_time': 0.02}
result = execute_command(
"ubuntu@192.168.1.10 uptime",
shell="ssh",
ssh_key="~/.ssh/id_rsa",
timeout_ms=10000,
)
print(result)変更履歴
v0.2.0
キーベース認証によるSSHサポートを追加
SSHコマンド構築を修正(ホストとリモートコマンドを別々の引数として渡すように変更)
Windows上のSSHキーパスにおける
~展開を修正MCPサーバープロセス内でSSHがハングする原因となっていたstdin継承を修正
v0.1.0
cmd、powershell、bashを介した基本的なコマンド実行
stdout/stderr/exit_codeのキャプチャ
3段階のセキュリティモデル
ユニットテスト
ライセンス
MIT — LICENSE を参照
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
Related MCP Servers
- AlicenseAqualityFmaintenanceAn MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.1034 PyPI97MIT
- AlicenseBqualityFmaintenanceA Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.9959 npm268MIT
- FlicenseAqualityDmaintenanceA local Model Context Protocol server that allows LLMs to securely execute shell commands on remote Linux and Windows systems via SSH connections.66 npm2-
- AlicenseBqualityAmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.13264 npm6MIT