Barndoor Servers API

Manage MCP server instances

OpenAPI Specification

barndoor-servers-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Barndoor Platform Agents Servers API
  version: 1.0.0
  description: 'REST API for the Barndoor Platform - manage MCP servers, OAuth connections, and proxy MCP requests.


    ## Authentication


    All endpoints require a JWT Bearer token obtained through Auth0 OAuth 2.0 flow with PKCE.

    The SDK handles the OAuth flow automatically using interactive login.


    ## MCP Integration


    The `/mcp/{mcp_server_name}` endpoints provide streaming proxy access to third-party MCP servers

    (Salesforce, Notion, Slack, etc.) with automatic authentication and session management.

    '
  contact:
    name: Barndoor Support
    url: https://barndoor.ai
servers:
- url: https://{organization_id}.platform.barndoor.ai
  description: Trial (Production)
  variables:
    organization_id:
      description: Your organization identifier
      default: your-org
- url: https://{organization_id}.mcp.barndoor.ai
  description: Enterprise (Production)
  variables:
    organization_id:
      description: Your organization identifier
      default: your-org
- url: https://{organization_id}.platform.barndooruat.com
  description: Enterprise (Production)
  variables:
    organization_id:
      description: Your organization identifier
      default: your-org
- url: https://{organization_id}.platform.barndoordev.com
  description: Enterprise (Production)
  variables:
    organization_id:
      description: Your organization identifier
      default: your-org
security:
- BearerAuth: []
tags:
- name: Servers
  description: Manage MCP server instances
