env0 MCP Server – Infrastructure Management
env0's official MCP server connects compatible AI tools to the env0 platform for natural-language infrastructure operations. It lets agents work with env0 projects, environments, deployments, logs, Cloud Compass resources, and Infrastructure as Code generation while using env0 API credentials and organization context.
Overview
env0's MCP Server is the official Model Context Protocol integration for the env0 infrastructure automation platform. It gives compatible AI assistants a controlled way to query and operate env0 resources, including projects, environments, deployments, plan logs, Cloud Compass resources, and generated Infrastructure as Code. The server is especially useful when an operator wants to ask natural-language questions about infrastructure status, drift, deployment failures, or available projects without switching out of an MCP-enabled development environment.
What the MCP server enables
The server exposes env0-specific tools for project and environment management, deployment operations, monitoring, and cloud resource workflows. Documented tools include retrieving projects and environments, deploying an existing environment, aborting a running deployment, approving or canceling pending environment plans, retrieving plan logs, searching deployment history, fetching deployment context, listing Cloud Compass configurations and resources, generating Terraform or OpenTofu code from cloud resources, and checking the status of IaC generation jobs.
Some operations are intentionally gated by env0 behavior. For example, creating a deployment for an existing environment is documented as always requiring user approval in env0 before execution. Debugging tools are designed to inspect deployment metadata, step statuses, and selected logs, while the documentation notes that full plan details should be reviewed in the env0 console and that state:get is blocked.
When to use it
Use this MCP server when an AI agent needs operational context from env0 while helping with infrastructure delivery. Practical examples include listing all environments in a project, checking whether a production environment has drift issues, reviewing the latest plan logs, explaining why a deployment failed, aborting a stuck deployment, or generating Terraform or OpenTofu for existing cloud resources discovered through Cloud Compass.
Connection and authentication
The documented default setup runs the server locally with Docker over stdio. env0 also documents an HTTP transport for remote MCP access by setting MCP_TRANSPORT=http and exposing the server at /mcp. Authentication uses env0 API credentials supplied through environment variables: ENV0_API_KEY, ENV0_API_SECRET, and ENV0_ORGANIZATION_ID. These values should be managed as secrets and scoped according to the permissions the agent actually needs.
Key considerations
The server can initiate meaningful infrastructure actions, so it should be connected only in trusted MCP clients and configured with least-privilege env0 credentials. Deployment and approval workflows should remain subject to env0's normal access controls and approval gates. For HTTP mode, operators are responsible for hosting and securing the endpoint, including network access, TLS, and any perimeter controls appropriate for exposing an MCP server.
Supported Transports
stdio
Command: docker
Args:
run-i--rm-eENV0_API_KEY=${ENV0_API_KEY}-eENV0_API_SECRET=${ENV0_API_SECRET}-eENV0_ORGANIZATION_ID=${ENV0_ORGANIZATION_ID}env0/mcp-server
streamable_http
URL: http://localhost:3000/mcp
Frequently Asked Questions
- When should an AI agent use the env0 MCP server?
- Use it when the agent needs live env0 context for infrastructure projects, environments, deployments, plan logs, Cloud Compass resources, drift investigation, or Terraform and OpenTofu generation workflows.
- What does the env0 MCP server add to an AI agent's capabilities?
- It lets the agent call env0-specific tools instead of relying on static knowledge, including tools to retrieve projects and environments, inspect deployment history, read selected logs, and work with Cloud Compass infrastructure resources.
- What can the AI agent access or manage through this server?
- The documented tools cover project and environment lookup, environment deployment operations, approval and cancellation of pending plans, plan-log retrieval, deployment-context debugging, Cloud Compass cloud resource queries, and Terraform or OpenTofu IaC generation. Access is limited by the env0 credentials and organization configured for the server.
- How is authentication configured for this MCP server?
- Authentication is configured with env0 API credentials supplied as environment variables: `ENV0_API_KEY`, `ENV0_API_SECRET`, and `ENV0_ORGANIZATION_ID`. These should be stored as secrets and scoped to the minimum env0 permissions required by the agent.
- Which transport should be used for the env0 MCP server?
- Use the documented Docker stdio configuration for local MCP clients such as Claude Desktop, VS Code, Cursor-style tools, and other desktop agents. Use the HTTP transport only when intentionally hosting the server for remote access by setting `MCP_TRANSPORT=http` and protecting the exposed `/mcp` endpoint.