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

> ## Agent Instructions
> Peel builds APIs from a URL and a task. Use only the REST routes under https://api.peel.sh and the hosted MCP server at https://api.peel.sh/mcp. Authenticate with the X-API-Key header, or send the same key as Authorization: Bearer. Errors carry code, message, retryable, retry, docs_url and details; branch on code. The peel CLI and the open-source SDK are not published; do not run npm install peel, which is an unrelated package. The keyless routes need no key and no session: the GET /public/marketplace routes, POST /v1/marketplace/{marketplace_id}/endpoints/{endpoint_name}:call and https://api.peel.sh/mcp/keyless. Account routes take a key or a signed-in session and answer 401 without one. These take only a session from peel.sh and refuse a key: GET /v1/accounts, POST /v1/accounts/join, POST /v1/accounts/{account_id}/leave, POST /v1/team/invites, GET /v1/connected-apps, DELETE /v1/connected-apps/{client_id}, PUT /v1/logins, DELETE /v1/logins, GET /v1/logins/code and the /account/billing routes. Every route with its schemas is in https://docs.peel.sh/openapi.json. Use the exact route, field and error-code names shown in these pages, and read the API Reference tab for request and response schemas.

# Call one API's own MCP server, whose tools are that API's endpoints



## OpenAPI

````yaml /openapi.json post /mcp/apis/{apiId}
openapi: 3.1.0
info:
  title: Peel API
  version: 0.1.0
  description: >-
    Public Peel API for creating APIs from URLs, inspecting them, calling
    generated endpoints, revising builds, and exporting OpenAPI or MCP
    definitions.
servers:
  - url: https://api.peel.sh
security: []
tags:
  - name: APIs
    description: Create, list, inspect, revise, rebuild, and export APIs.
  - name: Account
    description: Credits and account usage surfaces used by REST and MCP clients.
  - name: Device Auth
    description: CLI browser-login device flow helpers.
  - name: Endpoint Execution
    description: Execute generated endpoints through a stable API resource.
  - name: OAuth
    description: OAuth discovery and token flows for hosted MCP clients.
  - name: MCP
    description: Hosted MCP transport and discovery surface.
  - name: Marketplace
    description: Discover, install, publish, and explicitly contribute APIs.
  - name: Execution Jobs
    description: Start, reconnect, answer and cancel owner-scoped host executions.
  - name: Runs
    description: >-
      Every call, batch item and execution you ran, with its outcome and its
      requests to the site.
  - name: Files
    description: Encrypted owner-scoped files for declared runtime uploads and downloads.
  - name: Logins
    description: >-
      Saved site logins Peel signs in with for endpoints that need a signed-in
      session.
  - name: Webhooks
    description: Signed Standard Webhooks events for builds and execution jobs.
  - name: Schedules
    description: Run a data endpoint on a schedule and hear when its answer changes.
