> ## 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 Create From Api

> Create a new MCP server from an existing API specification.

This endpoint locates the API by name, fetches its details, and creates a valid
MCP server of APIGENE type with the API's information. The MCP server name is
automatically set to the API title, enabled is set to true, and global_spec
is derived from the API data.

Args:
    request: The request containing only the API name
    current_user: The current authenticated user
    tenant: The tenant database

Returns:
    dict: The created MCP server information

Raises:
    HTTPException(404): If the API specification is not found
    HTTPException(409): If an MCP server with the same name already exists
    HTTPException(500): If an error occurs during creation



## OpenAPI

````yaml post /api/mcp-server/create_from_api
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_from_api:
    post:
      tags:
        - MCP Server
        - MCP Server
      summary: Mcp Create From Api
      description: >-
        Create a new MCP server from an existing API specification.


        This endpoint locates the API by name, fetches its details, and creates
        a valid

        MCP server of APIGENE type with the API's information. The MCP server
        name is

        automatically set to the API title, enabled is set to true, and
        global_spec

        is derived from the API data.


        Args:
            request: The request containing only the API name
            current_user: The current authenticated user
            tenant: The tenant database

        Returns:
            dict: The created MCP server information

        Raises:
            HTTPException(404): If the API specification is not found
            HTTPException(409): If an MCP server with the same name already exists
            HTTPException(500): If an error occurs during creation
      operationId: mcp_create_from_api
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MCPCreateFromApiRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    MCPCreateFromApiRequest:
      properties:
        api_name:
          type: string
          title: Api Name
          description: The name of the API to create MCP server from
      type: object
      required:
        - api_name
      title: MCPCreateFromApiRequest
      description: Request model for creating an MCP server from an API name.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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}'

````