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

# Mcp Server Create

> Create a new MCP server.

Args:
    mcp_server_data: The MCP server data to create
    current_user: The current authenticated user
    tenant: The tenant database

Returns:
    MCPServer: The created MCP server

Raises:
    HTTPException(400): If input validation fails
    HTTPException(403): If trying to create public server without APIGENE tier
    HTTPException(409): If MCP server with same name already exists
    HTTPException(500): If database operation fails or other error occurs



## OpenAPI

````yaml post /api/mcp-server/create
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/mcp-server/create:
    post:
      tags:
        - MCP Server
      summary: Mcp Server Create
      description: |-
        Create a new MCP server.

        Args:
            mcp_server_data: The MCP server data to create
            current_user: The current authenticated user
            tenant: The tenant database

        Returns:
            MCPServer: The created MCP server

        Raises:
            HTTPException(400): If input validation fails
            HTTPException(403): If trying to create public server without APIGENE tier
            HTTPException(409): If MCP server with same name already exists
            HTTPException(500): If database operation fails or other error occurs
      operationId: mcp_server_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPServerCreate'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MCPServer'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    MCPServerCreate:
      properties:
        name:
          type: string
          title: Name
          description: Name of the MCP server
        config:
          $ref: '#/components/schemas/MCPServerConfig'
          description: MCP server configuration
        enabled:
          type: boolean
          title: Enabled
          description: Whether the MCP server is enabled
          default: true
        server_type:
          $ref: '#/components/schemas/MCPServerType'
          description: Type of MCP server (apigene/public)
          default: apigene
        icon_url:
          type: string
          title: Icon Url
          description: icon URL of the MCP server for display
          default: apigene.ai
        api_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Api Name
          description: API name for APIGENE type servers
        global_spec:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Global Spec
          description: Whether this is a global spec for APIGENE type servers
      type: object
      required:
        - name
        - config
      title: MCPServerCreate
      description: Request model for creating an MCP server
    MCPServer:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the MCP server
        name:
          type: string
          title: Name
          description: Name of the MCP server
        config:
          $ref: '#/components/schemas/MCPServerConfig'
          description: MCP server configuration
        enabled:
          type: boolean
          title: Enabled
          description: Whether the MCP server is enabled
        server_type:
          $ref: '#/components/schemas/MCPServerType'
          description: Type of MCP server (public/private)
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the MCP server was created
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When the MCP server was last updated
        created_by:
          type: string
          format: email
          title: Created By
          description: Email of the user who created the MCP server
        icon_url:
          type: string
          title: Icon Url
          description: Icon URL of the MCP server for display
          default: apigene.ai
        api_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Api Name
          description: API name for APIGENE type servers
        global_spec:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Global Spec
          description: Whether this is a global spec for APIGENE type servers
      type: object
      required:
        - id
        - name
        - config
        - enabled
        - server_type
        - created_at
        - updated_at
        - created_by
      title: MCPServer
      description: Response model for MCP server
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MCPServerConfig:
      properties:
        url:
          type: string
          title: Url
          description: MCP server URL
        headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Headers
          description: Additional headers for MCP server requests
      type: object
      required:
        - url
      title: MCPServerConfig
      description: MCP Server configuration
    MCPServerType:
      type: string
      enum:
        - apigene
        - public
      title: MCPServerType
      description: MCP Server visibility types
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````