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

# Update MCP Server

This API allows you to update an existing MCP server with new configurations, suggestions, chains, and associated applications.

## Request description

<Note>
  This API supports two authentication methods. You can use either Session Token authentication OR the combination of API key and linked account ID.
</Note>

#### Authentication Option 1: Session Token

<ParamField header="Authorization" type="string" required>
  Bearer token using your session token for authentication

  **Format**: `Bearer YOUR_SESSION_TOKEN`
</ParamField>

#### Authentication Option 2: API Key + Linked Account

<ParamField header="x-api-key" type="string" required>
  Your Refold API key
</ParamField>

<ParamField header="linked_account_id" type="string" required>
  The unique identifier for the linked account
</ParamField>

#### Path Parameters

<ParamField path="mcp_server_id" type="string" required>
  Unique identifier for the MCP server to update
</ParamField>

#### Body Parameters

<ParamField body="name" type="string">
  Name of the MCP server
</ParamField>

<ParamField body="description" type="string">
  Description of the MCP server
</ParamField>

<ParamField body="suggestions" type="array">
  Array of suggestion objects for the MCP server

  <Expandable title="Suggestion Object">
    <ResponseField name="name" type="string">
      Name of the suggestion
    </ResponseField>

    <ResponseField name="prompt" type="string">
      Prompt text for the suggestion
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="chains" type="array">
  Array of chain objects to configure for the MCP server

  <Expandable title="Chain Object">
    <ResponseField name="name" type="string">
      Name of the chain
    </ResponseField>

    <ResponseField name="goals" type="string">
      Goals for the chain execution
    </ResponseField>

    <ResponseField name="steps" type="string">
      Steps to execute in the chain (newline separated)
    </ResponseField>

    <ResponseField name="precheck" type="string">
      Pre-execution checks
    </ResponseField>

    <ResponseField name="successCondition" type="string">
      Success condition for the chain
    </ResponseField>

    <ResponseField name="responseFormat" type="string">
      Response format configuration
    </ResponseField>

    <ResponseField name="onError" type="string">
      Error handling configuration
    </ResponseField>
  </Expandable>
</ParamField>

<ParamField body="associated_apps" type="array">
  Array of applications to associate with the MCP server

  <Expandable title="Associated App Object">
    <ResponseField name="slug" type="string">
      Application identifier slug
    </ResponseField>

    <ResponseField name="workflows" type="array">
      Array of workflow objects

      <Expandable title="Workflow Object">
        <ResponseField name="id" type="string">
          Workflow identifier
        </ResponseField>

        <ResponseField name="name" type="string">
          Workflow name
        </ResponseField>

        <ResponseField name="description" type="string">
          Workflow description
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="actions" type="array">
      Array of action objects

      <Expandable title="Action Object">
        <ResponseField name="id" type="string">
          Action identifier
        </ResponseField>

        <ResponseField name="name" type="string">
          Action name
        </ResponseField>

        <ResponseField name="description" type="string">
          Action description
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ParamField>

## Response description

<Tabs>
  <Tab title="200">
    <ResponseField name="_id" type="string">
      Unique identifier for the MCP server
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the MCP server
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of the MCP server
    </ResponseField>

    <ResponseField name="associated_org_id" type="string">
      Organization ID associated with the MCP server
    </ResponseField>

    <ResponseField name="environment" type="string">
      Environment (test/production) where the MCP server is running
    </ResponseField>

    <ResponseField name="suggestions" type="array">
      Array of suggestion objects for the MCP server
    </ResponseField>

    <ResponseField name="associated_apps" type="array">
      Array of applications associated with the MCP server
    </ResponseField>

    <ResponseField name="chains" type="array">
      Array of chain objects configured for the MCP server
    </ResponseField>

    <ResponseField name="resources" type="array">
      Array of resources associated with the MCP server
    </ResponseField>

    <ResponseField name="createdAt" type="date">
      Creation timestamp
    </ResponseField>

    <ResponseField name="updatedAt" type="date">
      Last update timestamp
    </ResponseField>

    <ResponseField name="__v" type="integer">
      Version key
    </ResponseField>
  </Tab>

  <Tab title="Error">
    <ResponseField name="status_code" type="integer">
      System generated status code
    </ResponseField>

    <ResponseField name="http_error_type" type="string">
      System generated error type
    </ResponseField>

    <ResponseField name="error_code" type="string">
      Specific error code to identify the error
    </ResponseField>

    <ResponseField name="message" type="string">
      Error message
    </ResponseField>

    <ResponseField name="request_id" type="string">
      System generated request id
    </ResponseField>
  </Tab>
</Tabs>

