SSH Remote File MCP Server
SSH Remote File MCP Server
リモートサーバーのファイルを、まるでローカルファイルのように、Claude Code から読み取り、編集し、コマンドを実行します。
MCP サーバーで、リモート SSH ホストをファイルシステムツールのセットとして公開します。Claude Code に登録すると、/home/you/proj/main.py を読み取ったり、関数を編集したり、pytest を実行したり、リモートツリー全体を grep したりできます — そして、パスのスコープ制御とコマンドフィルタリングを適用しながら、SSH 経由でサーバーと通信します。
中文ドキュメント / Chinese version → · GitHub →
ライセンス
MIT — LICENSE を参照してください。
Related MCP server: MCP SSH Server
機能
ツール | 目的 |
| リモートファイルを読み取る |
| リモートファイルを作成・上書きする(追記も可能) |
| リモートファイル内を検索・置換する |
| リモートディレクトリをパーミッション・サイズ・mtime 付きで一覧表示する |
| リモートでシェルコマンドを実行する(安全フィルター付き) |
| 名前のグロブまたは内容でファイルを検索する |
| OS / Python / ディスク / メモリ / CPU のスナップショット取得 |
| 単一パスの詳細な stat 情報を取得する |
クイックスタート
# 1. Clone and enter
git clone https://github.com/zhangqi-eiq/server_mcp.git
cd server_mcp
# 2. Install (editable mode — picks up code changes immediately)
python install.py
# 3. Edit your real credentials
# (file is at ~/.ssh-mcp-server/config.json by default)
# 4. Restart Claude Code, then in a chat:
# "show me the env of my server"これだけです。install.py は次の 3 つのことを行います:
pip install -e .— パッケージをインストールします。config.json(プレースホルダー値入り)を~/.ssh-mcp-server/にコピーします。claude mcp addを実行し、サーバーが Claude Code に表示されるようにします。
まだ claude CLI がない場合は、python install.py --no-register を実行し、MCP エントリを手動で追加してください(手動設定 を参照してください)。
手動設定
手動で設定したい場合、または install.py が正しく登録できなかった場合:
1. パッケージをインストールする
pip install -e .これにより、ssh_mcp_server が Python のインポートパスに配置され、python -m ssh_mcp_server でサーバーを起動できるようになります。
2. 設定ファイルを作成する
config.json を ~/.ssh-mcp-server/config.json にコピーします(SSH_MCP_CONFIG が未設定の場合、ローダーはこの場所を参照します)。そして実際の値を入力します:
mkdir -p ~/.ssh-mcp-server
cp config.json ~/.ssh-mcp-server/config.json
$EDITOR ~/.ssh-mcp-server/config.json3. Claude Code に登録する
MCP エントリは、パッケージをインストールした Python インタープリタ経由でサーバーを起動する必要があります。下の <python> は、そのインタープリタの 絶対パス(有効化した環境の sys.executable。例: Windows では C:\Users\you\.conda\envs\myenv\python.exe、Linux では /home/you/.venv/bin/python)に置き換えてください。
オプション A — ユーザースコープ(すべてのプロジェクトで利用可能):
claude mcp add --scope user ssh-remote \
-e SSH_MCP_CONFIG="$HOME/.ssh-mcp-server/config.json" \
-- "<python>" -m ssh_mcp_serverオプション B — プロジェクトスコープ(このプロジェクトのみ):
プロジェクトのルートに .mcp.json を作成します:
{
"mcpServers": {
"ssh-remote": {
"command": "<absolute path to python>",
"args": ["-m", "ssh_mcp_server"],
"env": {
"SSH_MCP_CONFIG": "/absolute/path/to/your/config.json"
}
}
}
}注: Claude Code は
mcpServersを 2 か所で探します —~/.claude.json(CLI 管理、claude mcp addが書き込む場所)と~/.claude/settings.json(手動編集)。上記の CLI ルートは自動的に正しい場所に書き込みます。
設定リファレンス
config.json の形式:
{
"ssh": {
"host": "your-server.example.com",
"port": 22,
"username": "your-username",
"auth": {
"type": "password",
"key_path": "",
"password": "your-password",
"key_password": ""
},
"connect_timeout": 10,
"keepalive_interval": 30
},
"allowed_paths": [
"/home/your-username/projects"
],
"security": {
"blocked_commands": ["rm -rf /", "mkfs", ...],
"max_file_size_mb": 50,
"max_output_chars": 100000,
"command_timeout": 30
}
}SSH 接続
フィールド | 説明 | デフォルト |
| サーバーアドレス(IP またはドメイン) | 必須 |
| SSH ポート |
|
| ログインユーザー名 | 必須 |
|
|
|
| 秘密鍵のパス(キー認証) |
|
| ログインパスワード(パスワード認証) |
|
| キーのパスフレーズ | 空白 |
| 接続タイムアウト(秒) |
|
| キープアライブ間隔(秒) |
|
アクセス制御
allowed_paths— リモートディレクトリのホワイトリスト。すべてのファイル操作は、..の正規化後にこのリストに対して検証されます。リスト外のリクエストは拒否されます。サブパスはアクセスを継承します(例:/data/projが許可されていれば/data/proj/sub/file.pyも許可されます)。security.blocked_commands—ssh_run_commandが実行を拒否するシェルコマンドのパターンリストと、そのブロックリスト。デフォルトでは危険な操作 (rm -rf /、mkfs、shutdown、フォーク爆弾、ブロックデバイスへの生書き込み) をカバーしています。リストを拡張することはできますが、正当なニーズを「解決」するために弱めてはいけません — セキュリティモデル を参照してください。
リソース制限
フィールド | 影響 | デフォルト |
|
|
|
|
|
|
|
|
|
認証
キー認証(推奨)
# On your local machine
ssh-keygen -t ed25519 -C "you@example.com"
# Push the public key to the remote
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server次に、config.json で指定します:
"auth": {
"type": "key",
"key_path": "~/.ssh/id_ed25519",
"key_password": ""
}key_password は、秘密鍵自体が暗号化されている場合にのみ必要です。
パスワード認証
"auth": {
"type": "password",
"password": "your-password"
}パスワードは config.json に平文で保存されます。キー認証を推奨します。
GUI マネージャー(オプション)
小さな Tk ベースの GUI で、複数のサーバープロファイルを管理し、切り替えることができます:
# From source
python server_manager.py
# Or build a standalone Windows exe and put it on PATH
pip install -e ".[gui]" # adds pyinstaller
python build.py
python setup_global.py
# now `SSH-Server-Manager` is on PATHプロファイルは profiles.json に保存されます。切り替えると、選択したプロファイルが config.json にコピーされるため、次回起動時に MCP サーバーがそれを読み込みます。
セキュリティモデル
このサーバーは意図的に制限的な設計です。リモートホストを保護する 2 つの独立したレイヤがあります:
パスのスコープ制御。 すべてのファイル操作は正規化 (
..を解決し、重複スラッシュをまとめる) され、その後allowed_pathsに対して検証されます。このリストから抜け出す方法はありません — チェックはリモート側でパスが解決された後にサーバー側で行われます。コマンドフィルタリング。
ssh_run_commandはsecurity.blocked_commands(部分一致)に一致するコマンドを拒否します。既定のリストは、再帰的な破壊、ブロックデバイスへの生書き込み、システムのシャットダウン、フォーク爆弾、リモートシェルインストーラー (curl … | sh) をブロックします。特定のことを許可する必要がある場合はリストを拡張できますが、根本的に無効化してはいけません。
このサーバーが行わないこと:
リモートで root として実行しません。root 以外のユーザーで接続してください。
sudoをバイパスしません。設定されたユーザーがsudoできなければ、サーバーもできません。対話シェルを提供しません。長時間実行されるプロセスは
command_timeoutによって強制終了されます。
トラブルシューティング
症状 | 考えられる原因 | 修正方法 |
| 正しいスコープに登録されていない、または | ルート |
| パッケージが | Claude Code に使用するインタープリータ・ラで |
| 設定ファイルがまだプレースホルダーのまま |
|
| LLM が試したパスが | 設定の |
| LLM がブラックリストにあるコマンドを試した | 本当に必要な場合のみ |
| 認証情報が誤っている、またはユーザーが間違っている | 通常のシェルで |
サーバーは起動するが Claude Code にツールが表示されない | VSCode 拡張機能のプロセスが古い | VSCode を完全に終了して再起動する |
プロジェクト構成
server/
├── ssh_mcp_server/ # MCP server package (the actual product)
│ ├── server.py # tool definitions
│ ├── ssh_client.py # paramiko wrapper
│ ├── security.py # path + command validation
│ └── config.py # config loader
├── server_manager.py # Tk GUI for managing profiles
├── profiles.json # GUI profile store
├── config.json # runtime config template (placeholder values)
├── setup.py # pip-installable package metadata
├── install.py # one-shot installer (install + register)
├── setup_global.py # optional: deploy GUI exe to PATH
├── build.py # optional: PyInstaller wrapper for the GUI
├── SSH-Server-Manager.spec # PyInstaller spec for fine-grained builds
├── requirements.txt # raw dependency pins
├── LICENSE # MIT
├── README.md # this file (English)
└── README.zh.md # Chinese translationライセンス
MIT — 全テキストはファイルを参照してください。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables SSH remote access to servers through Claude, allowing users to execute commands, transfer files via SFTP, and manage multiple remote connections using natural language.128MIT
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude to remote servers via SSH to execute commands, manage files, and browse directories. It allows users to add, edit, and switch between multiple server configurations through natural language conversations.
- AlicenseAqualityBmaintenanceEnables Claude to connect to servers via SSH, execute commands, transfer files, and manage connections through natural language.9151MIT
- -licenseNot gradedqualityNot gradedmaintenanceEnables Claude Code to control remote servers via SSH for automated deployment, testing, and operations, including command execution and file transfer.4
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Read, edit, publish, and preview your pepita websites from Claude.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/zhangqi-eiq/server_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server