MCP Remote Shell
Enables remote shell control of Linux and network devices via SSH/Telnet, with session management and file transfer capabilities.
README
MCP Remote Shell
通过 SSH/Telnet 控制远程 Linux 及网络设备的 MCP 服务
传输模式:Streamable HTTP(跨机器部署) 适用于:openclaw (A机器) ──HTTP──▶ MCP Server (Windows B机器) ──SSH/Telnet──▶ 目标设备
📁 目录结构
mcp-remote-shell/
├── src/
│ ├── server.py # MCP 服务主入口(Streamable HTTP)
│ ├── ssh_handler.py # SSH 连接处理器
│ ├── telnet_handler.py # Telnet 连接处理器
│ └── connection_manager.py # 会话管理
│── openclaw_mcp_config.json # openclaw 配置示例
├── logs/ # 运行日志(自动创建)
├── pyproject.toml # uv 项目配置 & 依赖
├── install.bat # 一键安装
├── start.bat # 启动服务
├── install_service.bat # 注册为 Windows 服务(可选)
└── README.md
🚀 部署步骤(Windows B 机器)
1. 安装依赖
cd C:\mcp-remote-shell
install.bat
自动完成:安装 uv → Python 3.11 → uv sync 安装所有依赖。
2. 启动服务
start.bat
服务监听 http://0.0.0.0:8080/mcp,自定义端口:
set MCP_PORT=9090
start.bat
3. 开放防火墙端口
netsh advfirewall firewall add rule name="MCP Remote Shell" dir=in action=allow protocol=TCP localport=8080
4. 配置 openclaw(A 机器)
在 openclaw 的 MCP 配置中添加:
{
"mcpServers": {
"remote-shell": {
"type": "http",
"url": "http://<B机器IP>:8080/mcp"
}
}
}
🔧 注册为 Windows 服务(开机自启,可选)
需要先下载 NSSM 并放入 PATH,然后:
install_service.bat
管理服务:
nssm start mcp-remote-shell
nssm stop mcp-remote-shell
nssm restart mcp-remote-shell
nssm remove mcp-remote-shell confirm
🛠️ 可用工具
| 工具名 | 功能 |
|---|---|
ssh_connect |
SSH 连接目标设备(密码/私钥) |
telnet_connect |
Telnet 连接目标设备 |
execute_command |
执行单条命令 |
execute_commands |
批量执行命令列表 |
send_interactive |
发送交互式输入(sudo、确认等) |
disconnect |
断开指定会话 |
list_sessions |
列出所有活跃会话 |
get_session_info |
查看会话详情 |
upload_file |
SFTP 上传文件(仅 SSH) |
download_file |
SFTP 下载文件(仅 SSH) |
🐛 常见问题
Q: openclaw 连不上 MCP Server
- 确认 B 机器防火墙已放行端口
- 用
curl http://B机器IP:8080/mcp测试连通性
Q: Telnet 登录失败
- 华为设备提示符:
Username:/Password: - 思科设备提示符:
Username:/Password: - 在
telnet_connect中传入login_prompt/passwd_prompt参数覆盖默认值
Q: 需要认证保护 HTTP 接口 在 B 机器前面加 Nginx 反代,配置 Basic Auth 或限制来源 IP。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.