paths:
  /api/servers:
    post:
      tags:
      - Servers
      summary: Create MCP Server
      description: 'Create a new MCP server instance from a server directory template.


        The server will be created in `pending` status until OAuth credentials are configured.

        If `client_id` and `client_secret` are provided, the server will be set to `active` status.

        '
      operationId: createServer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServerCreateRequest'
      responses:
        '200':
          description: Server created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerCreateResponse'
        '401':
          description: Unauthorized - invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Server directory template not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Servers
      summary: List MCP Servers
      description: 'List all MCP servers available to the caller''s organization.

        Returns paginated results with server details including connection status.

        '
      operationId: listServers
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          default: 1
        description: Page number (1-based)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 10
        description: Number of items per page (max 100)
      - name: search
        in: query
        required: false
        schema:
          type: string
        description: Search servers by name or slug
      - name: status
        in: query
        required: false
        schema:
          type: string
          enum:
          - pending
          - active
          - error
        description: Filter by server status
      - name: connection_status
        in: query
        required: false
        schema:
          type: string
          enum:
          - available
          - pending
          - connected
          - error
          - not_connected
        description: Filter by connection status. `not_connected` expands to pending, error, and available.
      responses:
        '200':
          description: Paginated list of MCP servers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginationResponse_ServerResponse_'
        '401':
          description: Unauthorized - invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/servers/{server_id}:
    delete:
      tags:
      - Servers
      summary: Delete MCP Server
      description: 'Delete an MCP server and all associated connections.


        This will:

        - Remove all user connections to this server

        - Clean up stored OAuth credentials

        - Delete the server configuration


        For custom server types, this will also delete the associated server directory.

        '
      operationId: deleteServer
      parameters:
      - name: server_id
        in: path
        required: true
        description: Server UUID
        schema:
          type: string
          format: uuid
      responses:
        '204':
          description: Server deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerDetail'
        '401':
          description: Unauthorized - invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Server not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      tags:
      - Servers
      summary: Get Server Details
      description: 'Get detailed information about a specific MCP server.

        Returns extended information including MCP URL if available.

        '
      operationId: getServer
      parameters:
      - name: server_id
        in: path
        required: true
        description: Server UUID
        schema:
          type: string
          format: uuid
        example: 123e4567-e89b-12d3-a456-426614174000
      responses:
        '200':
          description: Server details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerDetail'
        '401':
          description: Unauthorized - invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Server not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      tags:
      - Servers
      summary: Update MCP Server
      description: 'Update an existing MCP server''s configuration.


        You can update the name, slug, OAuth credentials, and metadata.

        If updating OAuth credentials, provide the actual values (not obfuscated).

        '
      operationId: updateServer
      parameters:
      - name: server_id
        in: path
        required: true
        description: Server UUID
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServerUpdateRequest'
      responses:
        '200':
          description: Server updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerDetail'
        '401':
          description: Unauthorized - invalid or missing JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Server not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict - slug already in use
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ServerCreateRequest:
      type: object
      required:
      - name
      - mcp_server_directory_id
      properties:
        name:
          type: string
          description: Human-readable name for the server
          example: My Salesforce Instance
        mcp_server_directory_id:
          type: string
          format: uuid
          description: ID of the server directory template to create from
        slug:
          type: string
          description: Optional URL-friendly identifier (auto-generated if not provided)
          pattern: ^[a-z0-9-]+$
        client_id:
          type: string
          description: OAuth client ID (for OAuth-enabled servers)
        client_secret:
          type: string
          description: OAuth client secret (for OAuth-enabled servers)
        meta:
          type: object
          description: Additional metadata for the server
          additionalProperties: true
    ServerCreateResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID of the newly created server
        connection_id:
          type: string
          nullable: true
          description: Connection ID if a connection was created
        auth_url:
          type: string
          nullable: true
          description: OAuth authorization URL if authentication is required
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ServerDetail:
      allOf:
      - $ref: '#/components/schemas/ServerSummary'
      - type: object
        properties:
          url:
            type: string
            format: uri
            nullable: true
            description: MCP base URL from the server directory
            example: https://api.salesforce.com/mcp
    ServerSummary:
      type: object
      required:
      - id
      - name
      - slug
      - connection_status
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the server
          example: 123e4567-e89b-12d3-a456-426614174000
        name:
          type: string
          description: Human-readable name of the server
          example: Salesforce Production
        slug:
          type: string
          description: URL-friendly identifier used in API paths
          pattern: ^[a-z0-9-]+$
          example: salesforce
        provider:
          type: string
          nullable: true
          description: Third-party provider name
          example: salesforce
        connection_status:
          type: string
          enum:
          - available
          - pending
          - connected
          - error
          description: 'Current connection status:

            - `available`: Server is available but not connected

            - `pending`: Connection is in progress or credentials missing

            - `connected`: Server is connected and ready to use

            - `error`: Connection failed or encountered an error

            '
          example: connected
    ServerUpdateRequest:
      type: object
      properties:
        name:
          type: string
          description: Human-readable name for the server
          example: My Salesforce Instance
        slug:
          type: string
          description: URL-friendly identifier
          pattern: ^[a-z0-9-]+$
        client_id:
          type: string
          description: OAuth client ID (provide actual value, not obfuscated)
        client_secret:
          type: string
          description: OAuth client secret (provide actual value, not obfuscated)
        meta:
          type: object
          description: Additional metadata for the server
          additionalProperties: true
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    Error:
      type: object
      required:
      - error
      - message
      properties:
        error:
          type: string
          description: Error type identifier
          example: ServerNotFound
        message:
          type: string
          description: Human-readable error message
          example: Server with ID '123' not found
        details:
          type: object
          description: Additional error details
          additionalProperties: true
    PaginationResponse_ServerResponse_:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ServerDetail'
          description: Array of servers for current page
        pagination:
          $ref: '#/components/schemas/PaginationMeta'
          description: Pagination metadata
      required:
      - data
      - pagination
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
          description: Current page number
        limit:
          type: integer
          title: Limit
          description: Items per page
        total:
          type: integer
          title: Total
          description: Total number of items
        pages:
          type: integer
          title: Pages
          description: Total number of pages
        previous_page:
          anyOf:
          - type: integer
          - type: 'null'
          title: Previous Page
          description: Previous page number (null if first page)
        next_page:
          anyOf:
          - type: integer
          - type: 'null'
          title: Next Page
          description: Next page number (null if last page)
      type: object
      required:
      - page
      - limit
      - total
      - pages
      - previous_page
      - next_page
      title: PaginationMeta
      description: Pagination metadata.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'JWT token obtained through Auth0 OAuth 2.0 flow with PKCE.


        The token should be included in the Authorization header:

        `Authorization: Bearer <your-jwt-token>`


        Use the Barndoor SDK''s `loginInteractive()` function to obtain tokens automatically.

        '
    HTTPBearer:
      type: http
      scheme: bearer