router-ssh-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| router_infoA | 查询 SSH 连接健康状态、探测到的 init 系统、设备系统与生效的安全策略。 返回结构: {"ok": true, "tool": "router_info", "host": "...", "data": { "host", "port", "username", "backend", "ssh": {"connected", "reuse_count", "reconnect_count", "server_version", ...}, "device": {"uname", "release", "release_source"}, "security": {...}, "limits": {...}}} |
| service_listA | 列出路由器上的服务及其运行状态。 参数: name_filter: 按名称子串过滤(大小写不敏感),可选 running_only: 仅返回运行中的服务 with_start_time: 额外读取每个服务的启动时间(命令数随服务数增加,默认关闭) 返回结构: {"ok": true, "data": {"services": [{"name", "running", "enabled", "pid", "started_at", "description", "source"}], "count", "running_count", "init_system", "host", "warnings"}} |
| service_statusA | 查询单个服务的运行状态、PID、启动时间与开机自启状态。 参数: name: 服务名(OpenWrt 为 /etc/init.d 脚本名,systemd 为 unit 名,如 sshd.service) 返回结构: {"ok": true, "data": {"service": {"name", "running", "enabled", "pid", "started_at", "description", "source"}, "checked_at", "init_system"}} 服务不存在时返回 ok=false,error.code = SERVICE_NOT_FOUND,并在 details 中给出可用服务样例。 |
| service_logsA | 读取服务日志尾部内容(OpenWrt 走 logread,systemd 走 journalctl)。 参数: name: 服务名 lines: 返回行数,1 <= lines <= ROUTER_MCP_MAX_LOG_LINES(默认 500) 返回结构: {"ok": true, "data": {"name", "requested_lines", "returned_lines", "source", "command", "truncated", "lines": [...] }} |
| service_startA | 启动指定服务(写入操作,需二次确认)。 参数: name: 服务名 confirm: 必须等于服务名才真正执行;否则返回 error.code = CONFIRMATION_REQUIRED 返回结构: {"ok": true, "data": {"name", "action", "exit_status", "command", "stdout", "stderr", "duration_ms", "state_before", "state_after"}} |
| service_stopA | 停止指定服务(写入操作,需二次确认)。 参数与返回结构同 service_start。注意停止 ssh/dropbear 会导致连接中断。 |
| service_restartA | 重启指定服务(写入操作,需二次确认)。 参数与返回结构同 service_start。restart 非幂等,重复调用会重复中断服务。 |
| run_shellA | 在路由器上执行任意 shell 命令(高危能力,默认关闭,需二次确认)。 安全约束(任意一条不满足都会返回错误而非执行): * 必须设置 ROUTER_MCP_ALLOW_SHELL=true 才会启用,否则返回 error.code = SHELL_DISABLED; * 默认拦截高危命令(rm -rf / mkfs / dd if= / 写入 /dev/* / fork 炸弹 / 管道进 shell 等), 命中时返回 error.code = BLOCKED_COMMAND; * 需把 confirm 设为命令本身的完整字符串进行二次确认,否则返回 CONFIRMATION_REQUIRED; * 命令以 root 身份在远端登录 shell 中执行,会绕过服务白名单,请谨慎使用。 参数: command: 要执行的 shell 命令字符串 confirm: 必须等于 command 的完整内容(含空格与引号)才真正执行 返回结构: {"ok": true, "data": {"raw_command", "exit_status", "stdout", "stderr", "duration_ms", "host", "reused_connection", "denied", "confirmed", "warning"}} |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |