{
  "openapi": "3.1.0",
  "info": {
    "title": "Glif MCP API",
    "version": "1.0.0",
    "description": "Glif's media-generation agent over the Model Context Protocol (MCP).\n\nThe single endpoint `POST /api/mcp` speaks JSON-RPC 2.0 over Streamable\nHTTP (stateless; responses may stream as SSE). Authenticate with a\nbearer token: either a `glif_v1_...` API key or an MCP OAuth access token.\n\nStandard MCP methods are supported: `initialize`, `tools/list`, and\n`tools/call`. Generation runs in the background:\n`compose_project` returns a jobId immediately and `get_job_status`\nchecks it using `job_id`. Call `tools/list` for current tool input/output schemas.\n\n`compose_project.intelligence` picks the agent: `lite`, `smart`, or\n`genius`. Without a tier, new projects use your preferred model and\nexisting ones keep theirs.\n\n`compose_project` costs credits and runs without a mid-run approval step.\nWhile a job is working, a call for the same project returns an error and a\ncall without project_id starts a separate billable job in a new project.\nFinished job records expire after about 30 minutes. Saved media remains\navailable through `get_project`.\n\nTools:\n- compose_project: create or continue a saved Glif project from a natural-language prompt. Returns a jobId while generation runs in the background.\n- get_job_status: check a job by passing jobId as job_id. Returns saved public text and media before completion. Pass progressCursor as progress_cursor to wait for changes.\n- get_project: read project state, recent messages and generated media.\n- view_media: reopen completed or saved media in clients that support the Glif viewer.\n- select_project_images: pick saved images from an owned project. Returns asset IDs for compose_project asset_ids and never starts generation.\n- list_projects: list the authenticated user's recent projects.\n- list_user_skills: list the user's own saved Glif skills.\n- get_user_skill: read one of the user's own skills, including its instructions.\n- upload_file: upload image, video or audio references, or request a signed upload for a local file. Documents require a signed upload.\n- whoami: read identity, plan, credit balance, recent spend and the default agent tier.\n- read_settings: read the account's default agent tier for new projects.\n- update_settings: change the account's default agent tier for new projects."
  },
  "servers": [
    {
      "url": "https://glif.app",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/mcp": {
      "post": {
        "summary": "MCP JSON-RPC endpoint",
        "description": "Send a JSON-RPC 2.0 request. See the MCP spec (https://modelcontextprotocol.io) for the envelope; call `tools/list` for the live tool schemas.",
        "operationId": "mcpJsonRpc",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              },
              "examples": {
                "toolsList": {
                  "summary": "List available tools",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "tools/list"
                  }
                },
                "composeProject": {
                  "summary": "Call compose_project",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "tools/call",
                    "params": {
                      "name": "compose_project",
                      "arguments": {
                        "prompt": "a watercolor fox in a snowy forest",
                        "intelligence": "smart"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response (JSON, or SSE stream for streaming results).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token."
          },
          "429": {
            "description": "Per-credential rate limit exceeded."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A `glif_v1_...` API key or an MCP OAuth access token."
      }
    },
    "schemas": {
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number"
            ]
          },
          "method": {
            "type": "string",
            "examples": [
              "tools/list",
              "tools/call"
            ]
          },
          "params": {
            "type": "object"
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "result": {
            "type": "object"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "number"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}