OctSSH
Provides LLMs with safe, controllable, and stateful SSH access to shell environments, enabling remote command execution and file transfers with async support and security features.
README
OctSSH
I was just VibeCoding and suddenly thought: Why can't I just let my agent deploy code to the server for me?
So, I built OctSSH.
<img src="logo.png" width="200" />
OctSSH is an MCP server that gives LLMs safe, controllable, and stateful access to shell environments.
Note
By default (stdio mode), OctSSH only connects to machines already configured in your local ssh_config for passwordless login.
[!TIP] So... what makes OctSSH special?
Async Support
OctSSH provides a complete set of async tools to prevent LLMs from timing out on long-running tasks:
| Tool | Description |
|---|---|
exec(machine, command, confirm_code?) |
Run short commands synchronously |
sudo-exec(machine, command, confirm_code?) |
Run synchronously as root (sudo -n) |
exec-async(machine, command, confirm_code?) |
Run long tasks in background (screen) |
exec-async-sudo(...) |
Run background tasks as root |
write-stdin(session_id, data, append_newline?) |
Write to stdin of a running async task |
get-result(session_id, lines?) |
Inspect async task output |
grep-result(session_id, pattern, ...) |
Search task logs |
cancel(session_id) |
Terminate a task |
sleep(time) |
Pause (useful for polling) |
Note: In HTTP Serve mode, these tools operate directly on the local machine, and the
machineparameter is omitted.
Security Design
OctSSH features a Virtual Mode and Confirm Code verification flow:
🔒 Safety Mechanism: Virtual Mode
We don't want AI to become a world-ending terminator, so we designed Virtual Mode.
When the AI attempts the following, OctSSH will not execute immediately, but instead returns a confirm_code:
- 📁 File Overwrite: Uploading to a path that already exists.
- 💀 High-Risk Commands:
rm -rfand similar "delete everything" commands. - 🔍 Regex Blocklist: Custom sensitive patterns defined in config.
Execution Flow Example:
- AI calls
exec("web", "rm -rf /var/www/html") - 🛑 OctSSH intercepts: Recursive delete detected -> Returns
confirm_code: a1b2c3+ file impact preview. - 👤 User reviews and tells AI: "Confirm execution".
- ✅ AI calls
exec("web", "rm -rf /var/www/html", "a1b2c3")-> Actually executes.
Quick Start
Installation
npm install -g @aliyahzombie/octssh
octssh init
Usage Modes
1. Default Client Mode (stdio)
Runs locally and controls remote machines via SSH (reads ~/.ssh/config):
octssh
2. Streamable HTTP Server Mode (Local Control)
Install this on the target server. It exposes the server to LLMs via a secure HTTP interface. In this mode, OctSSH controls the local machine directly (no outbound SSH).
octssh serve
- Default Listen:
127.0.0.1:8787(Override viaOCTSSH_SERVE_HOST/OCTSSH_SERVE_PORT) - Auth: Prints a random key on startup. Clients must send header
X-OctSSH-Key: <key>.- Set fixed key:
export OCTSSH_SERVE_KEY="my-secret"
- Set fixed key:
- Tool Changes: Tools run on this machine.
machineparameter is omitted. SSH transfer tools (upload/download) are disabled.
Windows notes (serve mode)
On Windows, OctSSH serve will auto-select a local shell in this order:
sh(if available, e.g. Git-Bash/MSYS)pwshpowershellcmd
Override with:
set OCTSSH_SHELL=powershell
Tool Prefix (optional)
To avoid tool name collisions when you run multiple OctSSH instances, you can prefix all exposed tools:
export OCTSSH_TOOL_PREFIX="us1_"
Example: list becomes us1_list.
write-stdin (async interactive input)
write-stdin lets you send input to a running exec-async session.
Typical flow:
- Start a long-running command that reads stdin (via
exec-async) - Send data with
write-stdin(session_id, data) - Poll output with
get-result(session_id)
Notes:
- Default
append_newlineistrue. - Max payload is 64KiB per call.
- This is a streaming stdin: EOF is not sent. If the program exits on EOF, cancel the session instead.
- If you set
OCTSSH_TOOL_PREFIX, tool names are prefixed too (e.g.us1_write-stdin).
MCP Client Configuration
General (stdio)
Add to your MCP client config:
{
"mcpServers": {
"octssh": {
"command": "octssh",
"args": []
}
}
}
Claude Code CLI
claude mcp add octssh -- octssh
OpenCode CLI
{
"mcp": {
"octssh": {
"type": "local",
"command": "octssh",
"args": [],
"enabled": true
}
}
}
Or:
opencode mcp add octssh --command octssh
[!CAUTION] This project connects to real servers (or executes on the local machine). Please carefully review LLM operations. Using this project means you agree that the developer is not responsible for any accidental damage.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。