Wakeonlan Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.2.0更新於 Oct 30, 2026

Wake LAN machines with Wake-on-LAN magic packets from host profiles, then confirm they came up.

概覽

AI 產生的概覽

本機 MCP 伺服器,依預設主機設定送出 Wake-on-LAN 魔術封包,並以 TCP 探測確認機器已開機。

可以做什麼
  • 依別名喚醒已設定的主機,並等待其檢查埠回應,等待時間可調整
  • 單次探測主機的檢查埠,不送出魔術封包,用來判斷主機是否已上線
  • 列出主機設定,包含 MAC、位址、埠、廣播位址來源,以及本機是否位於該主機的子網段
  • 讀取靜態的 Wake-on-LAN 參考主題,例如封包格式、前置條件、睡眠狀態、疑難排解與設定格式
適用情境
適合讓助理在同一區域網路內喚醒休眠的桌機、GPU 機器、NAS 或實驗室機器,並確認可連線;也可在決定是否喚醒前先檢查狀態。
執行需求
透過 npx 或 bunx 以 stdio(或 Streamable HTTP)在本機執行;需要 Bun v1.4.0 以上或 Node.js v24 以上。需以 WOL_HOSTS_FILE(絕對路徑)或內嵌 WOL_HOSTS 提供主機設定,且執行機器須與目標位於同一區域網路段。目標機需在韌體中啟用 Wake-on-LAN 並由作業系統保持待命。
安裝前請注意
喚醒與探測會在區域網路送出 UDP 廣播與 TCP 連線;只能針對維運預設的別名,無法指定任意 MAC、IP 或埠。SecureOn 密碼保存在設定中,不會被回傳或寫入日誌。將 HTTP 傳輸開放至回環位址以外時必須使用 MCP_AUTH_MODE 的 jwt 或 oauth,且所有通過驗證的呼叫方都能喚醒同一批主機。macOS 15 以上需為啟動此伺服器的應用程式授予區域網路權限。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Wakeonlan Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@cyanheads/wakeonlan-mcp-server

Wake LAN machines with Wake-on-LAN magic packets from host profiles, then confirm they came up via MCP. STDIO or Streamable HTTP.

4 Tools


Overview

Wake-on-LAN by name for the machines on your network. Wake a sleeping desktop, GPU box, NAS, or lab machine, wait until it answers on a port like SSH, check whether a host is up without waking it, and troubleshoot a wake that didn't take. Runs on any machine on the same LAN as its hosts.

Tools

ToolDescription
wol_wake_hostSend magic packets to a configured host, then wait for its TCP check port to answer
wol_check_hostProbe a configured host's check port once, without sending a magic packet
wol_list_hostsList the host profiles and whether this machine is attached to each host's subnet
wol_list_referenceWake-on-LAN reference by topic: packet format, target setup, power states, troubleshooting, profile format, sender traps

Skills

SkillDescription
wakeonlan-guideWhen a wake is warranted versus a status check, how to read refused, no_answer, and not_reachable before calling a machine off or a wake failed, which wake-failure checks need a person at the target, and how to add a host

Served over MCP as skill://wakeonlan-guide/SKILL.md and shipped in the npm package under skills/.

Capability reference

