[PR #5196] [MERGED] horizon-server mcp: an MCP server for AI agents to run and moderate a server #6134

Closed
opened 2026-11-03 06:13:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5196
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: server-admin/mcp


📝 Commits (1)

  • 640f459 horizon-server mcp: an MCP server for AI agents to run and moderate a server

📊 Changes

7 files changed (+587 additions, -8 deletions)

View changed files

📝 crates/horizon-server/src/main.rs (+4 -0)
➕ crates/horizon-server/src/mcp.rs (+539 -0)
📝 docs/api/server-reference.md (+2 -0)
📝 docs/api/server.md (+3 -2)
📝 docs/hosting.md (+1 -0)
📝 docs/server.md (+7 -5)
📝 tools/server_admin_e2e.py (+31 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Roadmap server-admin, part 5: horizon-server mcp, so an AI agent can run and moderate a server (docs/server.md section 8). Stacked on #5190 (the console; GitHub retargets it when that merges).

  • MCP over stdio (JSON-RPC 2.0, one message per line, as horizon-ctl mcp). Each tool is one control API call on the server running in --dir, with the token it reads from .horizon/api.json; every action shows in the server's log like any other API call.
  • Tools: status, players, run_command, logs, events, kick, ban, pardon, ban_ip, pardon_ip, op, deop, whitelist, list_backups, backup, delete_backup, restore, get_config, set_config, start, restart, stop. stop, restore and delete_backup need confirm: true; tools that send someone away or can't be undone carry destructiveHint, the read-only ones readOnlyHint. Nothing reaches a query string unchecked.
  • Add it to an agent as horizon-server --dir /path/to/server mcp, run as the server's user.

Tests: unit (every tool has a schema and maps onto an API call; confirm and input checks; the protocol without a server). tools/server_admin_e2e.py drives it over a pipe: initialize, tools/list, ban and pardon (files checked), events (Lou0's death), and an unconfirmed stop refused. Passed on the Mac mini.

pr_ready's scope below counts #5190 too (this PR alone: +587 −8, most of it the 22-tool table and its tests in mcp.rs). Rebased after #5166 and #5186 merged; tools/server_admin_e2e.py passed again (56 checks).

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at d55e66d65, 2 min 15 s)

Check Result
Scope ⚠️ 9 files, +807 −11; 787 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 44 s)
rustfmt ✅ (5 s)
clippy ✅ (11 s)
tests: horizon-server ✅ 70 passed (10 s)
doc tests ➖ no library touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ✅ 1 affected, all passed already with these inputs (2 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5196 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `server-admin/mcp` --- ### 📝 Commits (1) - [`640f459`](https://github.com/horizon-rust/horizon/commit/640f4590874f9e8e3349511ab350b672c1d4efc6) horizon-server mcp: an MCP server for AI agents to run and moderate a server ### 📊 Changes **7 files changed** (+587 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-server/src/main.rs` (+4 -0) ➕ `crates/horizon-server/src/mcp.rs` (+539 -0) 📝 `docs/api/server-reference.md` (+2 -0) 📝 `docs/api/server.md` (+3 -2) 📝 `docs/hosting.md` (+1 -0) 📝 `docs/server.md` (+7 -5) 📝 `tools/server_admin_e2e.py` (+31 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Roadmap `server-admin`, part 5: `horizon-server mcp`, so an AI agent can run and moderate a server (docs/server.md section 8). **Stacked on #5190** (the console; GitHub retargets it when that merges). - MCP over stdio (JSON-RPC 2.0, one message per line, as `horizon-ctl mcp`). Each tool is one control API call on the server running in `--dir`, with the token it reads from `.horizon/api.json`; every action shows in the server's log like any other API call. - Tools: `status`, `players`, `run_command`, `logs`, `events`, `kick`, `ban`, `pardon`, `ban_ip`, `pardon_ip`, `op`, `deop`, `whitelist`, `list_backups`, `backup`, `delete_backup`, `restore`, `get_config`, `set_config`, `start`, `restart`, `stop`. `stop`, `restore` and `delete_backup` need `confirm: true`; tools that send someone away or can't be undone carry `destructiveHint`, the read-only ones `readOnlyHint`. Nothing reaches a query string unchecked. - Add it to an agent as `horizon-server --dir /path/to/server mcp`, run as the server's user. Tests: unit (every tool has a schema and maps onto an API call; confirm and input checks; the protocol without a server). `tools/server_admin_e2e.py` drives it over a pipe: `initialize`, `tools/list`, `ban` and `pardon` (files checked), `events` (Lou0's death), and an unconfirmed `stop` refused. Passed on the Mac mini. pr_ready's scope below counts #5190 too (this PR alone: +587 −8, most of it the 22-tool table and its tests in `mcp.rs`). Rebased after #5166 and #5186 merged; `tools/server_admin_e2e.py` passed again (56 checks). **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at d55e66d65, 2 min 15 s) | Check | Result | | --- | --- | | Scope | ⚠️ 9 files, +807 −11; 787 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 44 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (11 s) | | tests: horizon-server | ✅ 70 passed (10 s) | | doc tests | ➖ no library touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ✅ 1 affected, all passed already with these inputs (2 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:13:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6134
No description provided.