> ## Documentation Index
> Fetch the complete documentation index at: https://docs.envzero.com/llms.txt
> Use this file to discover all available pages before exploring further.

# env zero MCP server

> Connect AI assistants and IDEs to env zero with the open source MCP server to list environments, deploy, read deployment logs, and codify cloud resources.

The env zero MCP server lets AI assistants and IDEs that support the Model Context Protocol (MCP) work with env zero: list projects and environments, deploy and approve, read deployment history and logs, and generate code for cloud resources. The server is open source: [env0/mcp-server](https://github.com/env0/mcp-server).

## Prerequisites

* Docker. The server runs as the `env0/mcp-server` container image.
* An env zero [API key](https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/api-keys.md#how-to-create-an-api-key): its key ID and secret.
* Your [Organization ID](https://docs.envzero.com/guides/admin-guide/organizations.md#finding-my-organization-id), if the API key has access to more than one organization.

## Configure your client

Add the server to your MCP client. Replace the placeholders with your API key ID, API key secret, and Organization ID. Omit the `ENV0_ORGANIZATION_ID` line if the key has access to only one organization.

```bash Claude Code theme={null}
claude mcp add env0 -- docker run -i --rm \
  -e ENV0_API_KEY=<API_KEY_ID> \
  -e ENV0_API_SECRET=<API_KEY_SECRET> \
  -e ENV0_ORGANIZATION_ID=<ORGANIZATION_ID> \
  env0/mcp-server
```

```json Cursor (~/.cursor/mcp.json) theme={null}
{
  "mcpServers": {
    "env0": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "ENV0_API_KEY=<API_KEY_ID>",
        "-e", "ENV0_API_SECRET=<API_KEY_SECRET>",
        "-e", "ENV0_ORGANIZATION_ID=<ORGANIZATION_ID>",
        "env0/mcp-server"
      ]
    }
  }
}
```

```json VS Code (.vscode/mcp.json) theme={null}
{
  "servers": {
    "env0": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "ENV0_API_KEY=<API_KEY_ID>",
        "-e", "ENV0_API_SECRET=<API_KEY_SECRET>",
        "-e", "ENV0_ORGANIZATION_ID=<ORGANIZATION_ID>",
        "env0/mcp-server"
      ]
    }
  }
}
```

```json Claude Desktop (claude_desktop_config.json) theme={null}
{
  "mcpServers": {
    "env0": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "ENV0_API_KEY=<API_KEY_ID>",
        "-e", "ENV0_API_SECRET=<API_KEY_SECRET>",
        "-e", "ENV0_ORGANIZATION_ID=<ORGANIZATION_ID>",
        "env0/mcp-server"
      ]
    }
  }
}
```

Most other clients accept the same `mcpServers` JSON. For client-specific instructions, see the [env0/mcp-server README](https://github.com/env0/mcp-server#readme).

Each server instance uses one API key. To work with keys that have different permissions, add the server more than once under different names.

## Environment variables

| Variable | Required | Default | Description |
| - | - | - | - |
| `ENV0_API_KEY` | Yes | None | API key ID |
| `ENV0_API_SECRET` | Yes | None | API key secret |
| `ENV0_ORGANIZATION_ID` | If the key has access to more than one organization | None | Organization the tools work in |
| `ENV0_API_URL` | No | `https://api.env0.com` | env zero API URL |

## Tools

| Tool | What it does |
| - | - |
| **Projects and environments** | |
| `get-projects` | Lists the projects in the organization. |
| `get-environments` | Lists environments, or gets one by ID. Filters by name or project. |
| **Deployments** | |
| `deploy-environment` | Starts a new deployment of an existing environment, optionally at a specific revision. The deployment always waits for approval. |
| `approve-environment` | Approves the environment's deployment that is waiting for approval. |
| `cancel-environment` | Cancels the environment's latest deployment while it is queued or waiting for approval. |
| `abort-environment` | Stops the environment's latest deployment while it is in progress. |
| **Logs and troubleshooting** | |
| `get-plan-logs` | Returns the plan log of the environment's latest deployment. |
| `get-error-analysis` | Returns an analysis of the errors in the environment's latest deployment. |
| `search-deployments` | Lists an environment's recent deployments, newest first, optionally filtered by status. Returns 10 by default and up to 25. |
| `get-deployment-context` | Returns the metadata, step statuses, and the log of the first failed step for one deployment. Pass a step name to read a different step. |
| **Cloud resources** | |
| `get-cloud-configurations` | Lists the organization's [Cloud Compass](https://docs.envzero.com/guides/cloud-compass/cloud-compass.md) cloud accounts. |
| `get-cloud-resources` | Lists cloud resources found by Cloud Compass. |
| `generate-iac` | Starts a job that generates infrastructure-as-code for cloud resources. |
| `check-iac-job-status` | Returns the status and result of a `generate-iac` job. |

To investigate an older failed deployment, the assistant can call `search-deployments` with `statuses` set to `FAILURE`, then pass a returned deployment ID to `get-deployment-context`.

## Permissions

The tools run with the permissions of the API key. A tool that needs a permission the key does not have fails. `deploy-environment` always waits for approval, and `approve-environment` can give that approval if the key has the permission to approve.

For read-only use, use a [Read-only API key](https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/api-keys.md#read-only-api-key).

`get-error-analysis` requires access to [AI-Powered Error Insights](https://docs.envzero.com/guides/admin-guide/environments/ai-powered-summarization-and-error-insights.md). The cloud resource tools require Cloud Compass.

## Troubleshooting

| Message | Fix |
| - | - |
| `Missing required env0 API credentials (ENV0_API_KEY and ENV0_API_SECRET)` | The server did not start. Set both variables in the client configuration. |
| `Authentication failed. Please check your ENV0_API_KEY and ENV0_API_SECRET credentials...` | The key ID or secret is wrong, or the key was deleted. |
| `Access forbidden. Your API key may not have sufficient permissions to access this resource...` | Give the key the permission the tool needs. |
| `This tool is using an env0 feature that is not part of your subscription plan...` | The tool uses a feature your plan does not include. Contact env zero support. |
| `Rate limit exceeded...` | Wait and retry. See [Rate limits](https://docs.envzero.com/guides/community-and-resources/support-and-help/api-access.md#rate-limits). |

## Next steps

* [env zero API access](https://docs.envzero.com/guides/community-and-resources/support-and-help/api-access.md) - Authenticate to the REST API directly.
* [env zero CLI](https://docs.envzero.com/guides/community-and-resources/support-and-help/env-zero-cli.md) - Work with env zero from a terminal or CI.
* [User API keys](https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/api-keys.md) - Create and manage the key the server uses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.