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

# Create Mcp Server Instance

> Create a new MCP server instance.

Returns 201 for url (synchronous verification completed).
Returns 202 for docker/command (background verification in progress).



## OpenAPI

````yaml /api-reference/openapi.json post /v1/mcp-server-instances/
openapi: 3.1.0
info:
  description: >-
    Modular and extensible framework for building AI agents. This API requires
    JWT Bearer token authentication for most endpoints. Include your JWT token
    in the Authorization header. Public endpoints include /, /health, /docs,
    /redoc, and /openapi.json.
  title: AgentArea API
  version: 0.1.0
servers: []
security:
  - bearer: []
paths:
  /v1/mcp-server-instances/:
    post:
      tags:
        - v1
        - protected
        - mcp-server-instances
      summary: Create Mcp Server Instance
      description: |-
        Create a new MCP server instance.

        Returns 201 for url (synchronous verification completed).
        Returns 202 for docker/command (background verification in progress).
      operationId: create_mcp_server_instance_v1_mcp_server_instances__post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPServerInstanceCreate'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MCPServerInstanceResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    MCPServerInstanceCreate:
      additionalProperties: false
      description: |-
        Payload for creating an MCP server instance.

        ``json_spec`` carries the connection configuration. Common shapes:

        - ``{"type": "url", "endpoint_url": "https://..."}``
        - ``{"type": "docker", "environment": {...}, "env_vars": [...]}``
        - ``{"type": "command", "command": [...], "environment": {...}}``
        For URL-type instances the service synchronously verifies the endpoint;
        docker/command kick off background verification.
      properties:
        auth_config_id:
          anyOf:
            - type: string
            - type: 'null'
          description: ID of an MCP auth config (OAuth/credentials) to attach.
          title: Auth Config Id
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional human-readable description of the instance.
          title: Description
        json_spec:
          additionalProperties: true
          description: >-
            Connection configuration. Must include 'type' ('url' | 'docker' |
            'command'); other keys depend on type.
          title: Json Spec
          type: object
        name:
          description: Display name for this MCP server instance (unique per workspace).
          maxLength: 255
          minLength: 1
          title: Name
          type: string
        server_spec_id:
          description: >-
            ID of an existing MCP server spec to derive defaults from
            (env_schema, secret routing, etc.).
          title: Server Spec Id
          type: string
      required:
        - name
        - server_spec_id
        - json_spec
      title: MCPServerInstanceCreate
      type: object
    MCPServerInstanceResponse:
      properties:
        auth_config_id:
          anyOf:
            - format: uuid
              type: string
            - type: string
            - type: 'null'
          title: Auth Config Id
        created_at:
          title: Created At
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        id:
          format: uuid
          title: Id
          type: string
        json_spec:
          additionalProperties: true
          title: Json Spec
          type: object
        last_dispatch:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Last Dispatch
        name:
          title: Name
          type: string
        server_spec_id:
          title: Server Spec Id
          type: string
        tools:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tools
        updated_at:
          title: Updated At
          type: string
        verification:
          additionalProperties: true
          title: Verification
          type: object
      required:
        - id
        - name
        - description
        - server_spec_id
        - json_spec
        - verification
        - created_at
        - updated_at
      title: MCPServerInstanceResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      description: JWT Bearer token for authentication
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````