API · 2.0.0

MCP

External MCP integrations bound to Spaces.

4 operations. All requests need Authorization: Bearer sk_.... Responses use the standard envelope; see overview for shapes and error codes.

get/mcp/servers

List MCP integrations registered in the org

Responses

  • 200MCP servers.
  • 400Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.
  • 401Missing or invalid auth. `error.code = AUTH_ERROR`.
  • 403Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.
  • 404Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.
  • 409Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.
  • 429Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.
  • 500Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X GET https://switchy.build/api/mcp/servers \
  -H 'Authorization: Bearer sk_live_...' \
post/mcp/servers

Register a custom MCP server

HTTPS-only. Endpoint is checked against the SSRF guard at registration AND on every call.

Request body

FieldTypeRequiredDescription
displayNamestringyes
mentionSlugstringyesLowercase, alphanumeric + dashes/underscores. Unique per org.
endpointUrlstring (uri)yesMust be HTTPS.
authType"NONE" | "BEARER" | "API_KEY"yes
secretstringnoBearer token, or `HeaderName:value` for API_KEY.

Responses

  • 201Created server.
  • 400Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.
  • 401Missing or invalid auth. `error.code = AUTH_ERROR`.
  • 403Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.
  • 404Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.
  • 409Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.
  • 429Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.
  • 500Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X POST https://switchy.build/api/mcp/servers \
  -H 'Authorization: Bearer sk_live_...' \
  -H 'Content-Type: application/json' \
  -d '{ ... }'
delete/mcp/servers/{id}

Remove an MCP integration

Parameters

NameInRequiredTypeDescription
idpathyesstringCUID

Responses

  • 204Removed; secret deleted from Secret Manager.
  • 400Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.
  • 401Missing or invalid auth. `error.code = AUTH_ERROR`.
  • 403Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.
  • 404Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.
  • 409Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.
  • 429Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.
  • 500Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X DELETE https://switchy.build/api/mcp/servers/:id \
  -H 'Authorization: Bearer sk_live_...' \
post/mcp/servers/{id}/test-connection

Test an MCP server

Calls `initialize` on the upstream and reports the result. Used by the UI test button.

Parameters

NameInRequiredTypeDescription
idpathyesstringCUID

Responses

  • 200Result.
  • 400Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.
  • 401Missing or invalid auth. `error.code = AUTH_ERROR`.
  • 403Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.
  • 404Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.
  • 409Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.
  • 429Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.
  • 500Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X POST https://switchy.build/api/mcp/servers/:id/test-connection \
  -H 'Authorization: Bearer sk_live_...' \