A minimal JSON API that replaces the previous MCP server. Supports async query tasks with polling. All responses are JSON.
GET /healthz- Response:
{ "ok": true }
POST /query- Body:
{ "type": "docs" | "source", "query": "<question>" }- Responses:
202 Accepted:{ "id": "<taskId>", "nextPollSec": 2 }400 Bad Request:{ "error": "..." }
GET /query/{id}- Responses:
- In progress:
{ "status": "queued" | "running", "etaSeconds": <int>, "nextPollSec": 2, "message": "Processing in background. Please poll again." } - Completed:
{ "status": "done", "content": "<answer>" } - Error:
{ "status": "error", "error": "<message>" } - Not found:
404 { "error": "task not found" }
- In progress:
- Tasks execute asynchronously; clients should poll
GET /query/{id}every ~2s usingnextPollSecas a hint. - Queries run against uploaded MoonBit files:
type=docsusesstore/files,type=sourceusessource/files. - Supported file types for upload are
.md,.mbt,.json,.txt. - The server streams nothing; results are returned when ready.
GEMINI_API_KEY(required): Google Generative AI key.PORT(optional): defaults to 8080.
- Health endpoint is for readiness checks.
- Ensure
store/andsource/folders exist with allowed files; otherwise responses will explain missing files.