|
| 1 | +# Deploying with the Defang MCP Server |
| 2 | + |
| 3 | +This tutorial will show you how to deploy your services with the [Defang MCP Server](/docs/concepts/mcp.md). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [The Defang MCP Server](/docs/concepts/mcp.md#installation) |
| 8 | +- [A Defang Account](/docs/concepts/authentication) |
| 9 | +- [A `compose.yaml` file in your project](https://docs.docker.com/compose/gettingstarted/) |
| 10 | + |
| 11 | +Open your project with an IDE that has the [Defang MCP Server](/docs/concepts/mcp.md) installed. |
| 12 | + |
| 13 | +:::tip |
| 14 | +If the Defang MCP server doesn’t start automatically, try starting or restarting it from your IDE settings. |
| 15 | + |
| 16 | +::: |
| 17 | + |
| 18 | +## AWS |
| 19 | + |
| 20 | +### Step 1 - Collect your credentials |
| 21 | + |
| 22 | +There are many ways to authenticate with your [AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html). |
| 23 | + |
| 24 | +:::tip |
| 25 | +If you have the AWS CLI installed, you can verify that you've authenticated to AWS by running `aws sts get-caller-identity` and see your account ID. (The AWS CLI is not required in order to use Defang with AWS) |
| 26 | +::: |
| 27 | + |
| 28 | +### Step 2 - Setup Defang for AWS |
| 29 | + |
| 30 | +Open your chat window and type `/defang.AWS_Setup`, or select the corresponding prompt from your IDE’s options. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +The [MCP prompt](https://modelcontextprotocol.io/specification/2025-06-18/server/prompts) accepts two types of credentials: |
| 35 | + |
| 36 | +1. Method 1 - Using an AWS Profile: |
| 37 | + The following prompt will have three arguments and only the first argument is required: |
| 38 | + |
| 39 | + - AWS Credential - REQUIRED : The name of the AWS profile you want to use (e.g., "default" or "my-profile").  |
| 40 | + - AWS_SECRET_ACCESS_KEY - IGNORE : Leave this argument blank and press Enter.  |
| 41 | + - AWS_REGION - OPTIONAL : The AWS region where you want to deploy your services (e.g., "us-west-2").  |
| 42 | + |
| 43 | +2. Method 2 - Using Access Keys: |
| 44 | + The following prompt will have three arguments and all three arguments are required: |
| 45 | + |
| 46 | + - AWS Credential - REQUIRED : The AWS Access Key ID (e.g., "AKIAIOSFODNN7EXAMPLE").  |
| 47 | + - AWS_SECRET_ACCESS_KEY - REQUIRED : The AWS Secret Access Key. (e.g., "wJalrXUtnFEMI/K7MDENG/bPExampleSecretKey"). |
| 48 | + - AWS_REGION - REQUIRED : The AWS region where you want to deploy your services (e.g., "us-west-2").  |
| 49 | + |
| 50 | +### Step 3 - Deploy |
| 51 | + |
| 52 | +Once the prompt completes without errors, your chat input will be automatically populated with the deployment command for the IDE to execute. |
| 53 | + |
| 54 | +### Step 4 - Inspect your deployment |
| 55 | + |
| 56 | +You can check the status of your deployment by using the [Defang Services tool](../concepts/mcp#services) or you can inspect the resources created in your AWS Dashboard. |
| 57 | + |
| 58 | +## GCP |
| 59 | + |
| 60 | +### Prerequisites |
| 61 | + |
| 62 | +- [gcloud CLI](https://cloud.google.com/sdk/docs/install) |
| 63 | +- [GCP Application Default Credentials](https://cloud.google.com/docs/authentication/set-up-adc-local-dev-environment) |
| 64 | + |
| 65 | +### Step 1 - Collect your credentials |
| 66 | + |
| 67 | +After signing in to your GCP account, select an existing project or [create a new project](https://developers.google.com/workspace/guides/create-project). Make sure [billing is enabled](https://cloud.google.com/billing/docs/how-to/modify-project). Then, note down the project ID for the next step. |
| 68 | + |
| 69 | +### Step 2 - Setup Defang for GCP |
| 70 | + |
| 71 | +In your chat window, type `/defang.GCP_Setup` or select the corresponding prompt from your IDE’s options. |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +The [MCP argument](https://modelcontextprotocol.io/specification/2025-06-18/server/prompts) will require your GCP project ID you created in [Step 1](#step-1---collect-your-credentials-1). |
| 76 | + |
| 77 | + |
| 78 | +### Step 3 - Deploy |
| 79 | + |
| 80 | +Once the prompt completes without errors, your chat input will be automatically populated with the deployment command for the IDE to execute. |
| 81 | + |
| 82 | +### Step 4 - Inspect your deployment |
| 83 | + |
| 84 | +You can check the status of your depolyment by using the [Defang Services tool](../concepts/mcp#services) or you can inspect the resources created in your GCP Dashboard. |
| 85 | + |
| 86 | +## Playground |
| 87 | + |
| 88 | +### Step 1 - Setting your provider |
| 89 | + |
| 90 | +In your chat window, type `/defang.Playground_Setup` or select the corresponding prompt from your IDE’s options. |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +There are no arguments to this prompt. |
| 95 | + |
| 96 | +### Step 2 - Deploy |
| 97 | + |
| 98 | +Once the prompt completes without errors, your chat input will be automatically populated with the deployment command for the LLM to execute. |
| 99 | + |
| 100 | +### Step 3 - Inspect your deployment |
| 101 | + |
| 102 | +You can check the status of your deployment by using the [Defang Services tool](../concepts/mcp#services) or you can inspect the the project on the [Defang portal](https://portal.defang.io/projects). |
| 103 | + |
0 commit comments