---
title: "Update environment MCP"
method: PATCH
path: "/v1/environments/{environment_id}/mcps/{id}"
tags: ["Environment MCPs"]
---

# Update environment MCP

`PATCH /v1/environments/{environment_id}/mcps/{id}`

## Request

- Base URL: `https://api.replicas.dev`
- URL: `https://api.replicas.dev/v1/environments/{environment_id}/mcps/{id}`
- Auth: HTTP bearer

Updates only the fields you send. Changing `transport` requires a matching `config`.

## Path parameters

- `environment_id` string, required
- `id` string, uuid, required

## Headers

- `X-Replicas-Api-Version` '2026-10-07'

## Request body

- UpdateEnvironmentMcpRequest: Request body for updating an MCP. Only provided fields are changed. When `transport` is changed, `config` is required and must match the new transport's shape.
  - `name` string
  - `transport` 'stdio' | 'http' | 'sse'
  - `config` union: MCP transport-specific configuration. Discriminate by the parent `transport` field.
    - EnvironmentMcpStdioConfig: Configuration for an MCP that runs a local subprocess (`transport: stdio`).
      - `command` string, required: Executable to run (e.g. `npx`)
      - `args` string[], required: Arguments passed to the command
      - `env` object, required: Environment variables for the subprocess
    - EnvironmentMcpHttpConfig: Configuration for an MCP reached over HTTP or SSE (`transport: http` or `transport: sse`).
      - `auth` union: Authenticate using a short-lived workspace identity token minted for the given audience, or an OAuth account connected in the app.
        - object
          - `type` 'workspace_identity', required
          - `audience` string, required: Audience (`aud`) the MCP server verifies, usually its URL.
        - object
          - `type` 'oauth', required
      - `url` string, uri, required: MCP server URL
      - `headers` object, required: Headers attached to every request (e.g. `Authorization`)

## Response `200`

MCP updated

- EnvironmentMcpResponse
  - `environment_mcp` EnvironmentMcp, required: An MCP (Model Context Protocol) server attached to an environment.
    - `id` string, uuid, required
    - `organization_id` string, uuid, required
    - `environment_id` string, uuid, required
    - `name` string, required: MCP name (1–64 chars, must match `^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$`; cannot start with reserved prefixes `relay-`, `replicas-`, or `subagents`)
    - `transport` 'stdio' | 'http' | 'sse', required
    - `config` union, required: MCP transport-specific configuration. Discriminate by the parent `transport` field.
      - EnvironmentMcpStdioConfig: Configuration for an MCP that runs a local subprocess (`transport: stdio`).
        - `command` string, required: Executable to run (e.g. `npx`)
        - `args` string[], required: Arguments passed to the command
        - `env` object, required: Environment variables for the subprocess
      - EnvironmentMcpHttpConfig: Configuration for an MCP reached over HTTP or SSE (`transport: http` or `transport: sse`).
        - `auth` union: Authenticate using a short-lived workspace identity token minted for the given audience, or an OAuth account connected in the app.
          - object
            - `type` 'workspace_identity', required
            - `audience` string, required: Audience (`aud`) the MCP server verifies, usually its URL.
          - object
            - `type` 'oauth', required
        - `url` string, uri, required: MCP server URL
        - `headers` object, required: Headers attached to every request (e.g. `Authorization`)
    - `oauth` object: Connection state for MCPs using OAuth. Returned when listing MCPs.
      - `status` 'disconnected' | 'connected' | 'reconnect_required', required
      - `reason` string, nullable, required: Why a reconnect is required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `400`: Bad request - Missing or invalid parameters
- `401`: Unauthorized - Invalid or missing API key
- `404`: Resource not found
- `409`: Conflict - Resource already exists or operation conflicts with current state
- `500`: Internal server error

---

[API](https://skmtc.dev/replicas/apis/replicas-api.md) - [All operations](https://skmtc.dev/replicas/apis/replicas-api/llms.txt) - [OpenAPI document](https://skmtc.dev/replicas/apis/replicas-api/revisions/2703ac1c9cb7?raw)
