> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add MCP server

> Dynamically add a new Model Context Protocol (MCP) server to the system.



## OpenAPI

````yaml /openapi.json post /mcp
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /mcp:
    post:
      summary: Add MCP server
      description: Dynamically add a new Model Context Protocol (MCP) server to the system.
      operationId: mcp.add
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                config:
                  anyOf:
                    - $ref: '#/components/schemas/McpLocalConfig'
                    - $ref: '#/components/schemas/McpRemoteConfig'
              required:
                - name
                - config
      responses:
        '200':
          description: MCP server added successfully
          content:
            application/json:
              schema:
                type: object
                propertyNames:
                  type: string
                additionalProperties:
                  $ref: '#/components/schemas/MCPStatus'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.mcp.add({
              ...
            })
components:
  schemas:
    McpLocalConfig:
      type: object
      properties:
        type:
          description: Type of MCP server connection
          type: string
          const: local
        command:
          description: Command and arguments to run the MCP server
          type: array
          items:
            type: string
        environment:
          description: Environment variables to set when running the MCP server
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
        cwd:
          description: Working directory for the MCP process
          type: string
        enabled:
          description: Enable or disable the MCP server on startup
          type: boolean
        timeout:
          description: >-
            Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds)
            if not specified.
          type: number
      required:
        - type
        - command
    McpRemoteConfig:
      type: object
      properties:
        type:
          description: Type of MCP server connection
          type: string
          const: remote
        url:
          description: URL of the remote MCP server
          type: string
        transport:
          description: Explicit transport; omitted tries HTTP then SSE
          type: string
          enum:
            - http
            - sse
        enabled:
          description: Enable or disable the MCP server on startup
          type: boolean
        headers:
          description: Headers to send with the request
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: string
        oauth:
          description: >-
            OAuth authentication configuration for the MCP server. Set to false
            to disable OAuth auto-detection.
          anyOf:
            - $ref: '#/components/schemas/McpOAuthConfig'
            - type: boolean
              const: false
        timeout:
          description: >-
            Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds)
            if not specified.
          type: number
      required:
        - type
        - url
    MCPStatus:
      anyOf:
        - $ref: '#/components/schemas/MCPStatusConnected'
        - $ref: '#/components/schemas/MCPStatusDisabled'
        - $ref: '#/components/schemas/MCPStatusFailed'
        - $ref: '#/components/schemas/MCPStatusNeedsAuth'
        - $ref: '#/components/schemas/MCPStatusNeedsClientRegistration'
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success
    McpOAuthConfig:
      type: object
      properties:
        clientId:
          description: >-
            OAuth client ID. If not provided, dynamic client registration (RFC
            7591) will be attempted.
          type: string
        clientSecret:
          description: OAuth client secret (if required by the authorization server)
          type: string
        scope:
          description: OAuth scopes to request during authorization
          type: string
        redirectUri:
          description: >-
            OAuth redirect URI (default:
            http://127.0.0.1:19876/mcp/oauth/callback).
          type: string
    MCPStatusConnected:
      type: object
      properties:
        status:
          type: string
          const: connected
      required:
        - status
    MCPStatusDisabled:
      type: object
      properties:
        status:
          type: string
          const: disabled
      required:
        - status
    MCPStatusFailed:
      type: object
      properties:
        status:
          type: string
          const: failed
        error:
          type: string
      required:
        - status
        - error
    MCPStatusNeedsAuth:
      type: object
      properties:
        status:
          type: string
          const: needs_auth
      required:
        - status
    MCPStatusNeedsClientRegistration:
      type: object
      properties:
        status:
          type: string
          const: needs_client_registration
        error:
          type: string
      required:
        - status
        - error

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.