wol_wake_host tool

  • alias (from wol_list_hosts, case-insensitive) plus optional wait_for_s, 0–55 seconds, default 30; 0 sends and returns without checking. Sends 3 packets 500 ms apart, probing the check port once before sending and every 2 s after the first packet
  • state is already_awake, awake (with time_to_answer_ms, an upper bound at the 2 s poll interval), not_reachable, or unverified (unverified_reason: wait_disabled or no_address); the last two carry a guidance next step
  • Fails as unknown_host, off_segment (nothing sent: this machine has no interface on the host's subnet), retryable wake_in_progress (nothing sent: another call is already waking that host, and one wake per host runs at a time), or retryable socket_error, whose data carries the failed stage and packets_sent

wol_check_host tool

  • alias only: one TCP connect to the profile's address and check_port (22 unless the profile sets another), 1.5 s timeout, no magic packet. The port is not an input, so the tool can't scan arbitrary ports
  • outcome is open, refused (the machine answered, nothing listens on that port), or no_answer; reachable is true only for open, and latency_ms is present for open and refused
  • Fails as unknown_host, or no_address when the profile has no address to probe

wol_list_hosts tool

  • No input. Returns every profile in config order: alias, description, mac, address, check_port, wol_port, broadcast with broadcast_source (configured, derived, or unresolved), and secureon_set (never the password)
  • on_segment, with the sending interface and local_address when true, is resolved against this machine's interfaces on every call; nothing is sent or probed, so it says nothing about whether a host is up
  • config_source (file, inline, or none) and config_path name where the profiles came from

wol_list_reference tool

  • topic: packet-format, prerequisites, sleep-states, troubleshooting, host-profiles, or sender-environment
  • Static markdown with no network access; every response lists all topics for navigation

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Wake-on-LAN-specific:

  • Operator-configured targets only: callers pass an alias, never a MAC, IP, broadcast address, or port, so an agent or HTTP caller can wake and probe only the hosts you listed. SecureOn passwords stay in the profile, never returned or logged
  • Subnet-directed broadcasts: the broadcast address is derived from a host's IPv4 address and the matching local interface when the profile omits it, and a host on no local subnet is refused before anything is sent instead of being routed away silently
  • Wakes are confirmed by a TCP connect to a per-host check_port (SSH by default; RDP or SMB for Windows), not ICMP
  • The LAN layer is Node's own node:dgram, node:net, and node:os, with no third-party networking dependency

Agent-friendly output:

  • Results, not errors, for every wait outcome: state plus a guidance next step naming the tool or reference topic to call
  • Typed failures with recovery hints: unknown_host lists up to 20 configured aliases, off_segment names the local subnets it compared, and on macOS socket_error points at the Local Network permission
  • refused vs no_answer: a machine that is on but not listening on its check port reads differently from one that never answered. A wake still ends not_reachable either way; probe.last_outcome and guidance say which, so a wrong check_port can be told apart from a failed wake

Getting started

Add the following to your MCP client configuration file, pointing WOL_HOSTS_FILE at your hosts file.

json
{  "mcpServers": {    "wakeonlan-mcp-server": {      "type": "stdio",      "command": "bunx",      "args": ["@cyanheads/wakeonlan-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "WOL_HOSTS_FILE": "~/.config/wakeonlan/hosts.json"      }    }  }}

Or with npx (no Bun required):

json
{  "mcpServers": {    "wakeonlan-mcp-server": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@cyanheads/wakeonlan-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info",        "WOL_HOSTS_FILE": "~/.config/wakeonlan/hosts.json"      }    }  }}

The Claude Desktop .mcpb bundle (the install badge above) asks for a hosts file or inline hosts JSON when you install it.

For Streamable HTTP, set the transport and start the server:

sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 WOL_HOSTS_FILE=~/.config/wakeonlan/hosts.json bun run start:http# Server listens at http://localhost:3010/mcp

Prerequisites

  • Bun v1.4.0 or higher (or Node.js v24+).
  • A machine attached to the same LAN segment as the hosts it wakes. Run the server on that machine's OS, or in Docker with host networking on Linux: a container on a default bridge network, Docker Desktop on macOS or Windows, or WSL2 in its default NAT mode can't put a broadcast on the LAN.
  • Targets with Wake-on-LAN enabled in firmware and armed by the OS. wol_list_reference with topic prerequisites has the Windows, Linux, and macOS settings.

macOS: Local Network permission

On macOS 15 and later, sending a UDP broadcast or connecting to a LAN address needs Local Network access, and macOS grants it to the app that launched the server rather than to node:

Launched fromWho holds the permission
Claude Desktop (the .mcpb bundle or a JSON config)Claude Desktop. macOS asks once, and the grant covers every server it launches.
Apple's Terminal, or an SSH sessionAllowed automatically, with no prompt.
A third-party terminal or editor (iTerm2, Ghostty, VS Code, Cursor, …)That app, which gets the prompt.
A launchd daemon, or a process running as rootAllowed automatically.
A launchd agentBlocked until granted. Run an always-on server as a daemon instead.

Grant or check it under System Settings > Privacy & Security > Local Network. The first send can fail while the alert is pending, so wol_wake_host may return socket_error; retry after allowing. If that list shows a node entry rather than your client app, enable the node entry. A denied permission also makes wol_check_host read no_answer. Windows and Linux have no per-app gate. wol_list_reference with topic sender-environment covers the rest, including the macOS 15.5+ subnet exemption.

Installation

  1. Clone the repository:
sh
git clone https://github.com/cyanheads/wakeonlan-mcp-server.git
  1. Navigate into the directory:
sh
cd wakeonlan-mcp-server
  1. Install dependencies:
sh
bun install
  1. Configure environment:
sh
cp .env.example .env# edit .env and set WOL_HOSTS_FILE or WOL_HOSTS

Configuration

VariableDescriptionDefault
WOL_HOSTS_FILEAbsolute path to the JSON hosts file; a leading ~/ expands to the home directory. Mutually exclusive with WOL_HOSTS.none
WOL_HOSTSThe same JSON array inline, for single-host setups or clients where a file is awkward. Mutually exclusive with WOL_HOSTS_FILE.none
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_HOSTHTTP bind address. Anything but loopback requires MCP_AUTH_MODE jwt or oauth.127.0.0.1
MCP_HTTP_PORTHTTP server port.3010
MCP_AUTH_MODEAuthentication: none, jwt, or oauth.none
MCP_ALLOWED_ORIGINSComma-separated browser origins allowed on the HTTP endpoint. * is refused without jwt or oauth.loopback origins
MCP_SESSION_MODEHTTP session mode: stateless, stateful, or auto.stateless
MCP_LOG_LEVELLog level (debug, info, warning, error, etc.).info
LOGS_DIRDirectory for log files (Node.js only).<app-root>/logs
OTEL_ENABLEDEnable OpenTelemetry.false

See .env.example for the full list of optional overrides.

Host profiles

Profiles are a JSON array, read once at startup from WOL_HOSTS_FILE or WOL_HOSTS. Set one of the two: both set is a startup error, and neither set starts the server with no hosts, which wol_list_hosts explains. WOL_HOSTS_FILE must be absolute (after ~/ expansion), because a stdio server runs in the MCP client's working directory, and must name a regular file of at most 1 MiB: a directory, a pipe, or a device such as /dev/stdin is a startup error. Editing the profiles takes a restart.

json
[  {    "alias": "gpu-box",    "description": "Desktop with the training GPU; SSH on 22.",    "mac": "00:00:5e:00:53:01",    "address": "192.0.2.50"  },  {    "alias": "nas",    "mac": "00-00-5E-00-53-02",    "address": "nas.home.arpa",    "broadcast": "192.0.2.255",    "check_port": 445,    "secureon": "00:00:5e:00:53:ff"  }]
FieldRequiredDefaultRules
aliasyes1–64 characters: a letter or digit, then letters, digits, ., _, or -. Unique, ignoring case.
macyesColon, dash, Cisco dotted (0000.5e00.5301), or bare hex form. Group (multicast) and all-zero MACs are rejected.
addressnoIPv4 or IPv6 literal, or a DNS hostname. The probe target: without it a wake can't be confirmed and wol_check_host refuses the host.
broadcastunless address is IPv4derivedThe subnet's directed broadcast. 255.255.255.255, 0.0.0.0, and 224.0.0.0/4 are rejected.
wol_portno9UDP destination port, 1–65535.
check_portno22TCP port probed to confirm the host is up, 1–65535. Windows hosts usually need 3389 (RDP) or 445 (SMB).
secureonno6-byte SecureOn password in MAC format. Never shown or logged.
descriptionnoOperator note, up to 500 characters, returned by wol_list_hosts.

An empty string leaves an optional text field (address, broadcast, secureon, description) unset. The server refuses to start, naming the entry and field, on an unknown key, an invalid value, a duplicate alias, or a profile with neither broadcast nor an IPv4 address. Whether this machine sits on a host's subnet is checked per call, not at startup, since interfaces change. wol_list_reference with topic host-profiles has an example per OS.

HTTP exposure

A startup guard refuses any HTTP deployment that would let an unauthenticated caller reach the tools from beyond this machine, or from a web page through your browser. Stdio is unaffected.

MCP_HTTP_HOSTUnauthenticated (MCP_AUTH_MODE=none)jwt or oauth
Loopback: localhost, 127.0.0.0/8, ::1Serves, unless MCP_ALLOWED_ORIGINS contains *Serves
Anything else (0.0.0.0, a LAN address, …)Refuses to startServes

DEV_MCP_AUTH_BYPASS counts as unauthenticated. With MCP_ALLOWED_ORIGINS unset, requests from non-loopback browser origins are rejected, so a web page can't drive a loopback endpoint through DNS rebinding; * turns that check off, which is why it needs auth. Host profiles are server-wide: every authenticated caller can wake the same hosts.

Running the server

Local development

  • Build and run the production version:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:http# orbun run start:stdio
  • Run checks and tests:

    sh
    bun run devcheck  # Lints, formats, type-checks, and morebun run test      # Runs the test suite

Docker

The image is Linux-only. It can wake hosts only when run with --network host (or on a macvlan network) on a Linux machine attached to their LAN, such as a Raspberry Pi, NAS, or home server that already runs Docker. On a default bridge network the container sees only Docker's private subnet, so wol_wake_host fails with off_segment before sending anything. Docker Desktop on macOS and Windows runs containers in a VM, so its broadcasts can't reach the LAN in any network mode.

Pull the published multi-arch image (linux/amd64, linux/arm64):

sh
docker pull ghcr.io/cyanheads/wakeonlan-mcp-server:latest

Or build it from a clone of this repository with docker build -t ghcr.io/cyanheads/wakeonlan-mcp-server:latest .. Then add it to your MCP client configuration on that machine. The hosts file is mounted read-only from an absolute host path, and WOL_HOSTS_FILE names where it sits inside the container:

json
{  "mcpServers": {    "wakeonlan-mcp-server": {      "type": "stdio",      "command": "docker",      "args": [        "run", "-i", "--rm",        "--network", "host",        "-v", "/path/to/hosts.json:/etc/wakeonlan/hosts.json:ro",        "-e", "MCP_TRANSPORT_TYPE=stdio",        "-e", "WOL_HOSTS_FILE=/etc/wakeonlan/hosts.json",        "ghcr.io/cyanheads/wakeonlan-mcp-server:latest"      ]    }  }}

The container runs as the image's bun user (uid 1000), which must be able to read the hosts file. Without MCP_TRANSPORT_TYPE=stdio the image serves Streamable HTTP on port 3010, bound to loopback, which under host networking is the host's own; any other bind needs MCP_AUTH_MODE jwt or oauth (see HTTP exposure). Logs go to /var/log/wakeonlan-mcp-server. OpenTelemetry peer dependencies are installed by default; build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point: registers the four tools, runs the HTTP exposure guard, and loads the host profiles.
src/configWOL_HOSTS_FILE / WOL_HOSTS parsing and the HTTP exposure guard.
src/mcp-server/toolsTool definitions (*.tool.ts), the shared alias input, and the static reference topics.
src/services/hostsHost-profile loading, validation, MAC parsing, and alias lookup.
src/services/lanMagic-packet construction, subnet resolution, the UDP send, and TCP probes.
tests/Unit, integration, and fuzz tests against faked sockets, mirroring the src/ structure.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging; nothing persists, so ctx.state goes unused
  • Register new tools in the createApp() arrays in src/index.ts
  • Every OS boundary (sockets, interfaces, clock, platform, filesystem) is an injected seam: tests never open a real socket, and live checks run on loopback only

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

來源:README.md,提交 cf1f48c

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

3
  1. v0.2.0最新Oct 29, 2026
  2. v0.1.2Oct 9, 2026
  3. v0.1.1Sep 26, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分