{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "description": "Defines a dev environment",
  "allowComments": true,
  "allowTrailingCommas": false,
  "definitions": {
    "common": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the environment."
        },
        "user": {
          "type": "string",
          "description": "The user to run the environment as."
        },
        "install": {
          "type": "string",
          "description": "The install script to run on VM startup (after pulling latest changes) to refresh dependencies."
        },
        "start": {
          "type": "string",
          "description": "The start command to run when the environment is started."
        },
        "repositoryDependencies": {
          "type": "array",
          "description": "Repositories that are required for the environment to work, and need to be included in the GitHub access token that is generated for the environment.",
          "items": {
            "type": "string",
            "description": "The URL of the dependent repository, e.g. `github.com/org/repo`."
          }
        },
        "disableAllMcpServers": {
          "type": "boolean",
          "description": "When true, block every user and team MCP server for agents using this environment. Cursor built-in MCP servers are never restricted. An empty mcpServerAllowlist alone does not disable MCP."
        },
        "mcpServerAllowlist": {
          "type": "array",
          "description": "MCP server identities allowed by this environment when disableAllMcpServers is false. Omit or leave empty (with disableAllMcpServers false/omitted) to inherit upstream team/user MCP policy.",
          "items": {
            "type": "object",
            "description": "Allow an HTTP MCP by serverUrl pattern, or a stdio MCP by command pattern.",
            "properties": {
              "name": {
                "type": "string",
                "description": "Display name for the MCP server."
              },
              "serverUrl": {
                "type": "string",
                "description": "Allowed HTTP MCP server URL or domain pattern."
              },
              "command": {
                "type": "string",
                "description": "Allowed stdio MCP command pattern."
              },
              "toolAllowlist": {
                "type": "array",
                "description": "Tool names exposed by this MCP server. Omit or leave empty to allow all tools.",
                "items": {
                  "type": "string"
                }
              }
            },
            "anyOf": [
              { "required": ["serverUrl"] },
              { "required": ["command"] }
            ],
            "additionalProperties": false
          }
        },
        "egressAllowlist": {
          "type": "array",
          "description": "Additional outbound domains that agents in this environment are allowed to reach. When set without egressMode, it is unioned with the inherited user/team network allowlist.",
          "items": {
            "type": "string",
            "description": "An allowed outbound domain, e.g. `registry.npmjs.org`."
          }
        },
        "egressMode": {
          "type": "string",
          "description": "How this environment's egress allowlist combines with team/user network settings. `allow_all` disables egress restrictions (subject to team policy). `parent_plus_network_settings` unions egressAllowlist with the inherited user/team allowlist. `default_with_network_settings` allows the default domains plus egressAllowlist. `network_settings_only` allows only required domains plus egressAllowlist.",
          "enum": [
            "allow_all",
            "parent_plus_network_settings",
            "default_with_network_settings",
            "network_settings_only"
          ]
        },
        "chromeExecutablePath": {
          "type": "string",
          "description": "Path to a Chrome/Chromium executable inside the environment, used for browser-based testing."
        },
        "enable_testing": {
          "description": "Whether agents may run cloud testing (e.g. computer use) in this environment. Defaults to true; set to false to disable.",
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string",
              "enum": ["true", "false"]
            }
          ]
        },
        "ports": {
          "type": "array",
          "description": "Ports to expose from the container. Similar to devcontainers port forwarding.",
          "items": {
            "type": "object",
            "required": ["port"],
            "properties": {
              "name": {
                "type": "string",
                "description": "A descriptive name for the port (e.g., 'web server', 'api')."
              },
              "port": {
                "type": "integer",
                "minimum": 1,
                "maximum": 65535,
                "description": "The port number inside the container to expose."
              }
            }
          }
        },
        "terminals": {
          "type": "array",
          "description": "The terminals to run when the environment is started.",
          "items": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": ["command"],
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The name of the terminal."
                    },
                    "command": {
                      "type": "string",
                      "description": "The command to run in the terminal."
                    },
                    "description": {
                      "type": "string",
                      "description": "A description of what the terminal does. This is displayed to the agent."
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": ["command"],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the terminal."
                  },
                  "command": {
                    "type": "string",
                    "description": "The command to run in the terminal."
                  },
                  "description": {
                    "type": "string",
                    "description": "A description of what the terminal does. This is displayed to the agent."
                  }
                }
              }
            ]
          }
        }
      }
    },
    "container": {
      "type": "object",
      "properties": {
        "build": {
          "type": "object",
          "description": "Docker build-related options.",
          "properties": {
            "dockerfile": {
              "type": "string",
              "description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `environment.json` file."
            },
            "dockerfileContents": {
              "type": "string",
              "description": "Inline Dockerfile content. Use this instead of `dockerfile` when you want to define the Dockerfile directly in `environment.json`."
            },
            "context": {
              "type": "string",
              "description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `environment.json` file."
            }
          },
          "anyOf": [
            {
              "required": ["dockerfile"]
            },
            {
              "required": ["dockerfileContents"]
            }
          ],
          "unevaluatedProperties": false
        },
        "image": {
          "type": "string",
          "description": "An explicit container image reference (registry image) for the environment base. One of `build`, `image`, or `snapshot` typically defines the environment base."
        },
        "snapshot": {
          "type": "string",
          "description": "A snapshot ID for the base environment. Takes precedence over `build` and `image` when set."
        },
        "agentCanUpdateSnapshot": {
          "type": "boolean",
          "description": "Whether the agent can update the snapshot. Defaults to true for snapshot-based and default-base environments; always false when the base is `build` or `image`."
        }
      },
      "required": []
    }
  },
  "allOf": [
    {
      "$ref": "#/definitions/container"
    },
    {
      "$ref": "#/definitions/common"
    }
  ],
  "unevaluatedProperties": false
}
