Browse all docs & guides
On this page
GETTING STARTED

MCP Server & Tools

OpenGen serves two stateless Streamable HTTP MCP endpoints. The /mcp endpoint exposes all 15 read and write tools behind OAuth 2.1 or API key auth, while /mcp/readonly exposes 9 read-only tools including 4 zero-auth public discovery tools (find_models, get_model, estimate_cost, search_docs). Both publish RFC 9728 metadata, CORS headers, and standard Accept compatibility.

Reviewed 2026-12-02
AGENT PROMPT · PASTE INTO YOUR AGENT OR AUTO-READ
Connect to OpenGen over Streamable HTTP MCP using https://opengen.dev/docs/mcp:
1. For zero-auth discovery, send JSON-RPC POST requests to https://opengen.dev/mcp/readonly and call find_models, get_model, estimate_cost, or search_docs (or read opengen://skill and opengen://pricing).
2. For private workspace reads and paid generations, connect to https://opengen.dev/mcp with OAuth 2.1 DCR+PKCE (discovered at https://opengen.dev/.well-known/oauth-protected-resource/mcp) or an OpenGen Bearer token.
3. Always call get_model, estimate_cost, and balance before generate. Confirm the exact model, route, and maxCostMicros spend cap with the user, persist an idempotencyKey, and never call generate a second time to recover a timed-out job — use job_get({ idempotencyKey }) instead.
4. When job_get or generate returns private delivery URLs, include clickable Open/Download links alongside expiresAt and the job ID in your response.
View raw .md ↗

Two Streamable HTTP MCP endpoints

OpenGen provides two stateless Streamable HTTP MCP endpoints (POST only; GET returns 405 with Allow: POST, OPTIONS):

EndpointToolsAuthenticationRFC 9728 Protected Resource Metadata
https://opengen.dev/mcp15 tools (9 read-only + 6 write/billable)OAuth 2.1 DCR + PKCE or OpenGen Bearer token (read, generate)https://opengen.dev/.well-known/oauth-protected-resource/mcp
https://opengen.dev/mcp/readonly9 read-only tools (4 zero-auth public + 5 workspace-read)Zero auth for initialize, tools/list, resources/*, prompts/*, find_models, get_model, estimate_cost, search_docs; read OAuth/Bearer token required for workspace toolshttps://opengen.dev/.well-known/oauth-protected-resource/mcp/readonly

