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

> Creates a new MCP (Model Context Protocol) server configuration for the application. Use this endpoint to register an MCP server that agents can connect to.  **Uniqueness:** The slug must be unique pe

# Create MCP Server

For the complete error reference, see [Error Guide](/rest-api/ai-agents-apis/error-codes).


## OpenAPI

````yaml post /ai-agents/agent-builder/mcp-servers
openapi: 3.0.0
info:
  title: AI Agents APIs
  description: API reference for CometChat AI Agents service
  version: '1.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: ai-agent
    description: ''
paths:
  /ai-agents/agent-builder/mcp-servers:
    post:
      tags:
        - Agent Builder MCP Servers
      summary: Create MCP Server
      description: >-
        Creates a new MCP (Model Context Protocol) server configuration for the
        application. Use this endpoint to register an MCP server that agents can
        connect to.


        **Uniqueness:** The slug must be unique per application.
      operationId: McpServersController_createMcpServer
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMcpServerDto'
      responses:
        '201':
          description: MCP server created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
                    example: myapp_my-mcp-server
                  appId:
                    type: string
                    example: my-app-id
                  slug:
                    type: string
                    example: my-mcp-server
                  name:
                    type: string
                    example: My MCP Server
                  description:
                    type: string
                    example: A Model Context Protocol server
                  url:
                    type: string
                    example: https://mcp.example.com/sse
                  icon:
                    type: string
                    example: https://example.com/icon.png
                  createdAt:
                    type: number
                    example: 1700000000000
                  updatedAt:
                    type: number
                    example: 1700000000000
              example:
                _id: myapp_my-mcp-server
                appId: my-app-id
                slug: my-mcp-server
                name: My MCP Server
                description: A Model Context Protocol server
                url: https://mcp.example.com/sse
                icon: https://example.com/icon.png
                createdAt: 1700000000000
                updatedAt: 1700000000000
      security:
        - apiKey: []
components:
  schemas:
    CreateMcpServerDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the MCP server (human readable)
          example: Weather Server
        slug:
          type: string
          description: Slug of the MCP server (unique, URL-safe)
          example: weather-server
        description:
          type: string
          description: Description of the MCP server
          example: Provides weather data for cities
        url:
          type: string
          description: URL of the MCP server
          example: http://localhost:3001
        icon:
          type: string
          description: Icon for the MCP server
          example: http://localhost:3001/icon.png
      required:
        - name
        - slug
        - url
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key (i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````