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

# Update an MCP connection

> Update MCP configuration, including OAuth, Client Credentials (M2M), or static-header authentication. Supplied headers merge by key only for unchanged-server static_headers authentication; otherwise they are replaced. Environment values merge by key, null values remove individual keys, and a null environment clears all variables. Hidden credentials are preserved unless explicitly changed or authentication is replaced; changing a remote server URL clears credentials for the old server. Call authorize explicitly after changing the server or authentication to reconnect.



## OpenAPI

````yaml https://api.tembo.io/public-api/openapi/public patch /v1/mcp-connections/{mcpConnectionId}
openapi: 3.1.0
info:
  title: Tembo Public API
  description: >-
    Manage agents, sessions, repositories, and organization resources with the
    Tembo API.
  version: 1.0.0
servers:
  - url: https://api.tembo.io
    description: Tembo API
  - url: https://{deployment-origin}/api/public-api
    description: Self-hosted Tembo
    variables:
      deployment-origin:
        default: tembo.example.com
        description: Hostname of your self-hosted Tembo deployment
security: []
paths:
  /v1/mcp-connections/{mcpConnectionId}:
    patch:
      tags:
        - MCP Connections
      summary: Update an MCP connection
      description: >-
        Update MCP configuration, including OAuth, Client Credentials (M2M), or
        static-header authentication. Supplied headers merge by key only for
        unchanged-server static_headers authentication; otherwise they are
        replaced. Environment values merge by key, null values remove individual
        keys, and a null environment clears all variables. Hidden credentials
        are preserved unless explicitly changed or authentication is replaced;
        changing a remote server URL clears credentials for the old server. Call
        authorize explicitly after changing the server or authentication to
        reconnect.
      operationId: updateMcpConnection
      parameters:
        - in: path
          name: mcpConnectionId
          schema:
            type: string
            format: uuid
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                      description: Display name for the MCP connection.
                    serverUrl:
                      type: string
                      format: uri
                      description: >-
                        HTTP or HTTPS MCP server endpoint. Changing it requires
                        an explicit authType, clears old credentials, and
                        requires authorization to reconnect.
                    type:
                      type: string
                      const: remote
                      description: >-
                        Connection type must remain remote; transport type
                        cannot be changed by update.
                    authType:
                      type: string
                      enum:
                        - oauth
                        - client_credentials
                        - static_headers
                      description: >-
                        Authentication method: OAuth user authorization (oauth),
                        Client Credentials (M2M) using client_credentials, or
                        static request headers (static_headers).
                    clientId:
                      type: string
                      minLength: 1
                      maxLength: 4096
                      description: >-
                        OAuth client ID when replacing authentication. Requires
                        authType; required for client_credentials or
                        pre_registered OAuth.
                    clientSecret:
                      type: string
                      minLength: 1
                      maxLength: 65536
                      description: >-
                        Write-only client secret when replacing authentication.
                        Requires authType; required for client_credentials.
                    headers:
                      type:
                        - object
                        - 'null'
                      propertyNames:
                        type: string
                        minLength: 1
                        maxLength: 256
                      additionalProperties:
                        type:
                          - string
                          - 'null'
                        maxLength: 16384
                      description: >-
                        Requires authType. Merges by key only when keeping
                        static_headers authentication and the same server URL;
                        otherwise replaces stored headers. Null values remove
                        keys; static_headers requires at least one header.
                        Values are write-only.
                    oauthRegistration:
                      type: string
                      enum:
                        - automatic
                        - pre_registered
                      description: >-
                        Register an OAuth client automatically or use
                        pre-registered clientId and optional clientSecret.
                    scope:
                      type: string
                      minLength: 1
                      maxLength: 4096
                      description: >-
                        OAuth scopes when replacing authentication. Requires
                        authType.
                  required:
                    - type
                  additionalProperties: false
                - type: object
                  properties:
                    command:
                      type: string
                      minLength: 1
                      maxLength: 4096
                      description: >-
                        Replace the stored stdio server executable. This API
                        never executes it.
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                      description: Display name for the MCP connection.
                    type:
                      type: string
                      const: stdio
                      description: >-
                        Connection type must remain stdio; transport type cannot
                        be changed by update.
                    args:
                      type:
                        - array
                        - 'null'
                      items:
                        type: string
                        maxLength: 8192
                      maxItems: 100
                      description: >-
                        Command-line arguments for the stdio server. Stored
                        here, not executed by this API.
                    env:
                      type:
                        - object
                        - 'null'
                      propertyNames:
                        type: string
                        minLength: 1
                        maxLength: 256
                      additionalProperties:
                        type:
                          - string
                          - 'null'
                        maxLength: 16384
                      description: >-
                        Merge write-only environment variables by key. A null
                        value removes a key; null for the entire env field
                        clears all variables.
                  required:
                    - type
                  additionalProperties: false
      responses:
        '200':
          description: Update an MCP connection
          content:
            application/json:
              schema:
                type: object
                properties:
                  connectedAt:
                    type:
                      - string
                      - 'null'
                    format: date-time
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
                  serverUrl:
                    type:
                      - string
                      - 'null'
                  type:
                    type: string
                    enum:
                      - remote
                      - stdio
                  visibility:
                    type: string
                    enum:
                      - shared
                      - personal
                    description: >-
                      shared makes the connection available to the organization;
                      personal restricts it to its owner.
                  args:
                    type:
                      - array
                      - 'null'
                    items:
                      type: string
                      maxLength: 8192
                    maxItems: 100
                    description: >-
                      Command-line arguments for the stdio server. Stored here,
                      not executed by this API.
                  authType:
                    type:
                      - string
                      - 'null'
                    enum:
                      - oauth
                      - client_credentials
                      - static_headers
                      - null
                    description: >-
                      Authentication method: OAuth user authorization (oauth),
                      Client Credentials (M2M) using client_credentials, or
                      static request headers (static_headers).
                  command:
                    type:
                      - string
                      - 'null'
                  createdAt:
                    type: string
                    format: date-time
                  envKeys:
                    type: array
                    items:
                      type: string
                  headerKeys:
                    type: array
                    items:
                      type: string
                  updatedAt:
                    type: string
                    format: date-time
                required:
                  - connectedAt
                  - id
                  - name
                  - serverUrl
                  - type
                  - visibility
                  - args
                  - authType
                  - command
                  - createdAt
                  - envKeys
                  - headerKeys
                  - updatedAt
                additionalProperties: false
        '400':
          description: >-
            Invalid request or missing required organization or user
            information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '403':
          description: MCP connection management is not permitted
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '404':
          description: MCP connection not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '409':
          description: MCP connection conflict or unsupported action
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: MCP connection operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '502':
          description: The remote MCP server operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
      security:
        - apiKey: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >
            import Tembo from '@tembo-io/sdk';


            const client = new Tembo();


            const mcpConnection = await
            client.mcpConnections.update('7c9e6679-7425-40de-944b-e07fc1f90ae7',
            {
              type: 'remote',
            });
        - lang: rust
          label: Rust SDK
          source: |
            use tembo_rs::*;

            let client = Tembo::from_env()?;

            let response = client
                .mcp_connections()
                .update(
                    "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                    McpConnectionsUpdateBody::McpConnectionsUpdateBodyVariant1(McpConnectionsUpdateBodyVariant1::new("remote")),
                )
                .send()
                .await?;
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

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