<ResponseExample>
  ```JSON 200 theme={null}
  {
      "_id": "686e2393750d509493c6d87c",
      "name": "New Updated Name for MCP",
      "description": "Updated Suggestion",
      "associated_org_id": "6698b77a733c5ebd8908189e",
      "environment": "test",
      "suggestions": [
          {
              "name": "Hello",
              "prompt": "Prompt Test1"
          }
      ],
      "associated_apps": [
          {
              "slug": "pipedrive",
              "workflows": [
                  {
                      "id": "67fbc1e4954bde0dcae1d51c",
                      "name": "SETUP WRITEBACK",
                      "description": "Setup Writeback on Application"
                  }
              ],
              "actions": [
                  {
                      "id": "delete_lead",
                      "name": "Delete Lead",
                      "description": "To delete a lead"
                  }
              ]
          }
      ],
      "resources": [],
      "createdAt": "2025-07-09T08:08:51.177Z",
      "updatedAt": "2025-07-09T08:37:19.407Z",
      "__v": 0,
      "chains": [
          {
              "name": "STep 1 ",
              "goals": "This shoud. be Goal",
              "steps": "Step 1 \nStep 2 \nStep 3",
              "precheck": "",
              "successCondition": "",
              "responseFormat": "",
              "onError": "",
              "_id": "686e2a3f7e7cb9099d06ca40"
          }
      ]
  }
  ```

  ```JSON 400 theme={null}
  {
      "status_code": 400,
      "http_error_type": "BAD_REQUEST",
      "error_code": "VALIDATION_ERROR",
      "message": "Invalid request body",
      "request_id": "89bd1675-a826-46cb-9210-6cb2ae169f67"
  }
  ```

  ```JSON 401 theme={null}
  {
      "status_code": 401,
      "http_error_type": "UNAUTHORIZED",
      "error_code": "SERVER_ERROR",
      "message": "Invalid Credentials",
      "request_id": "89bd1675-a826-46cb-9210-6cb2ae169f67"
  }
  ```

  ```JSON 404 theme={null}
  {
      "status_code": 404,
      "http_error_type": "NOT_FOUND",
      "error_code": "SERVER_ERROR",
      "message": "MCP Server not found",
      "request_id": "89bd1675-a826-46cb-9210-6cb2ae169f67"
  }
  ```
</ResponseExample>

<RequestExample>
  ```bash Session Token Authentication theme={null}
  curl -X PUT "https://api.gocobalt.io/api/v2/public/mcp-servers/686e2393750d509493c6d87c" \
    -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Enterprise MCP Server",
      "description": "Updated MCP server configuration for enterprise customers",
      "suggestions": [
          {
              "name": "Customer Onboarding",
              "prompt": "Create a new customer account with complete profile setup"
          }
      ],
      "chains": [
          {
              "name": "Lead Processing Chain",
              "goals": "Qualify and process incoming leads through CRM workflow",
              "steps": "Step 1: Validate lead data\nStep 2: Create contact in CRM\nStep 3: Assign to sales representative",
              "precheck": "Verify required fields are present",
              "successCondition": "Lead successfully created and assigned",
              "responseFormat": "JSON with contact ID and assignment details",
              "onError": "Log error and retry with manual intervention"
          }
      ],
      "associated_apps": [
          {
              "slug": "hubspot",
              "workflows": [
                  {
                      "id": "67fbc1e4954bde0dcae1d51c",
                      "name": "Contact Sync Workflow",
                      "description": "Synchronize contacts between systems"
                  }
              ],
              "actions": [
                  {
                      "id": "create_contact",
                      "name": "Create Contact",
                      "description": "Create a new contact in HubSpot"
                  }
              ]
          }
      ]
    }'
  ```

  ```bash API Key Authentication theme={null}
  curl -X PUT "https://api.gocobalt.io/api/v2/public/mcp-servers/686e2393750d509493c6d87c" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "linked_account_id: customer@example.com" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Enterprise MCP Server",
      "description": "Updated MCP server configuration for enterprise customers",
      "suggestions": [
          {
              "name": "Customer Onboarding",
              "prompt": "Create a new customer account with complete profile setup"
          }
      ],
      "chains": [
          {
              "name": "Lead Processing Chain",
              "goals": "Qualify and process incoming leads through CRM workflow",
              "steps": "Step 1: Validate lead data\nStep 2: Create contact in CRM\nStep 3: Assign to sales representative",
              "precheck": "Verify required fields are present",
              "successCondition": "Lead successfully created and assigned",
              "responseFormat": "JSON with contact ID and assignment details",
              "onError": "Log error and retry with manual intervention"
          }
      ],
      "associated_apps": [
          {
              "slug": "hubspot",
              "workflows": [
                  {
                      "id": "67fbc1e4954bde0dcae1d51c",
                      "name": "Contact Sync Workflow",
                      "description": "Synchronize contacts between systems"
                  }
              ],
              "actions": [
                  {
                      "id": "create_contact",
                      "name": "Create Contact",
                      "description": "Create a new contact in HubSpot"
                  }
              ]
          }
      ]
    }'
  ```
</RequestExample>
