mcp-ssh-wrapper
A minimal MCP server that executes commands on remote hosts by delegating to the local ssh binary, supporting batch-mode execution and optional timeout.
README
mcp-ssh-wrapper
mcp-ssh-wrapper is a minimal MCP server that executes commands on remote hosts by delegating to the local ssh binary.
The server does not implement SSH authentication. It relies entirely on the host machine's existing SSH configuration, agent, identities, and host key policy.
This project runs as a streamable HTTP MCP server. It is intended to be started as a long-lived local process and then connected to by tools like Codex or Claude.
The SSH execution path is non-interactive. The server runs ssh in batch mode and does not allow prompts on stdin, so hosts must already be reachable using existing SSH config, keys, agent state, and known-hosts entries.
Warning: binding this server to anything other than localhost or 127.0.0.1 exposes a tool that can use the local machine's SSH configuration, agent, and keys over the network. Treat non-local binding as a high-risk configuration.
Features
- Exposes a single MCP tool:
execute_command - Uses the system
sshcommand directly - Returns
stdout,stderr, andexit_code - Supports an optional execution timeout
Installation
pip install mcp-ssh-wrapper
Running the server
After installation, run the server with:
mcp-ssh-wrapper --host 127.0.0.1 --port 8000 --mount-path /mcp
This exposes the MCP endpoint at http://127.0.0.1:8000/mcp.
You can also use the module entrypoint:
python -m mcp_ssh_wrapper --host 127.0.0.1 --port 8000 --mount-path /mcp
Keep this bound to localhost unless you fully understand the security implications.
Local execution
For local development from this repository, use the helper script:
./run_server.sh --host 127.0.0.1 --port 8000 --mount-path /mcp
If your SSH setup depends on ssh-agent, run_server.sh will try to recover SSH_AUTH_SOCK automatically on macOS.
Add to Codex
Start the server first:
mcp-ssh-wrapper --host 127.0.0.1 --port 8000 --mount-path /mcp
Then register the running HTTP endpoint with Codex:
codex mcp add mcp-ssh --url http://127.0.0.1:8000/mcp
Verify the registration:
codex mcp list
codex mcp get mcp-ssh
Codex will connect to the running HTTP endpoint. It does not launch the server process for you in this setup.
Add to Claude
Claude Code CLI
Start the server first, then register the URL with Claude Code:
claude mcp add mcp-ssh --transport http http://127.0.0.1:8000/mcp
Verify the registration:
claude mcp list
claude mcp get mcp-ssh
Claude Desktop
Add this server entry to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-ssh": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
Claude Desktop will connect to the running local HTTP server.
Important limitation
run_test.sh does not launch the server. Start mcp-ssh-wrapper ... or ./run_server.sh ... first, then run the test wrapper against the live endpoint.
Local smoke test
To verify startup, MCP initialization, and tool discovery against a running server:
./run_test.sh --skip-call
To target a non-default endpoint:
./run_test.sh --url http://127.0.0.1:8000/mcp --skip-call
To also invoke the SSH tool:
./run_test.sh --host my-host --command "uname -a"
Tool
execute_command
Arguments:
host: SSH host oruser@host, resolved by the local SSH clientcommand: Command string to execute remotelytimeout_seconds: Optional timeout.0disables timeout handling.
Result:
{
"host": "prod-box",
"command": "uname -a",
"stdout": "Linux ...\n",
"stderr": "",
"exit_code": 0
}
Notes
- SSH options should be configured in
~/.ssh/configor the host environment. - This server invokes
ssh -o BatchMode=yes, so password prompts and interactive confirmations are disabled. - Authentication, host key policy, and identity selection are still handled by the local
sshclient and its existing configuration.
Releasing
This project is configured to publish to PyPI using GitHub Trusted Publishing via .github/workflows/publish-pypi.yml.
Release flow:
- Update
project.versionin pyproject.toml. - Commit the version bump and push it to
main. - Tag the
maincommit with a matching version tag in the formvX.Y.Z. - Push the tag to GitHub.
Example for version 0.1.0:
git checkout main
git pull
git tag v0.1.0
git push origin v0.1.0
The GitHub Actions workflow will:
- verify the tag points to a commit on
main - verify the tag matches
project.version - build the package
- publish it to PyPI using the GitHub
pypienvironment
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。