Defang MCP Server

Defang CLI. Develop Once, Deploy Anywhere. Take your app from Docker Compose to a secure and scalable deployment on your favorite cloud in minutes.

Remote serverstreamable-httpPython

What is the Defang MCP server?

Defang MCP server is a hosted integration for AI assistants that speak the Model Context Protocol. Defang CLI. Develop Once, Deploy Anywhere. Take your app from Docker Compose to a secure and scalable deployment on your favorite cloud in minutes.

What the assistant can call

Once Defang is connected, these are the calls the assistant has available:

  • Built — in support for MCP Server — the Defang MCP Server makes cloud deployment as easy as a single prompt. [Learn
  • COMPOSE_DISABLE_ENV_FILE — Whether to disable loading environment variables from a .env file in the current directory; defaults to false
  • COMPOSE_ENV_FILES — A comma-separated list of environment file(s) to use for interpolation instead of .env; overridden by the --env-file flag
  • COMPOSE_FILE — The Compose file(s) to use; defaults to compose.yaml, compose.yml, docker-compose.yaml, or docker-compose.yml in the current directory
  • COMPOSE_PATH_SEPARATOR — The path separator to use for COMPOSE_FILE; defaults to : on Unix/MacOS and ; on Windows
  • COMPOSE_PROJECT_NAME — The name of the project to use; overrides the name in the Compose file
  • DEFANG_ACCESS_TOKEN — The access token to use for authentication; if not specified, uses token from defang login
  • DEFANG_ALLOW_UPGRADE — If set to true, allows upgrading the CD image and Pulumi version to the latest available; defaults to false, ie. previously deployed versions will be
  • DEFANG_AWS_APN_ID — The AWS APN ID to use for attribution, eg. use pc:123456789abcdefgh for AWS Marketplace products
  • DEFANG_BUILD_CONTEXT_LIMIT — The maximum size of the build context when building container images; defaults to 100MiB
  • DEFANG_CD_BUCKET — The S3 bucket to use for the BYOC CD pipeline; defaults to defang-cd-bucket-…
  • DEFANG_CD_IMAGE — The image to use for the Continuous Deployment (CD) pipeline; defaults to public.ecr.aws/defang-io/cd:public-beta

Setting it up

Being a remote server, there is no local install. You register the endpoint with your client, authorise it once, and the tools appear.

Configuration and credentials

You will need 4 environment variables: DEFANG_ACCESS_TOKEN, DEFANG_AWS_APN_ID, DEFANG_MODEL_ID, PULUMI_ACCESS_TOKEN. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Choosing this one

Plenty of cloud and infrastructure servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Defang's toolset — Built, COMPOSE_DISABLE_ENV_FILE, COMPOSE_ENV_FILES and 11 more — is a fair guide to whether it matches your workflow. It is maintained by DefangLabs; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Before you rely on it

  • Your data travels to the provider's service, so the usual questions apply about what you send and what they retain.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Defang.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the defang mcp server does with a few real requests.

Available tools

ToolWhat it does
Builtin support for MCP Server — the Defang MCP Server makes cloud deployment as easy as a single prompt. [Learn more](https://docs.defang.io/docs/concepts/mcp)
COMPOSE_DISABLE_ENV_FILEWhether to disable loading environment variables from a .env file in the current directory; defaults to false
COMPOSE_ENV_FILESA comma-separated list of environment file(s) to use for interpolation instead of .env; overridden by the --env-file flag
COMPOSE_FILEThe Compose file(s) to use; defaults to compose.yaml, compose.yml, docker-compose.yaml, or docker-compose.yml in the current directory
COMPOSE_PATH_SEPARATORThe path separator to use for COMPOSE_FILE; defaults to : on Unix/MacOS and ; on Windows
COMPOSE_PROJECT_NAMEThe name of the project to use; overrides the name in the Compose file
DEFANG_ACCESS_TOKENThe access token to use for authentication; if not specified, uses token from defang login
DEFANG_ALLOW_UPGRADEIf set to true, allows upgrading the CD image and Pulumi version to the latest available; defaults to false, ie. previously deployed versions will be used to avoid unexpected upgrades
DEFANG_AWS_APN_IDThe AWS APN ID to use for attribution, eg. use pc:123456789abcdefgh for AWS Marketplace products
DEFANG_BUILD_CONTEXT_LIMITThe maximum size of the build context when building container images; defaults to 100MiB
DEFANG_CD_BUCKETThe S3 bucket to use for the BYOC CD pipeline; defaults to defang-cd-bucket-…
DEFANG_CD_IMAGEThe image to use for the Continuous Deployment (CD) pipeline; defaults to public.ecr.aws/defang-io/cd:public-beta
DEFANG_DEBUGset this to 1 or true to enable debug logging
DEFANG_DISABLE_ANALYTICSIf set to true, disables sending analytics to Defang; defaults to false

How to install the Defang MCP server

{
  "mcpServers": {
    "defanglabs": {
      "command": "npx",
      "args": ["-y", "defang"],
      "env": {
        "DEFANG_ACCESS_TOKEN": "your-value",
        "DEFANG_AWS_APN_ID": "your-value",
        "DEFANG_MODEL_ID": "your-value",
        "PULUMI_ACCESS_TOKEN": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
DEFANG_ACCESS_TOKENCredential the server authenticates with.Yes
DEFANG_AWS_APN_IDConfiguration value read at startup.Optional
DEFANG_MODEL_IDConfiguration value read at startup.Optional
PULUMI_ACCESS_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use Defang to Built.
  • Use Defang to COMPOSE DISABLE ENV FILE.
  • Use Defang to COMPOSE ENV FILES.

Frequently asked questions

Supported IDEs include Cursor, Windsurf, Codex, VS Code, VS Code Insiders, and Claude Desktop.