feat: admin REST API with OpenAPI and API tokens, admin MCP endpoint, server update #19
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/admin-api-mcp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Everything the admin UI does is now scriptable: a documented REST API with personal API tokens, and an admin MCP endpoint (off by default) whose tools are those same routes. Also an Update button that pulls a stdio server's newest release.
mhk_, hashed, shown once, optional expiry) authenticate only routes whose matched pattern starts with/api/admin/, and only while the owner is an active admin. They skip the CSRF Origin check (a browser never attaches them by itself).PUBLIC_URL/mcp/admin). A/mcptoken is refused there and vice versa. Consent warns about administrator access, and non-admins getaccess_denied. While switched off, the endpoint, its PRM and its authorize requests answer 404 /invalid_target, and switching it off closes its sessions.operationId+summary(it becomes the tool name); the app refuses to start without them.start_server_oauthopts out of MCP (config: { adminMcp: false }) because it needs a browser session.npm --prefer-onlineanduv tool install --refresh, solatest(or a git branch) really resolves to the newest release. The Version tile shows Update for those, and "Pinned" for exact versions.claude mcp addsnippet.developaddsget_server_logsto the new logs route.Evidence
After:
npm testall green (API 284, web 108, runner 46, shared 5), plusnpm run typecheck,npm run lintandnpm audit(0 vulnerabilities). New tests inapps/api/test/admin-automation.test.ts:Web:
AutomationPage.test.tsxcovers toggling the switch (PATCH body, snippet appears) and showing a new token once.Not verified: Swagger UI in a real browser under the CSP. It only loads same-origin scripts, so it should be fine.
Merge Danger
Door: two-way
Migration
0002_api_tokensonly adds a table, and reverting leaves it unused. The admin MCP ships off.Blast Radius: admin-routes
/api/adminroute withoutoperationId+summarycrashes startup. That is intended, but it bites if a parallel branch adds one (asdevelop's logs route did)./api/admin/*. A bug there would be an auth bypass on admin routes, so that path has the most tests.🤖 Generated with Claude Code