> ## Documentation Index
> Fetch the complete documentation index at: https://docs.custral.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server (Streamable HTTP)

> Custral's Model Context Protocol server, over the Streamable HTTP transport, stateless. Point an MCP client (Claude, Cursor, …) at this URL rather than calling it by hand. Send JSON-RPC 2.0 with `Accept: application/json, text/event-stream`; the reply streams back as server-sent events. The tools offered depend on the key's scopes (`GET /v1/mcp/tools` lists them without the handshake). **Requires scope:** `mcp:read`, plus each tool's resource scope; writes also need `mcp:write`. Unlike the rest of `/v1`, this endpoint answers auth failures with real HTTP status codes, because MCP clients expect them.



## OpenAPI

````yaml /openapi-v1.json post /v1/mcp
openapi: 3.1.0
info:
  title: Custral API
  version: v1
  description: >-
    The curated, versioned, API-key-authenticated public REST surface (`/v1`).
    Every endpoint here is what the official SDKs (`@custral/sdk`) and the MCP
    server are built on. Authenticate with a secret API key (`sk_…`) created in
    **Settings → Developers → Applications**.


    Every `/v1` response is sent with **HTTP 200**, success and failure alike. A
    success carries `data`; a failure carries `error` with a machine-readable
    `code` (see the `Error` schema), so branch on `error`, never on the status.
    `POST /v1/mcp` is the one exception: it answers auth failures with real 401
    / 403 / 429 statuses, as MCP clients expect.
  contact:
    name: Custral Support
    email: hello@custral.com
    url: https://custral.com
  license:
    name: Proprietary
    url: https://custral.com
servers:
  - url: https://api.custral.com
    description: Production
security:
  - ApiKey: []
tags:
  - name: Identity
    description: Introspect the calling API key.
  - name: Records
    description: Create, list, retrieve, and update records on any object.
  - name: Objects
    description: Read the object (table) schema of your workspace.
  - name: Conversations
    description: View, manage, and ingest conversations and their messages.
  - name: MCP
    description: Custral's MCP server, and the tool surface a key sees on it.
  - name: Documents
    description: Read record notes / page documents as markdown.
  - name: Connectors
    description: The MCP servers Stella can use tools from.
  - name: Property agents
    description: AI auto-fill agents on properties.
  - name: Usage modules
    description: Metered-product setups, their usage events, and per-record usage.
  - name: Applications & keys
    description: Developer applications and the API keys they hold.
  - name: Widget identity
    description: Vouch for who a chat widget visitor is.
  - name: Embeds & real-time
    description: Read the rows behind your own embed block, with an embed token.
  - name: Lists
    description: Read lists and change who is on them.
  - name: Customer journeys
    description: The workspace's customer journey, and where each customer is in it.
  - name: Quotes
    description: Quotes, contracts and contract templates.
  - name: Billing
    description: >-
      Customer billing, invoices, subscriptions, revenue metrics, the billing
      page, Stripe customer links, billing setup, products and plans.
paths:
  /v1/mcp:
    post:
      tags:
        - MCP
      summary: MCP server (Streamable HTTP)
      description: >-
        Custral's Model Context Protocol server, over the Streamable HTTP
        transport, stateless. Point an MCP client (Claude, Cursor, …) at this
        URL rather than calling it by hand. Send JSON-RPC 2.0 with `Accept:
        application/json, text/event-stream`; the reply streams back as
        server-sent events. The tools offered depend on the key's scopes (`GET
        /v1/mcp/tools` lists them without the handshake). **Requires scope:**
        `mcp:read`, plus each tool's resource scope; writes also need
        `mcp:write`. Unlike the rest of `/v1`, this endpoint answers auth
        failures with real HTTP status codes, because MCP clients expect them.
      operationId: mcpServer
      parameters:
        - name: Accept
          in: header
          required: true
          description: >-
            Must list both `application/json` and `text/event-stream`, or the
            server answers 406.
          schema:
            type: string
          example: application/json, text/event-stream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/JsonRpcRequest'
                - type: array
                  items:
                    $ref: '#/components/schemas/JsonRpcRequest'
            example:
              jsonrpc: '2.0'
              id: 1
              method: tools/list
      responses:
        '200':
          description: >-
            A server-sent event stream carrying the JSON-RPC response (each
            `data:` line is one message).
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse'
        '202':
          description: >-
            Accepted: the body held only notifications or responses, so there is
            nothing to reply.
        '401':
          $ref: '#/components/responses/McpUnauthorized'
        '403':
          $ref: '#/components/responses/McpForbidden'
        '406':
          description: >-
            The `Accept` header doesn't list both `application/json` and
            `text/event-stream`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonRpcResponse'
        '429':
          $ref: '#/components/responses/McpRateLimited'
components:
  schemas:
    JsonRpcRequest:
      type: object
      description: A JSON-RPC 2.0 message (or send an array of them).
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        id:
          type:
            - string
            - integer
          description: Omit for a notification.
        method:
          type: string
          description: 'An MCP method: `initialize`, `tools/list`, `tools/call`, …'
          example: tools/list
        params:
          type: object
          additionalProperties: true
      required:
        - jsonrpc
        - method
    JsonRpcResponse:
      type: object
      description: 'A JSON-RPC 2.0 response: `result` on success, `error` on failure.'
      properties:
        jsonrpc:
          type: string
          enum:
            - '2.0'
        id:
          type:
            - string
            - integer
            - 'null'
        result:
          type: object
          additionalProperties: true
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            data: {}
          required:
            - code
            - message
      required:
        - jsonrpc
    McpError:
      type: object
      description: The MCP endpoint's own auth failure body. It carries no `reqId`.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
      required:
        - error
  responses:
    McpUnauthorized:
      description: >-
        No key was sent (`unauthorized`), or it is unknown, revoked or expired
        (`invalid_api_key`). The `WWW-Authenticate` header points an MCP client
        at the OAuth sign-in.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/McpError'
          example:
            error:
              code: invalid_api_key
              message: Invalid or expired API key
      headers:
        WWW-Authenticate:
          description: >-
            A Bearer challenge with `resource_metadata` and the scopes to ask
            for.
          schema:
            type: string
    McpForbidden:
      description: >-
        The workspace's plan has no API access (`api_access_not_on_plan`), or
        the key lacks `mcp:read` (`insufficient_scope`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/McpError'
          example:
            error:
              code: insufficient_scope
              message: This key lacks the mcp:read scope
    McpRateLimited:
      description: Rate limited (`rate_limited`). Wait for `Retry-After`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/McpError'
          example:
            error:
              code: rate_limited
              message: Too many requests
      headers:
        Retry-After:
          description: Seconds until the budget resets.
          schema:
            type: integer
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk_...
      description: >-
        A Custral API key, created in Settings → Developers → Applications, sent
        as `Authorization: Bearer sk_…`. The `X-Api-Key` header is also accepted
        and takes precedence. Use a **secret** key (`sk_…`) from your server; a
        publishable key (`pk_…`) may hold only `objects:read` and `usage:write`.
        Never expose a secret key in a browser.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.