
Linux MCP daemon (mcpd)
io.github.nucleusv由 GitHub 帳號 nucleusv 發布v0.5.1更新於 Oct 31, 2026
AI agent access to Linux servers without SSH: scoped tools, per-call isolation, root only if granted
概覽
一個 Go 守護程式,讓 AI 助理以依工具授權的型別化介面存取 Linux 主機——行程、磁碟、日誌、服務、Docker 與檔案,不需 SSH shell。
- 可以做什麼
- 檢視主機:系統資訊、行程、記憶體、磁碟與分割區、網路連線、服務,以及 systemd journal/dmesg 日誌
- 讀取與列出檔案和目錄,並依 URI 讀取靜態資源,例如 os://uname 或 process:// /status
- 對系統執行操作:重新啟動或管理服務、修改 sysctl 鍵、讀取或取代 crontab
- 透過 Docker Engine API 操作 Docker:列出容器、映像、網路與磁碟區,讀取日誌,並在指定容器內執行指令
- 自我檢視 MCP API 本身(工具、資源、initialize 回應)並重新載入守護程式設定
- 適用情境
- 適合讓助理診斷或維運 Linux 伺服器——負載、記憶體、磁碟、行程、服務、日誌、容器——並取得結構化輸出而非原始 shell;也適合需要依工具授予 root 權限並保留每次呼叫稽核紀錄的情境。
- 執行需求
- 需要一台執行 mcpd 守護程式的 Linux 主機(amd64/arm64),透過 9091 埠的 HTTPS/SSE 存取,預設啟用 TLS(自簽憑證,用戶端需固定其指紋)。需在 Authorization 標頭提供 bearer 權杖,以 linuxctl create mcpd user 在本機建立;每個使用者需有同名的作業系統帳號。root 層級工具需在 mcp-sudo.yaml 中明確授權。可選的 linuxctl 命令列工具也可在 macOS 上執行。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Linux MCP daemon (mcpd),將其新增到工作區。
- 連接 Authorization token 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
- 為需要使用其工具的對話啟用該服務。
Web executable,透過 SSE。 遠端服務在工作區中設定後即可從網頁執行環境執行。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Linux MCP Daemon
[Docs] [Release] [License] [Linux MCP daemon MCP server – quality and maintenance score on Glama]
A high-performance, Go-based Model Context Protocol (MCP) daemon (mcpd) designed to securely bridge AI agents directly with the Linux operating system.
Overview
This project implements a zero-dependency (kernel-first) philosophy. It allows AI agents to introspect and interact with the host Linux system directly via raw syscalls and the Virtual File System (/proc, /sys) without requiring bloated third-party parsing libraries.
Communication happens directly between the AI agent and the daemon via Server-Sent Events (SSE) and JSON-RPC over HTTPS on port 9091 (TLS is on by default, with a self-signed certificate generated on first start).
Why
An AI agent that helps run a server needs to see it - load, memory, disks, processes, services, logs, the network - and sometimes to act on it. The usual way is an SSH shell, and a shell is everything at once: any command, any file the account can reach, with sudo all of root, and hard to tell afterwards what was done. mcpd gives the agent typed tools instead of a shell:
- Diagnose without a shell. "Why is the site slow?" -
processes/top,memory/usage,disks/usage,logs/journal-control,logs/dmesg,network/connections,services/listanswer it, with structured output (json/yaml) the agent doesn't have to scrape fromtopordf. - Root per tool, not per session. A user runs every tool as its own OS account; root is granted per tool in
mcp-sudo.yamland limited by paths, network destinations and sysctl keys - "may read/var/logas root and restart services" rather than "is root". - One agent, one account, one token. Each agent gets its own user, and every call is logged with the user, tool, arguments (secrets redacted) and result - an audit trail of what the agent did.
- Small and self-contained. One static Go binary, reading
/proc,/sysand systemd over D-Bus itself; it runs on a bare host, in Docker or in Kubernetes, andlinuxctlgives people the same tools as a kubectl-like CLI.
Grant carefully. A root grant is root for an agent that follows instructions found in what it reads. Some grants that look narrow are full root (writes to
/etc,services/manage, sysctl writes). Read Permissions and Risks before granting anything.
How It Works
- Every tool/resource call spawns a fresh worker process and exits. There's no long-lived state per call -
internal/worker/spawner.gore-execs themcpdbinary itself inworkermode (arguments on stdin, never argv), withsyscall.Credential{Uid, Gid, Groups}set to a real OS account resolved viauser.Lookup(). This is the actual privilege isolation, not a config flag: an unprivileged user's worker process is a genuinely different Linux UID than a privileged one's. configs/mcp-sudo.yamldecides, per user and per tool, whetherprivileged: trueis honored. Two grants exist for resources specifically (seeARCHITECTURE.md's gotcha section) - one for the resource URI itself, one for the internal worker tool name behind it.- When
mcpdruns containerized (configs/daemon.yaml'sworker.containerized: true, this project's actual Kubernetes deployment), a privileged worker also joins the real host's mount namespace (setns(CLONE_NEWNS)on/proc/1/ns/mnt, no externalnsenterbinary) - soprivileged: truemeans root on the real host, not just root inside the daemon's own container image. - Bearer tokens are salted+hashed in
users.yaml(token_salt+token_hash,sha256, constant-time compared; the file is0600), not stored in plaintext. Users and grants are edited only locally, on the host, vialinuxctl <verb> mcpd userandlinuxctl edit mcpd config(validated likevisudo) - there is no MCP tool that edits them, so nothing with just a bearer token can grant itself anything. The running daemon applies changes without a restart throughdaemon/reload-config, which only re-reads the files and rejects invalid ones (see Daemon User Administration). - Every read is schema-driven, not hand-listed.
linuxctlfetchestools/list/resources/list/resources/templates/listfrom the live daemon on every invocation and resolves its<verb> <group> [keyword]grammar against that - a new tool added server-side is immediately usable client-side with zero code changes.
Features
- Direct AI Interaction: HTTP/SSE transport for immediate agent-to-daemon communication.
- Strict Security: Rate limiting, salted+hashed Bearer token authentication, and directory traversal protection.
- Privilege Separation: Master daemon runs as root, spinning up ephemeral unprivileged/privileged workers based on rules defined in
configs/mcp-sudo.yaml. - High Performance: Uses
singleflightdeduplication and TTL caching for efficient system introspection. - Docker & Kubernetes Ready: Fully containerized with a multi-stage Docker build and Kubernetes deployment manifests that allow safe host introspection.
Get started
Install on Linux (systemd)
Needs sudo and curl on an amd64/arm64 host (in a bare ubuntu/debian container: apt update && apt install -y curl ca-certificates, then pipe to bash as root). This downloads the latest release for your architecture (amd64/arm64), verifies its sha256 checksum, installs mcpd and linuxctl to /usr/local/bin, writes clean configs to /etc/mcpd/configs (no default users or tokens), creates a first user mcp and prints its token once, and starts the mcpd systemd service. Then:
- Upgrade: run the same command again - configs are kept, the service restarts only if
mcpdchanged. From v0.1.0, grant your first userdaemon/reload-configonce - see Upgrading. - Pin a version / name the user:
... | sudo bash -s -- --version v0.1.0 --user alice - More users: each needs an OS account of the same name - see Adding more users.
- Uninstall:
... | sudo bash -s -- --uninstall(add--purgeto delete/etc/mcpd; themcpOS account stays -sudo userdel -r mcp) - Packages:
.deband.rpmfor amd64/arm64 on every release -sudo apt install ./linux-mcp-daemon_<version>_amd64.deborsudo dnf install ./linux-mcp-daemon-<version>-1.x86_64.rpm, then the next steps it prints. - Container image:
ghcr.io/nucleusv/linux-mcp-daemon(amd64/arm64) - setup steps in the installation docs. - macOS (CLI only): the same script installs just
linuxctl-curl -fsSL .../install.sh | bash -s -- --bin-dir ~/.local/bin, thenexport PATH="$HOME/.local/bin:$PATH"(not on macOS's default PATH) - to drive a remote mcpd.
mcpd listens on all interfaces over TLS (a self-signed certificate it creates on first start; clients pin its fingerprint). Plain HTTP is off by default - bearer tokens would travel in clear text. Root access for tools is granted per user and per tool in
mcp-sudo.yaml.
Full guide: Installation · Connect an AI agent · mcp-sudo.yaml
Development: build from source
1. Build and Deploy the Server (mcpd)
-
Build the Docker image:
-
Deploy to your local Kubernetes cluster:
2. Build the Client (linuxctl)
You can build the CLI client directly on your host machine (e.g. macOS):
Installed from a release (install.sh, .deb/.rpm), linuxctl is already on your PATH.
3. Usage (local development)
The daemon runs on port 9091. You can connect via your AI client using SSE, or use the linuxctl CLI tool:
linuxctl speaks a small verb/group grammar (linuxctl <verb> <group> [target-keyword] [args]) and dynamically discovers every tool and resource from the running daemon - there's no separate client-side command list to keep in sync. Full reference: linuxctl docs or man linuxctl. Every example below shows both forms: linuxctl, and the raw MCP JSON-RPC curl call it resolves to - the full per-tool/resource reference with these side by side for every single one lives at MCP API docs.
Calling the API directly with curl
mcpd speaks JSON-RPC 2.0 over HTTP + SSE, not plain request/response HTTP - every call is a two-step handshake: open an SSE stream to get a one-time POST endpoint, then POST the JSON-RPC request there (the actual result streams back on the SSE connection, not in the POST's response body):
Every example below follows this exact pattern - only the -d payload changes.
Files
Resources (direct by URI)
Disks
Processes: one result vs many, and rich detail
Logs (host-only tool, requires privileged: true in containerized deployments)
Mutations (services, kernel)
Docker (read, lifecycle, exec)
Talks to the Docker Engine API over its socket - no docker CLI needed. Every docker/* tool needs its own grant in mcp-sudo.yaml; the ones that name a container also need a containers: list, so an agent only touches the containers you list.
Crontabs
Read, list and replace crontabs with the crontab command's own rules (cron.allow/cron.deny still apply). Writing a crontab schedules commands as that user, and the job survives the end of the session and the revocation of the token - read the crontab risks before you grant it.
Introspecting the MCP protocol itself
Direct-by-name escape hatches (bypassing the verb grammar)
Daemon user/token administration (local-only, no network call at all)
There's no curl equivalent for this group - see Daemon User Administration for why it's deliberately kept off the network entirely.
Project Structure
cmd/mcpd/: Main server application entrypoint.cmd/linuxctl/: The CLI client application.configs/: Configuration files (Daemon config, Sudo rules).internal/: Encapsulated business logic:auth/: Per-user rate limiting.config/:daemon.yaml,users.yamlandmcp-sudo.yamlparsing and validation (shared by mcpd andlinuxctl).rpc/: MCP JSON-RPC handlers - tool/resource registry, authorization, config reload.worker/: Spawns each call as a short-lived worker under the caller's OS account (or root).tools/,resources/: One package per tool and resource.fsafe/: Opening paths without following symlinks (openat with O_NOFOLLOW).kernel/,procstat/: Parsing/proc(sockets, processes).logging/: Leveled, structured logging.netpolicy/: Network destination policy fornetwork/curlandnetwork/ping.
k8s/: Kubernetes deployment manifests.scripts/: Build and deployment automation.
Releases
Pushing a SemVer tag (git tag -a v0.1.0 -m v0.1.0 && git push origin v0.1.0) runs .github/workflows/release.yml: tests, then GoReleaser publishes per-platform archives, checksums.txt and a changelog to GitHub Releases, and a multi-arch image to ghcr.io/nucleusv/linux-mcp-daemon.
License
Apache License 2.0 - see also NOTICE.
[Linux MCP daemon MCP server – quality and maintenance score on Glama]
來源:README.md,提交 bf04d81
工具
0版本歷史
4- v0.5.1最新Oct 3, 2026
- v0.4.1Sep 29, 2026
- v0.4.0Sep 29, 2026
- v0.3.5Sep 27, 2026
評分
已滿足適用檢查項的 60%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通必需25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式必需10 分
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分