Edge ergonomics: CORS, Accept, and SSE progress

  • **Zero-friction Accept handling**: Missing Accept, */*, or application/json headers are normalized cleanly so plain curl and browser fetch JSON-RPC calls receive 200 OK with application/json (never spurious 406 Not Acceptable). Explicitly refusing JSON (such as Accept: application/json;q=0, text/event-stream) returns 406.
  • Opt-in SSE progress: Sending Accept: application/json, text/event-stream together with _meta.progressToken on generate (with waitMs > 0) or job_get (with waitMs > 0 or afterRevision) streams live notifications/progress frames over text/event-stream (Cache-Control: private, no-store, no-transform, X-Accel-Buffering: no).
  • Browser & remote CORS: Both /mcp and /mcp/readonly return Access-Control-Allow-Origin: * (never Access-Control-Allow-Credentials: true), Cache-Control: no-store, Vary: Authorization, and 204 OPTIONS preflight responses.

Zero-auth test against /mcp/readonly

Any agent, IDE, or HTTP client can inspect OpenGen's catalog, schemas, regional privacy disclosures, published pricing, and docs over /mcp/readonly with zero credentials:

# 1. List all 9 read-only MCP tools with zero auth and plain default Accept
curl --fail-with-body -X POST "https://opengen.dev/mcp/readonly" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list",
    "params": {}
  }'

# 2. Run a zero-auth dry-run cost estimate over MCP
curl --fail-with-body -X POST "https://opengen.dev/mcp/readonly" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "estimate_cost",
      "arguments": {
        "modelId": "openai/gpt-image-2",
        "operation": "text-to-image",
        "input": { "prompt": "Studio portrait of a ceramic vase", "resolution": "1K", "quality": "low" }
      }
    }
  }'

Complete MCP tool reference (15 tools)

Public zero-auth discovery tools (4 — /mcp/readonly & /mcp)

ToolRequired AuthKey ArgumentsPurpose
find_modelsNone on /mcp/readonlyquery?, listCollections?, collection?, modality?, providerId?, region?, familyId?, operation?, inputRole?Search exact catalog variants or list/inspect the 9 curated factual collections
get_modelNone on /mcp/readonlyid, operation?Single-call inspection of an exact model, alias, series, or route: returns generationProfiles, regional routes with privacyDisclosure, deployments, and published pricing
estimate_costNone on /mcp/readonlymodelId, operation, input, billing?, routeId?, routing?, maxCostMicros?Stateless dry-run cost estimator (estimatedCostMicros, recommendedMaxCostMicros, route candidates, plus workspaceEligibility when authenticated)
search_docsNone on /mcp/readonlyquery, topic?, limit? (1–10)Search OpenGen documentation chunks across quickstart, models, generation, pricing, assets, webhooks, recovery, analytics, privacy, and mcp-cli

Workspace read-only tools (5 — /mcp/readonly & /mcp)

ToolRequired ScopeKey ArgumentsPurpose
balanceread{}Read availableMicros, reservedMicros, currency, workspaceId, plus billingUrl and minTopUpUsd (5) when hosted top-ups are active
analyticsreadsince?, until?, modelId?, providerId?, deploymentId?, endpointRegion?, operation?, keyId?, status?, project?Bounded (max 31-day) workspace usage, spend (settledMicros, heldMicros, byKey, byTag), and per-route latency/reliability cohorts
job_getreadid? or idempotencyKey?, plus optional waitMs (0–25000), afterRevisionRead, long-poll with live progress, recover a lost submission by idempotencyKey, refresh signed output URLs, and attach the inline MCP App preview card
jobs_listreadstatus?, modelId?, providerId?, deploymentId?, endpointRegion?, operation?, keyId?, project?, since?, until?, limit?, cursor?List private workspace generation jobs newest-first with { data, nextCursor } pagination
assets_listreadstate? (default ready), mediaTypePrefix?, limit? (1–100), cursor?List private workspace-owned uploaded/imported input assets with cursor pagination

Workspace write & billable tools (6 — /mcp only)

ToolRequired ScopeKey ArgumentsPurpose
generategeneratemodelId, operation, input, idempotencyKey, billing?, routeId?, routing?, maxCostMicros?, metadata?, webhookUrl?, webhookEvents?, waitMs? (0–25000)Submit one generation once with a persisted idempotencyKey; optionally wait up to 25s for fast results + inline MCP App preview
job_cancelgenerateidCancel a queued job immediately (releasing its hold) or request upstream cancellation on a running job (refund not guaranteed until confirmed)
upload_assetgeneratesource (url | job_output | presign_prepare | presign_complete | base64), plus source-specific fieldsIngest private workspace input media and obtain a reusable assetKey (inline base64 strictly capped at 64 KiB; presigned PUT up to 100 MiB)
upload_attachmentgeneratefile (download_url, file_id, mime_type?, file_name?), type (image | video | audio), idempotencyKeyHosted-chat attachment ingestion (_meta['openai/fileParams']) via SSRF-safe public HTTPS import without passing file bytes through LLM tokens
delete_assetgeneratekeyTombstone and delete a workspace-owned input asset key (blocks new admissions while preserving in-flight job pins)
purge_job_outputsgenerateidPermanently delete archived output media bytes for a terminal settled job while preserving metadata and accounting history

MCP resources, prompts, and interactive preview apps

Both /mcp and /mcp/readonly register five MCP Resources and three guided Prompts:

  • Resources:
  • ui://opengen/job-result (text/html;profile=mcp-app) — sandboxed interactive MCP App preview card attached to generate and job_get responses, displaying first-party signed images, videos, and audio with explicit CSP resourceDomains.
  • opengen://skill (text/markdown) — safe discovery, estimation, upload, submit, and recovery workflow instructions.
  • opengen://llms (text/plain) — compact endpoint and discovery index.
  • opengen://pricing (application/json) — full single-source published route pricing table from @media-router/catalog.
  • opengen://models/{provider}/{model} (application/json) — resource template listing all 54 exact models with schemas, regional routes, privacy disclosures, and pricing.
  • Prompts: generate-image, image-to-video, and troubleshoot-job.

Supported clients and verification status

Client-specific setup guides live under Agent Clients. OpenGen distinguishes live-verified integrations from documentation-only configurations:

Desktop and mobile apps for hosted assistants remain separately unverified. For raw HTTP integrations outside MCP, see Quickstart and API Reference.