paths:
  /mcp/apis/{apiId}:
    post:
      tags:
        - MCP
      summary: Call one API's own MCP server, whose tools are that API's endpoints
      operationId: postApiMcpJsonRpc
      parameters:
        - in: path
          name: apiId
          required: true
          schema:
            type: string
        - in: header
          name: Accept
          schema:
            type: string
          description: Should include "application/json" and "text/event-stream".
        - in: header
          name: MCP-Protocol-Version
          schema:
            type: string
            enum:
              - '2026-07-28'
              - '2025-11-25'
              - '2025-06-18'
              - '2025-03-26'
              - '2024-11-05'
          description: >-
            2026-07-28 clients call server/discover and need no initialize; when
            sent, this header and Mcp-Method must match the body. Older clients
            use the version negotiated by initialize. If omitted, the server
            falls back to 2025-03-26.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/McpRequest'
            examples:
              initialize:
                summary: Initialize an MCP session
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: initialize
                  params:
                    protocolVersion: '2025-11-25'
                    capabilities: {}
                    clientInfo:
                      name: example-client
                      version: 1.0.0
              listTools:
                summary: List available tools
                value:
                  jsonrpc: '2.0'
                  id: 2
                  method: tools/list
                  params: {}
              callEndpoint:
                summary: Call a Peel endpoint through MCP
                value:
                  jsonrpc: '2.0'
                  id: 3
                  method: tools/call
                  params:
                    name: call_endpoint
                    arguments:
                      api_id: 11111111-1111-4111-8111-111111111111
                      endpoint_name: list_items
                      params: {}
              callSessionEndpoint:
                summary: Call a session-backed Peel endpoint through MCP
                value:
                  jsonrpc: '2.0'
                  id: 4
                  method: tools/call
                  params:
                    name: call_endpoint
                    arguments:
                      api_id: 11111111-1111-4111-8111-111111111111
                      endpoint_name: list_orders
                      params:
                        status: open
                      session_id: sess_example
                      encryption_key: enc_example
      responses:
        '200':
          description: JSON-RPC result or error envelope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/McpJsonRpcResponse'
        '202':
          description: >-
            Accepted notification or notification-only request with no response
            body.
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '401':
          description: Missing or invalid auth.
          headers:
            WWW-Authenticate:
              schema:
                type: string
              description: >-
                OAuth bearer challenge with MCP resource metadata when
                available.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '406':
          description: The client did not advertise a compatible Accept header.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - OAuthBearerAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    McpRequest:
      anyOf:
        - $ref: '#/components/schemas/McpInitializeRequest'
        - $ref: '#/components/schemas/McpToolsListRequest'
        - $ref: '#/components/schemas/McpToolsCallRequest'
        - $ref: '#/components/schemas/McpPingRequest'
        - $ref: '#/components/schemas/McpInitializedNotification'
        - $ref: '#/components/schemas/McpGenericRequest'
    McpJsonRpcResponse:
      oneOf:
        - $ref: '#/components/schemas/McpJsonRpcSuccess'
        - $ref: '#/components/schemas/McpJsonRpcError'
    McpInitializeRequest:
      type: object
      required:
        - jsonrpc
        - method
        - params
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
          const: initialize
        params:
          type: object
          required:
            - protocolVersion
            - capabilities
            - clientInfo
          properties:
            protocolVersion:
              type: string
              enum:
                - '2025-11-25'
                - '2025-03-26'
            capabilities:
              type: object
              additionalProperties: true
            clientInfo:
              type: object
              required:
                - name
                - version
              properties:
                name:
                  type: string
                version:
                  type: string
              additionalProperties: true
          additionalProperties: true
      additionalProperties: true
    McpToolsListRequest:
      type: object
      required:
        - jsonrpc
        - method
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
          const: tools/list
        params:
          type: object
          properties:
            cursor:
              type: string
          additionalProperties: true
      additionalProperties: true
    McpToolsCallRequest:
      type: object
      required:
        - jsonrpc
        - method
        - params
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
          const: tools/call
        params:
          type: object
          required:
            - name
          properties:
            name:
              type: string
            arguments:
              type: object
              additionalProperties: true
          additionalProperties: true
      additionalProperties: true
    McpPingRequest:
      type: object
      required:
        - jsonrpc
        - method
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
          const: ping
      additionalProperties: true
    McpInitializedNotification:
      type: object
      required:
        - jsonrpc
        - method
      properties:
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
          const: notifications/initialized
      additionalProperties: true
    McpGenericRequest:
      type: object
      required:
        - jsonrpc
        - method
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        method:
          type: string
        params:
          oneOf:
            - type: array
            - type: object
            - type: 'null'
      additionalProperties: true
    McpJsonRpcSuccess:
      type: object
      required:
        - jsonrpc
        - result
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        result:
          $ref: '#/components/schemas/McpJsonValue'
      additionalProperties: false
    McpJsonRpcError:
      type: object
      required:
        - jsonrpc
        - error
      properties:
        id:
          oneOf:
            - type: string
            - type: number
            - type: 'null'
        jsonrpc:
          type: string
          const: '2.0'
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: integer
            message:
              type: string
            data:
              $ref: '#/components/schemas/McpJsonValue'
          additionalProperties: true
      additionalProperties: false
    McpJsonValue:
      oneOf:
        - type: object
          additionalProperties: true
        - type: array
          items: {}
        - type: string
        - type: number
        - type: boolean
        - type: 'null'
  securitySchemes:
    OAuthBearerAuth:
      type: http
      scheme: bearer
      description: OAuth bearer token issued by Peel for hosted MCP clients.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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