> ## 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.

# Export API as MCP tools



## OpenAPI

````yaml /openapi.json get /v1/apis/{api_id}/exports/mcp
openapi: 3.1.0
info:
  title: Peel API
  version: '2026-03-21'
  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 CLI, 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.
paths:
  /v1/apis/{api_id}/exports/mcp:
    get:
      tags:
        - APIs
      summary: Export API as MCP tools
      operationId: exportApiMcp
      parameters:
        - $ref: '#/components/parameters/ApiId'
      responses:
        '200':
          description: Generated MCP export.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneratedMcpExport'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: The API has not published exportable endpoints yet.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
        - SessionCookieAuth: []
components:
  parameters:
    ApiId:
      in: path
      name: api_id
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    GeneratedMcpExport:
      type: object
      required:
        - schema_version
        - metadata
        - server
        - tools
      properties:
        schema_version:
          type: string
          const: '1.0'
        metadata:
          type: object
          required:
            - identity
          properties:
            auth:
              type: object
              additionalProperties: true
            identity:
              $ref: '#/components/schemas/PublicApiIdentity'
          additionalProperties: true
        server:
          type: object
          required:
            - name
            - version
          properties:
            name:
              type: string
            version:
              type: string
            source_url:
              type: string
          additionalProperties: true
        tools:
          type: array
          items:
            type: object
            required:
              - name
              - description
              - inputSchema
              - annotations
              - metadata
            properties:
              name:
                type: string
              description:
                type: string
              inputSchema:
                type: object
                additionalProperties: true
              annotations:
                type: object
                required:
                  - api_id
                  - endpoint_name
                  - endpoint_type
                  - openWorldHint
                  - readOnlyHint
                  - rest_method
                properties:
                  api_id:
                    type: string
                  binding_id:
                    type: string
                  destructiveHint:
                    type: boolean
                  endpoint_name:
                    type: string
                  endpoint_type:
                    type: string
                  idempotentHint:
                    type: boolean
                  openWorldHint:
                    type: boolean
                  readOnlyHint:
                    type: boolean
                  rest_method:
                    type: string
                    const: POST
                  version_id:
                    type: string
                additionalProperties: true
              metadata:
                type: object
                required:
                  - api_id
                  - auth
                  - auth_requirement
                  - endpoint_name
                  - endpoint_type
                  - execution_base_url
                  - identity
                  - method
                  - rest_method
                  - rest_path
                  - target_method
                properties:
                  api_id:
                    type: string
                  auth:
                    type: object
                    additionalProperties: true
                  auth_requirement:
                    type: string
                  binding_id:
                    type: string
                  credit_cost:
                    type: number
                  depends_on_session:
                    type: string
                  endpoint_name:
                    type: string
                  endpoint_type:
                    type: string
                  execution_base_url:
                    type: string
                  identity:
                    $ref: '#/components/schemas/PublicApiIdentity'
                  initiates_session:
                    type: boolean
                  method:
                    type: string
                    description: Legacy alias for the compiled target transport method.
                  rest_method:
                    type: string
                    const: POST
                  rest_path:
                    type: string
                  runtime_kind:
                    type: string
                  runtime_policy:
                    type: object
                    additionalProperties: true
                  runtime_strategy:
                    type: string
                  runtime_verification:
                    type: object
                    additionalProperties: true
                  session_tag:
                    type: string
                  target_method:
                    type: string
                  version_id:
                    type: string
                additionalProperties: true
            additionalProperties: true
      additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        code:
          type: string
        detail:
          oneOf:
            - type: string
            - type: object
            - type: array
        error:
          type: string
      additionalProperties: true
    PublicApiIdentity:
      type: object
      required:
        - api_id
        - binding_id
        - version_id
      properties:
        api_id:
          type: string
        binding_id:
          oneOf:
            - type: string
            - type: 'null'
        version_id:
          oneOf:
            - type: string
            - type: 'null'
      additionalProperties: false
  responses:
    Unauthorized:
      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
            properties:
              error:
                type: string
            additionalProperties: true
    NotFound:
      description: Requested API or endpoint was not found.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
    SessionCookieAuth:
      type: apiKey
      in: cookie
      name: better-auth.session_token

````