myxce/src/frontend/apiserver/models
Lei Chen e4af0cac73 Phase 0: scheduleragent + mcp-server read-only agent framework
Complete the natural-language scheduler agent's Phase 0 read-only pipeline:

Task #2 (API Key auth mechanism):
- New store/apikey.go: APIKey store (hash, validate, expiry)
- controllers/apikey.go: GenerateAPIKey finally persists + registers RBAC role
- controllers/auth.go: GetUsernameFromToken recognizes xce_ak_ prefix
- middleware/validatehandler.go: isValidToken handles API Key
- config/rbac.yaml: mcp_readonly role (view-only permissions)
- 6 new test files covering unit + integration full-chain

Task #3 (schedulerclient Go library):
- types.go: URM types (URMJob/URMQueue/URMNode/JobStatus/Metrics)
- client.go: read-only Client interface (6 methods)
- httpclient.go: resty-based HTTP implementation
- statusmap.go + _test.go: TDD status mapping (33 tests)

Task #4 (mcp-server binary):
- cmd/main.go: entry, reads XCE_API_URL/XCE_API_KEY, registers 6 MCP tools
- internal/app.go: tool handlers wiring schedulerclient to MCP stdio
- Uses github.com/mark3labs/mcp-go@v0.57.0 for stdio transport

All: go vet clean, go build clean, schedulerclient 33/33 tests pass.
mcp-server binary ~11MB arm64, CGO_ENABLED=0.

Architecture:
  Claude Code --stdio--> mcp-server --HTTP--> apiserver REST API --cgo--> C backend

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-30 11:16:36 +08:00
..
apikey.go Phase 0: scheduleragent + mcp-server read-only agent framework 2026-07-30 11:16:36 +08:00
auth.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
clusters.go Add HostConfig + Cluster fields to models and update docs 2026-04-16 09:24:22 +00:00
clusters_test.go Add HostConfig + Cluster fields to models and update docs 2026-04-16 09:24:22 +00:00
common.go refactor: represent time fields as int64 Unix seconds throughout the stack 2026-05-09 07:00:49 +00:00
files.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
hosts.go fix: preserve admin-set host state across worker re-registration in makeWorker_ 2026-05-13 10:38:39 +00:00
hosts_test.go fix: preserve admin-set host state across worker re-registration in makeWorker_ 2026-05-13 10:38:39 +00:00
jobs.go refactor: represent time fields as int64 Unix seconds throughout the stack 2026-05-09 07:00:49 +00:00
jobs_test.go feat: P2.5-7a map JOB_STAT_TRANSIENT (0x400) to TRANSIENT in job status API 2026-05-08 02:03:19 +00:00
queues.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
resources.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
roles.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00
users.go Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00