Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.47 KB

APIs.md

File metadata and controls

49 lines (33 loc) · 1.47 KB

Moonverse HTTP API

A minimal JSON API that replaces the previous MCP server. Supports async query tasks with polling. All responses are JSON.

Endpoints

Health

  • GET /healthz
  • Response: { "ok": true }

Create query task

  • POST /query
  • Body:
{ "type": "docs" | "source", "query": "<question>" }
  • Responses:
    • 202 Accepted: { "id": "<taskId>", "nextPollSec": 2 }
    • 400 Bad Request: { "error": "..." }

Get query task status/result

  • 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" }

Behavior

  • Tasks execute asynchronously; clients should poll GET /query/{id} every ~2s using nextPollSec as a hint.
  • Queries run against uploaded MoonBit files: type=docs uses store/ files, type=source uses source/ files.
  • Supported file types for upload are .md, .mbt, .json, .txt.
  • The server streams nothing; results are returned when ready.

Environment

  • GEMINI_API_KEY (required): Google Generative AI key.
  • PORT (optional): defaults to 8080.

Notes

  • Health endpoint is for readiness checks.
  • Ensure store/ and source/ folders exist with allowed files; otherwise responses will explain missing files.