---
title: "Create Environment MCP"
method: POST
path: "/v1/environments/{environmentId}/mcps"
tags: ["Environments"]
---

# Create Environment MCP

`POST /v1/environments/{environmentId}/mcps`

Adds a new MCP server to the environment. `name` must match `^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$` and cannot start with reserved prefix `replicas-`. The `config` shape depends on the `transport`: stdio uses `{ command, args, env }`; http and sse use `{ url, headers }`.

## Path parameters

- `environmentId` string, required

## Request body

- CreateEnvironmentMcpRequest — Request body for creating an MCP. The `config` shape must match the chosen `transport`.
  - `name` string, required — 1–64 chars, `^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$`; reserved prefix `replicas-` is rejected.
  - `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`).
      - `url` string, uri, required — MCP server URL
      - `headers` object, required — Headers attached to every request (e.g. `Authorization`)

## Response `201`

MCP created

- 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 prefix `replicas-`)
    - `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`).
        - `url` string, uri, required — MCP server URL
        - `headers` object, required — Headers attached to every request (e.g. `Authorization`)
    - `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
- `409` — Conflict - Resource already exists or operation conflicts with current state
- `500` — Internal server error

---

[API](https://skmtc.net/tryreplicas/apis/replica-api.md) · [All operations](https://skmtc.net/tryreplicas/apis/replica-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tryreplicas/replica-api/versions/aa3b4c932f7a/schema)
