Routes & Guide

Quick-start examples, full endpoint reference for LLM, MCP, and public APIs, plus live tenant info.

Quick start

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "X-Tenant-ID: tenant_ecommerce" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role":"user","content":"Show me recent invoices"}],
    "stream": true
  }'

LLM

Requires X-Tenant-ID header.

POST /v1/chat/completions OpenAI-compatible chat. Pass stream: true to receive token-by-token SSE, or stream: false for a single JSON response.
POST /v1/messages Anthropic Messages API. Accepts model, messages, max_tokens. Pass stream: true for SSE with content_block_delta events, or stream: false for a single JSON response.

MCP

Requires X-Tenant-ID header. Implements JSON-RPC 2.0 over HTTP.

POST /mcp/message MCP JSON-RPC endpoint. Pass Accept: text/event-stream to wrap the response as an SSE event (spec 2025-03-26).
GET /mcp/sse Legacy HTTP+SSE transport (spec 2024-11-05). Emits an endpoint event with the POST URL, then pings every 15 s.

Supported methods

tools/list Returns all tools defined in the tenant's scenarios.
tools/call Calls a named tool. Returns mock JSON from the matching tenant scenario.
resources/list Returns an empty resource list (stub).
prompts/list Returns an empty prompt list (stub).
initialize Returns server info and capability advertisement for the 2025-03-26 protocol version.

Quick start

curl -s -X POST http://localhost:8080/mcp/message \
  -H "X-Tenant-ID: tenant_saas_growth" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# Returns all tools defined in this tenant's scenarios:
# get_growth_metrics, get_churn_report, get_feature_adoption

Public API

Reads are public (global tenants open to all, private tenants require ownership). Writes require login. No X-Tenant-ID required.

Tenants

GET /public/tenants List tenants. Unauthenticated returns global tenants only; logged-in users also see their private tenants.
POST /public/tenants Create a tenant. Body: {"tenant_id":"…","state":{}} auth
GET /public/tenants/{id} Get tenant state. Global tenants open; private tenants require ownership.
PUT /public/tenants/{id}/state Replace tenant state. Body: {"state":{}} auth
GET /public/tenants/{id}/settings Get tenant settings. Same visibility rules as state.
PATCH /public/tenants/{id}/settings Merge-patch tenant settings. Body: any JSON object. auth
DELETE /public/tenants/{id} Delete tenant and all its scenarios. auth

Scenarios

GET /public/tenants/{id}/scenarios List scenarios. Same visibility rules as state.
POST /public/tenants/{id}/scenarios Add a scenario or MCP tool. Body: {"keywords":["…"],"response":"…","tool_name":"…","tool_data":{}} auth
DELETE /public/tenants/{id}/scenarios/{sid} Delete a scenario by ID. auth

Chaos

GET /public/tenants/{id}/chaos Get current chaos profile. Same visibility rules as state.
POST /public/tenants/{id}/chaos Set profile: none rate_limit server_error latency auth

Live tenants

Running on this server right now. Each tenant has its own mock state, scenarios, and MCP tools.

Loading tenants…