Skip to content

REST Base

REST is not part of the hosted product today

The hosted product is reached over MCP. Every /api/v1/* route documented on this page is closed at the edge: the production nginx config answers location /api/ with 404 (see infra/nginx/conf.d.prod/g6solver.conf). The examples below will not work against g6solver.com — they are kept as engineering reference for the REST base in this repository, not as customer instructions.

The REST base exposes G6Solver via a FastAPI application, providing an HTTP/JSON interface for web applications, microservices, and programmatic access.


Overview

The REST base wraps G6 components as HTTP endpoints. It supports manifest-driven cluster routes, component invocation, pipeline execution, navigator queries, guide interactions, and template pipelines.

# Launch locally from the desktop app (binds 127.0.0.1:8010)
g6 --rest

# Self-host (network deployment): console script, module, or uvicorn
g6-rest
python -m mvp.rest
uvicorn mvp.rest:app --host 0.0.0.0 --port 8010

The server binds to port 8010 by default.

Local launch vs. self-hosted server

On the desktop app, launch REST locally with g6 --rest — it binds 127.0.0.1:8010 and boots in a local dev mode (auth bypassed, loopback only) so it works out of the box. Pass --host 0.0.0.0 to expose it on the network, which then requires real secrets (REST_API_SECRET, SECURITY_JWT_SECRET, SECURITY_CORS_ORIGINS). For a managed network deployment, self-host via the g6-rest console script, python -m mvp.rest, or Docker. In REST/server mode the claude_code LLM backend is not permitted (Anthropic ToS) — use ollama or openrouter.

Endpoint groups (91 endpoints across 16 route modules)

All endpoints are also mirrored under /api/v1/ for versioned access.

Health (7)

Method Path Description
GET /health Health check
GET /ready Readiness probe
GET /live Liveness probe
+ 4 more Metrics, version, startup probes

Core (5)

Method Path Description
GET /blocks List available blocks (alias for /components)
GET /components List all registered components
POST /invoke/{component} Invoke any component by name
POST /pipeline Execute a multi-step pipeline
+ 1 more

Cluster routes (dynamic)

Method Path Description
GET /clusters List all visible clusters with their components
GET /clusters/{slug} Cluster detail (slug, name, description, components)
POST /clusters/{slug}/{component} Invoke a component within a cluster ({op, params})
Method Path Description
GET /nav/discover Discover components by query
GET /nav/recommend Recommend components for a task
GET /nav/inspect/{component} Inspect a component's metadata and tools
GET /nav/stats System-wide statistics

Guide (3)

Method Path Description
POST /guide/ask Ask a natural-language question
POST /guide/plan Plan a multi-step workflow
GET /guide/overview System overview

Template pipelines (4)

Method Path Pipeline
POST /pipeline/research search -> RAG -> summarise
POST /pipeline/codegen meta-program -> verify -> evaluate
POST /pipeline/data pandas -> sklearn -> evaluate
POST /pipeline/safety CSF -> verify -> ground

Workflow (2)

Method Path Description
POST /workflow/compose Compose a multi-step workflow
GET /graph/dependencies Component dependency graph

Tier Manager (3)

Method Path Description
GET /tier/status Current T0-T3 tier status
POST /tier/advance Propose/confirm/reject tier advancement
POST /tier/cap Cap maximum tier level

Learning Layer (8)

Method Path Description
POST /learning/build-dataset Build training dataset from source
POST /learning/train Train model on dataset
POST /learning/evaluate Evaluate trained model
GET /learning/status Learning layer status
GET /learning/theories List extracted theories
GET /learning/artifacts/{run_id} Get learning artifacts for a run
POST /learning/export Export learning harness
POST /learning/import Import learning harness

Task Tracker (18)

Method Path Description
POST /tasks Create a task
GET /tasks List tasks (filterable)
GET /tasks/{id} Get task detail
POST /tasks/{id}/claim Claim a task
POST /tasks/{id}/complete Mark task complete
+ 13 more Progress, review, dependencies, scheduling

Task tracker storage scope

The /tasks endpoints use the task_tracker component's local SQLite store by default. They are useful for local pilots, single-machine demos, and design-partner workflows, but they are not a shared multi-user SaaS task backend without a single-writer deployment model or a server-database migration with tenant isolation, migrations, backups, and monitoring.

Safety (11)

Method Path Description
GET /policy Current security policy
GET /policy/check Check policy permissions
GET /hitl/pending Pending HITL tasks
POST /hitl/{task_id}/approve Approve HITL task
POST /hitl/{task_id}/reject Reject HITL task
GET /hitl/history HITL decision history
GET /audit-log CSF audit log
POST /compliance-report Generate compliance report
GET /wizard/{domain} Safety wizard for a domain
GET /templates Safety policy templates
GET /templates/{name} Get a specific template

Bias Evolution (7, experimental)

Method Path Description
POST /experimental/bias/snapshot Snapshot bias landscape
POST /experimental/bias/observe Record bias observation
POST /experimental/bias/evaluate Evaluate biases
POST /experimental/bias/evolve Evolve bias parameters
POST /experimental/bias/apply Apply evolved biases
POST /experimental/bias/rollback Rollback bias changes
POST /experimental/bias/ground-check Ground-truth bias check

Self-Training (7)

Method Path Description
POST /self-training/audit Audit a single component
POST /self-training/audit-all Audit all components
GET /self-training/scorecard Component quality scorecard
POST /self-training/promote Promote component quality level
POST /self-training/flag Flag component for review
GET /self-training/rubric/{component} Get rubric for component
GET /self-training/rubrics List all rubrics

Deploy (4)

Method Path Description
GET /status Deployment status
GET /history Deployment history
POST /rollback Rollback deployment
GET /health Deployment health

Jobs (4)

Method Path Description
POST /invoke Submit a job agent invocation
POST /pipeline Submit a job pipeline
GET /{job_id} Get job status
GET `` List jobs

Visualisation (3)

Method Path Description
GET /visualisation/metrics Visualisation metrics
GET /visualisation/{project_id} Get project visualisation data
POST /visualisation/{project_id}/open Open visualisation

WebSocket (1)

Method Path Description
WS /ws/pipeline Streaming pipeline events

Admin (1)

Method Path Description
POST /admin/reload-policy Reload RBAC security policy (admin only)

Architecture

The REST base uses lazy initialization for heavyweight components:

  • Navigator (_get_nav()) -- singleton NavigatorMCPBlock created on first request
  • Guide (_get_guide()) -- singleton GuideMCPBlock created on first request
  • Registry -- accessed via mvp.core.registry.get_registry() on each request

All endpoints return a consistent JSON shape with an ok boolean and either result/data fields or an error string.

Deployment

# Development
python -m mvp.rest

# Production
uvicorn mvp.rest:app --host 0.0.0.0 --port 8010 --workers 4

# Docker
docker build -f bases/mvp/rest/Dockerfile -t g6-rest .
docker run -p 8010:8010 g6-rest

Interactive docs

FastAPI automatically generates interactive API documentation:

  • Swagger UI: http://localhost:8010/docs
  • ReDoc: http://localhost:8010/redoc

Source files

File Purpose
bases/mvp/rest/__init__.py Exports app
bases/mvp/rest/__main__.py Entry point
bases/mvp/rest/app.py FastAPI app, assembles route modules and middleware
bases/mvp/rest/routes/ 16 route modules (health, core, navigator, guide, pipelines, workflow, admin, bias, visualisation, tier, learning, tasks, safety, deploy, jobs, self_training, ws)
bases/mvp/rest/cluster_manifest.py Cluster definitions (visible/hidden, components)
bases/mvp/rest/cluster_router.py Manifest-driven cluster REST routes
bases/mvp/rest/middleware.py CORS, security headers, telemetry, jitter
bases/mvp/rest/security_middleware.py Security gateway middleware
bases/mvp/rest/security_helpers.py Security gateway integration helpers
bases/mvp/rest/config_guard.py Startup config validation
bases/mvp/rest/sdk.py SDK client helpers
bases/mvp/rest/response_models.py Shared Pydantic response models
bases/mvp/rest/Dockerfile Container build

See also