SSH MCP Server
Enables AI coding agents to securely execute shell commands on remote SSH servers with granular per-host permission controls. Automatically discovers hosts from ~/.ssh/config and exposes dedicated tools for each allowed host to ensure proper authorization before remote execution.
README
SSH MCP Server
A Model Context Protocol (MCP) server that provides an SSH command wrapper for AI coding agents. This allows agents (like Gemini CLI, Claude Code, and Continue) to securely execute shell commands on remote servers using a dedicated tool, ensuring that you receive proper native permission prompts for remote execution.
Motivation
When using AI coding agents, if the agent simply runs the local ssh command using its local shell runner, you get a generic "Allow local command execution?" prompt. Furthermore, the agent has to construct complex string arrays for arguments.
By exposing ssh_execute_command as a native MCP tool, the agent cleanly requests permission to use the SSH tool, separating local operations from remote operations.
Features
- Per-Host Permissions: Dynamically generates a specific tool for each allowed host (e.g.,
ssh_execute_example_com). This allows your AI agent's permission system to ask for permission per server. Once you approve a host for a session, the AI can execute commands on it seamlessly, but connecting to a new host will trigger a new permission request. - Auto-Discovery: Automatically parses your
~/.ssh/configto discover available hosts, or accepts specific allowed hosts via command-line arguments. - Key Management: Automatically handles standard SSH keys (
~/.ssh/id_ed25519or~/.ssh/id_rsa) and works withssh-agent. - Cross-Platform: Compatible with all major MCP clients.
Installation and Build
Ensure you have Node.js installed.
git clone https://github.com/li-liwen/SSH-MCP.git
cd SSH-MCP
npm install
npm run build
Configuration
You need to add this MCP server to your preferred coding agent. By default, ssh-mcp will read your ~/.ssh/config file to discover allowed hosts. Alternatively, you can explicitly pass the allowed hosts as arguments.
For Gemini
First, link the package globally (or install it globally using npm install -g .):
npm link
Then add it to your environment. You can pass specific allowed IP addresses or hostnames at the end:
gemini mcp add ssh-mcp ssh-mcp 10.101.0.108 example.com
(If you omit the hosts, it will automatically expose tools for all hosts found in ~/.ssh/config).
For Claude Code
Run the following command in your terminal:
claude mcp add ssh-mcp ssh-mcp 10.101.0.108
For Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"ssh-mcp": {
"command": "ssh-mcp",
"args": ["10.101.0.108", "example.com"]
}
}
}
For Continue & Other Agents (OpenCode, Codex, Cursor)
Add the following to your config.json (or equivalent settings file) under mcpServers:
{
"mcpServers": {
"ssh-mcp": {
"command": "ssh-mcp",
"args": ["10.101.0.108"]
}
}
}
How the Agent uses it
Once configured, the MCP server will expose explicit tools like ssh_execute_10_101_0_108. Simply instruct your agent:
"Connect to my remote server at 10.101.0.108 with username ubuntu and check the disk space."
The agent will seamlessly use the explicit per-host tool (like ssh_execute_10_101_0_108) to execute commands (e.g., df -h) on the remote server and return the results directly into the conversation.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。