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>
This commit is contained in:
Lei Chen 2026-07-30 11:16:36 +08:00
parent 98066db68d
commit e4af0cac73
27 changed files with 1760 additions and 7 deletions

View file

@ -6082,3 +6082,5 @@
| 01:56 | Edited ../../../../../claude/.claude/projects/-home-rshen-projects-xce-xce/memory/MEMORY.md | 1→2 lines | ~142 |
| 01:56 | Session end: 33 writes across 20 files (cluster.c, sched.c, limits.yaml, project_bug1462_config_replication_fixed.md, MEMORY.md) | 39 reads | ~71360 tok |
| 02:11 | Session end: 33 writes across 20 files (cluster.c, sched.c, limits.yaml, project_bug1462_config_replication_fixed.md, MEMORY.md) | 39 reads | ~71360 tok |
| 12:10 | Updated root CLAUDE.md: corrected Native Adapter Go-import assumption (myxce kernel is C/cgo, Go only at apiserver/xcecli edges), logged API Key auth is half-built, confirmed 2 decisions (code location, service-account API Key auth) | /Users/dankeer/Projects/chatbot/CLAUDE.md | done | ~600 |
| 12:10 | Updated myxce/CLAUDE.md and src/frontend/CLAUDE.md: registered planned schedulerclient/ and mcp-server/ modules (Phase 0, in progress) pointing to root CLAUDE.md for overall plan | myxce/CLAUDE.md, myxce/src/frontend/CLAUDE.md | done | ~300 |