---
title: "Create or update connection"
method: PUT
path: "/connect/{namespace}/{connectionId}"
tags: ["connect"]
---

# Create or update connection

`PUT /connect/{namespace}/{connectionId}`

Create or update an MCP connection with the given ID. If the connection exists and mcpUrl matches, updates name/metadata/headers. Returns 409 if mcpUrl differs - delete and recreate to change URL. Requires API key and namespace ownership.

## Path parameters

- `namespace` string, required
- `connectionId` string, required

## Request body

- CreateConnectionRequest
  - `mcpUrl` string, uri, required — URL of the MCP server
  - `name` string — Human-readable name (optional, defaults to connection ID)
  - `metadata` object — Custom metadata for filtering connections
  - `headers` object — Custom headers to send with MCP requests (stored securely, not returned in responses)

## Response `200`

Connection updated

- Connection
  - `connectionId` string, required — Connection ID (auto-generated or developer-defined)
  - `name` string, required — Human-readable name
  - `mcpUrl` string, required — MCP server URL
  - `metadata` object, nullable, required
  - `iconUrl` string, nullable
  - `createdAt` string — ISO 8601 timestamp
  - `status` union
    - object
      - `state` 'connected', required
    - object
      - `state` 'auth_required', required
      - `authorizationUrl` string, uri — URL to redirect user for OAuth authorization
    - object
      - `state` 'error', required
      - `message` string, required — Error message
  - `serverInfo` ServerInfo
    - `name` string, required
    - `title` string
    - `icons` object[]
      - `src` string, required
      - `mimeType` string
      - `sizes` string[]
      - `theme` 'light' | 'dark'
    - `version` string, required
    - `websiteUrl` string
    - `description` string

## Other responses

- `201` — Connection created
- `400` — Validation error
- `404` — Namespace not found or access denied
- `409` — URL mismatch - cannot change mcpUrl

## Changes

- **2026-02-04** `0ea2d8e23fa1` — 1 info
  - added the success response with the status `200`

[Change history](https://skmtc.dev/smithery-ai/apis/smithery-platform-api/changes/connect/:namespace/:connectionId/put.md)

---

[API](https://skmtc.dev/smithery-ai/apis/smithery-platform-api.md) · [All operations](https://skmtc.dev/smithery-ai/apis/smithery-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/smithery-ai/apis/smithery-platform-api/revisions/9d53933ba12e?raw)
