Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions docs/concepts/mcp.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
---
title: MCP
description: Model Context Protocol (MCP) server with built-in tools to allow users to deploy with Defang through a supported IDE.
title: MCP Server
description: Model Context Protocol (MCP) Server with built-in tools to allow users to deploy with Defang through a supported IDE.
sidebar-position: 200
---

# Model Context Protocol (MCP)
# Model Context Protocol (MCP) Server

The Defang [Model Context Protocol (MCP) server](https://github.com/DefangLabs/defang/tree/main/src/pkg/mcp) includes built-in tools to allow users to deploy and manage cloud services through a supported IDE.
The Defang [Model Context Protocol (MCP) Server](https://github.com/DefangLabs/defang/tree/main/src/pkg/mcp) includes built-in tools to allow users to deploy and manage cloud services through a supported IDE.

Using this MCP server with an IDE will enable the AI coding agent (e.g. Copilot) to use Defang tools and resources to perform tasks, such as deploying a service to the cloud. This means you can now use Defang with IDE-integrated AI coding agents.
Using this MCP Server with an IDE will enable the AI coding agent (e.g. Copilot) to use Defang tools and resources to perform tasks, such as deploying a service to the cloud. This means you can now use Defang with IDE-integrated AI coding agents.

![Defang MCP Server Diagram](/img/mcp-concept/diagram.png)

For more details about MCP architecture, visit the [official MCP documentation](https://modelcontextprotocol.io/introduction).

:::info
The MCP Server currently supports deployments to [Defang Playground](/docs/providers/playground). We plan to support Defang BYOC in future updates.
This page is a guide to the Defang MCP Server detailing its installation, tools, and usage. If you are looking for an example of how you can deploy a MCP project with Defang, please instead refer to our [MCP sample application](https://github.com/DefangLabs/samples/tree/main/samples/mcp).
:::

## Installation

First, make sure you have the [npm package manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) installed so that you can use `npx` commands.

Connect the MCP server with your IDE by running the following command in your terminal:
Connect the Defang MCP Server with your IDE by running the following command in your terminal:

```bash
npx -y defang mcp setup --client=<your-ide>
```

Replace `<your-ide>` with the name of your preferred IDE. See our list of [Supported IDEs](#supported-ides). After setup, you can start the MCP server with the command:
Replace `<your-ide>` with the name of your preferred IDE. See our list of [Supported IDEs](#supported-ides). After setup, you can start the MCP Server with the command:

```bash
npx -y defang mcp serve
```

Once the server is running, you can access the Defang MCP tools directly through the AI agent chat in your IDE.
Once the MCP Server is running, you can access the Defang MCP tools directly through the AI agent chat in your IDE.

![IDE Screenshot](/img/mcp-concept/ide.png)

Expand All @@ -54,7 +54,7 @@ npx -y defang mcp setup --client=cursor
npx -y defang mcp setup --client=windsurf
```

### VSCode
### VS Code

```bash
npx -y defang mcp setup --client=vscode
Expand All @@ -77,7 +77,7 @@ Below are the tools available in the Defang MCP Server.
The `deploy` tool scans your project directory for Dockerfiles and `compose.yaml` files, then deploys the detected service(s) using Defang. You can monitor the deployment process in the Defang Portal.

:::info
The MCP Server currently supports deployments to [Defang Playground](/docs/providers/playground). We plan to support Defang BYOC in future updates.
The Defang MCP Server currently supports deployments to [Defang Playground](/docs/providers/playground). We plan to support BYOC in future updates.
:::

### `services`
Expand All @@ -88,10 +88,6 @@ The `services` tool displays the details of all your services that are currently

Given a project name or directory, the `destroy` tool identifies any services deployed with Defang and terminates them. If no services are found, it will display an appropriate message.

:::info
This page is a guide to the Defang MCP Server detailing its installation, tools, and usage. If you are looking for an example of how you can deploy a MCP project with Defang, please instead refer to our [MCP sample application](https://github.com/DefangLabs/samples/tree/main/samples/mcp).
:::

## Example Prompts

After connecting the Defang MCP Server to your IDE using an installation method, you can type in prompts in your chat to invoke the AI agent to use any MCP tool(s).
Expand Down