feat: show MCP server process logs in the admin UI #17

Merged
marti merged 4 commits from feature/server-logs into develop 2026-11-06 11:06:56 +01:00
Owner

Why

A stdio server that fails to start left nothing to look at in the app. The runner kept a stderr tail per process but dropped it when the process exited, and the API only stored a squashed 2000-char lastError.

What

  • Runner: keeps the last 500 stderr lines of each process key plus its own lifecycle lines (starting, started with pid, exit code or signal, why a start was refused), after the process exits. Memory only, capped at 512 keys, dropped on uninstall. New GET /logs/:serverId.
  • API: GET /api/admin/servers/:id/logs (admin only). Each process is labelled shared, user (with email) or test (the connection test's PROBE_USER_ID key). An unreachable runner gives 502 runner_unavailable without the internal message. Remote servers return nothing, without calling the runner.
  • Web: a Logs tab on stdio servers' admin pages. One panel per process with a Running/Exited badge, timestamps and copy. Polls every 3 s and follows the tail unless you scroll up. "Last error" on Overview links to it.
  • Docs: docs/architecture.md, Packages and the runner.

Notes

  • The command's args are not logged, because expanded templates carry variable values. A server's own stderr is shown as it is; admins could already see it in lastError.
  • Deploying needs both the mcphub and runner images.

Testing

  • Runner: an exited process keeps its stderr and exit line; a refused start ("not installed") is logged.
  • API: admin only, labels and ordering, remote servers, 404, runner unreachable.
  • Web: the tab renders processes and the empty state.
  • npm test, npm run lint and npm run typecheck pass locally.

🤖 Generated with Claude Code

## Why A stdio server that fails to start left nothing to look at in the app. The runner kept a stderr tail per process but dropped it when the process exited, and the API only stored a squashed 2000-char `lastError`. ## What - **Runner:** keeps the last 500 stderr lines of each process key plus its own lifecycle lines (starting, started with pid, exit code or signal, why a start was refused), after the process exits. Memory only, capped at 512 keys, dropped on uninstall. New `GET /logs/:serverId`. - **API:** `GET /api/admin/servers/:id/logs` (admin only). Each process is labelled `shared`, `user` (with email) or `test` (the connection test's `PROBE_USER_ID` key). An unreachable runner gives `502 runner_unavailable` without the internal message. Remote servers return nothing, without calling the runner. - **Web:** a Logs tab on stdio servers' admin pages. One panel per process with a Running/Exited badge, timestamps and copy. Polls every 3 s and follows the tail unless you scroll up. "Last error" on Overview links to it. - **Docs:** `docs/architecture.md`, Packages and the runner. ## Notes - The command's args are not logged, because expanded templates carry variable values. A server's own stderr is shown as it is; admins could already see it in `lastError`. - Deploying needs both the mcphub and runner images. ## Testing - Runner: an exited process keeps its stderr and exit line; a refused start ("not installed") is logged. - API: admin only, labels and ordering, remote servers, 404, runner unreachable. - Web: the tab renders processes and the empty state. - `npm test`, `npm run lint` and `npm run typecheck` pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The stderr tail was dropped with the process, so a server that died on
startup left nothing behind. GET /logs/:serverId returns the last 500
lines per process key, in memory, dropped on uninstall.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /api/admin/servers/:id/logs, labelled shared, per user or connection test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: describe how runner process logs are kept
All checks were successful
CI / check (pull_request) Successful in 5m35s
68ac9cc333
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marti merged commit 1f92fd11df into develop 2026-11-06 11:06:56 +01:00
marti deleted branch feature/server-logs 2026-11-06 11:06:58 +01:00
Sign in to join this conversation.
No reviewers
No labels
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
marti/mcphub!17
No description provided.