{
  "openapi": "3.1.0",
  "info": {
    "title": "GreatArrow.ai MCP Server",
    "description": "Multi-tenant AI memory + integrations platform. The primary machine interface is the MCP endpoint (Streamable HTTP): tools across 5 scopes for memory, integrations, agents, meetings, and todos. The live tool catalog is the MCP tools/list handshake; the curated public set is at https://www.greatarrow.ai/.well-known/mcp/server-card.json and connection details at https://www.greatarrow.ai/.well-known/mcp. Full capability map: https://www.greatarrow.ai/llms.txt",
    "version": "0.2.0",
    "contact": { "url": "https://www.greatarrow.ai/support" },
    "termsOfService": "https://www.greatarrow.ai/legal/terms"
  },
  "servers": [{ "url": "https://www.greatarrow.ai" }],
  "paths": {
    "/api/mcp": {
      "post": {
        "summary": "Model Context Protocol endpoint (JSON-RPC 2.0 over Streamable HTTP)",
        "description": "Authenticate via OAuth 2.1 with dynamic client registration (discovery at /.well-known/oauth-authorization-server) or a Bearer API token minted in-app. Tool catalog is served by the MCP initialize/tools-list handshake.",
        "responses": {
          "200": { "description": "JSON-RPC 2.0 response or SSE stream" }
        }
      }
    },
    "/api/v1/tools": {
      "get": {
        "tags": ["Public API v1"],
        "summary": "List the tools this credential can call",
        "security": [{ "bearerToken": [] }],
        "parameters": [
          {
            "name": "X-Workspace-Id",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "format": "uuid" },
            "description": "Workspace to act in. Wins over the key's pin and the OAuth consent workspace."
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "The catalog, with an ETag.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": ["tools"],
                      "properties": {
                        "tools": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/V1CatalogEntry"
                          }
                        }
                      }
                    },
                    "meta": { "$ref": "#/components/schemas/V1Meta" }
                  }
                }
              }
            }
          },
          "304": { "description": "Not modified (If-None-Match matched)." },
          "default": {
            "description": "Any error in V1ErrorCode.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/V1Error" }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{name}": {
      "get": {
        "tags": ["Public API v1"],
        "summary": "One catalog entry",
        "security": [{ "bearerToken": [] }],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The tool's stable name, as listed by GET /api/v1/tools."
          },
          {
            "name": "X-Workspace-Id",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "format": "uuid" },
            "description": "Workspace to act in. Wins over the key's pin and the OAuth consent workspace."
          },
          {
            "name": "If-None-Match",
            "in": "header",
            "required": false,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "The entry, with an ETag.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": { "$ref": "#/components/schemas/V1CatalogEntry" },
                    "meta": { "$ref": "#/components/schemas/V1Meta" }
                  }
                }
              }
            }
          },
          "304": { "description": "Not modified (If-None-Match matched)." },
          "404": {
            "description": "`unknown_tool`: hidden from this caller.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/V1Error" }
              }
            }
          },
          "default": {
            "description": "Any error in V1ErrorCode.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/V1Error" }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Public API v1"],
        "summary": "Call a tool",
        "security": [{ "bearerToken": [] }],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The tool's stable name, as listed by GET /api/v1/tools."
          },
          {
            "name": "X-Workspace-Id",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "format": "uuid" },
            "description": "Workspace to act in. Wins over the key's pin and the OAuth consent workspace."
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": { "type": "string" },
            "description": "Replays the first result for the same key and arguments."
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "args": {
                    "type": "object",
                    "description": "Validated against the tool's catalog `inputSchema`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool's result. `data` follows the catalog `outputSchema` when the tool has one.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": {},
                    "meta": { "$ref": "#/components/schemas/V1Meta" }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Any error in V1ErrorCode.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/V1Error" }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Public API v1",
      "description": "Bearer-only tool API (docs/reference/PUBLIC_API.md). Per-tool schemas are served live by GET /api/v1/tools."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal API key (gad_…) or an OAuth access token. /api/v1 never reads a cookie."
      }
    },
    "schemas": {
      "V1ErrorCode": {
        "type": "string",
        "description": "Every code in V1_ERRORS (src/lib/api-v1/errors.ts). A downstream route's own snake_case code may also pass through.",
        "enum": [
          "invalid_token",
          "invalid_request",
          "rate_limited",
          "origin_not_allowed_for_client",
          "not_enabled",
          "pat_not_allowed_from_browser",
          "temporarily_unavailable",
          "idempotency_key_reused",
          "idempotency_in_progress",
          "long_running_tool",
          "result_too_large",
          "unknown_tool",
          "invalid_arguments",
          "arguments_too_large",
          "insufficient_scope",
          "tool_not_allowed_for_client",
          "tool_not_available_on_connector",
          "auto_memory_off",
          "workspace_pinned",
          "workspace_forbidden",
          "workspace_required",
          "workspace_choice_required",
          "workspace_choice_unavailable",
          "workspace_isolation",
          "firewall_unavailable",
          "too_many_injection_attempts",
          "content_blocked",
          "free_access_ended",
          "stated_intent_required",
          "circuit_open",
          "tool_timeout",
          "internal_error",
          "request_failed",
          "not_found",
          "validation_failed",
          "version_conflict",
          "no_workspace",
          "forbidden",
          "resource_not_in_workspace_scope",
          "dry_run_unsupported",
          "not_published",
          "not_connected",
          "draft_failed",
          "review_failed",
          "export_upload_failed",
          "no_user",
          "over_budget",
          "refused",
          "content_redacted"
        ]
      },
      "V1Meta": {
        "type": "object",
        "required": ["requestId"],
        "properties": {
          "requestId": { "type": "string" },
          "apiVersion": { "type": "string" }
        },
        "additionalProperties": true
      },
      "V1Error": {
        "type": "object",
        "required": ["error", "meta"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "$ref": "#/components/schemas/V1ErrorCode" },
              "message": { "type": "string" },
              "hint": { "type": "string" },
              "details": { "type": "object" },
              "issues": { "type": "array", "items": {} },
              "retry_after": { "type": "integer" },
              "reauth_url": { "type": "string" },
              "reconnect": { "type": "object" }
            }
          },
          "meta": { "$ref": "#/components/schemas/V1Meta" }
        }
      },
      "V1CatalogEntry": {
        "type": "object",
        "required": [
          "name",
          "title",
          "description",
          "inputSchema",
          "outputSchema",
          "annotations",
          "scope",
          "tier",
          "stability",
          "deprecation",
          "billable",
          "requiresIntegration",
          "idempotent",
          "deadlineMs",
          "longRunning"
        ],
        "properties": {
          "name": { "type": "string" },
          "title": { "type": ["string", "null"] },
          "description": { "type": "string" },
          "inputSchema": {
            "type": "object",
            "description": "JSON Schema for the tool's `args`."
          },
          "outputSchema": {
            "type": ["object", "null"],
            "description": "JSON Schema for `data`, for typed tools only."
          },
          "annotations": { "type": "object" },
          "scope": { "type": "string" },
          "tier": { "type": "string" },
          "stability": {
            "type": ["string", "null"],
            "enum": ["stable", "beta", null]
          },
          "deprecation": {
            "type": ["object", "null"],
            "required": ["successor", "deprecatedOn", "sunsetOn"],
            "properties": {
              "successor": { "type": "string" },
              "deprecatedOn": { "type": "string", "format": "date" },
              "sunsetOn": { "type": "string", "format": "date" }
            }
          },
          "billable": { "type": "boolean" },
          "requiresIntegration": { "type": ["string", "null"] },
          "idempotent": { "type": "boolean" },
          "deadlineMs": { "type": "integer" },
          "longRunning": { "type": "boolean" }
        }
      }
    }
  }
}
