-
Notifications
You must be signed in to change notification settings - Fork 6
Create MCP documentation #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7c11943
create MCP documentation
commit111 93923d4
update commands and overview
commit111 ac6ae76
improve overview
commit111 23146ba
edit installation methods + remove mcp login tool
commit111 eeaedea
add diagram
commit111 34158a5
add extra info box
commit111 807c2ff
clarify npm and npx
commit111 823ec07
apply code review changes
commit111 9352dad
added IDE screenshot
commit111 0985889
Apply suggestions from code review
commit111 1d767ae
Update docs/concepts/mcp.md
commit111 c2a583e
remove login prompt
commit111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
--- | ||
title: MCP | ||
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) | ||
|
||
The Defang [Model Context Protocol (MCP) server](https://github.com/DefangLabs/defang) 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. | ||
|
||
 | ||
|
||
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. | ||
::: | ||
|
||
## 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: | ||
|
||
```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: | ||
|
||
```bash | ||
npx -y defang mcp serve | ||
commit111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
Once the server is running, you can access the Defang MCP tools directly through the AI agent chat in your IDE. | ||
|
||
## Supported IDEs | ||
|
||
### Cursor | ||
|
||
```bash | ||
npx -y defang mcp setup --client=cursor | ||
``` | ||
|
||
### Windsurf | ||
|
||
```bash | ||
npx -y defang mcp setup --client=windsurf | ||
``` | ||
|
||
### VSCode | ||
|
||
```bash | ||
npx -y defang mcp setup --client=vscode | ||
``` | ||
|
||
### Claude Desktop | ||
|
||
(While this is not an IDE in the traditional sense, it can support MCP servers.) | ||
|
||
```bash | ||
npx -y defang mcp setup --client=claude | ||
``` | ||
|
||
## MCP Tools | ||
|
||
Below are the tools available in the Defang MCP Server. | ||
|
||
### `deploy` | ||
|
||
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. | ||
commit111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
:::info | ||
The MCP Server currently supports deployments to [Defang Playground](/docs/providers/playground). We plan to support Defang BYOC in future updates. | ||
::: | ||
|
||
### `services` | ||
|
||
The `services` tool displays the details of all your services that are currently deployed with Defang. It shows the Service Name, Deployment ID, Public URL and Service Status. If there are no services found, it will display an appropriate message. | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### `destroy` | ||
|
||
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 an MCP tool(s). | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
For example, you can ask the AI agent: | ||
|
||
``` | ||
can you deploy this to defang? | ||
``` | ||
|
||
``` | ||
please destroy this project. | ||
``` | ||
|
||
``` | ||
am I logged in to defang? | ||
``` | ||
|
||
``` | ||
what services do I have? | ||
``` | ||
|
||
You can also choose to specify a project name or project directory if you do not have the project open: | ||
|
||
``` | ||
deploy this with defang /Users/yourname/Documents/project1 | ||
``` | ||
|
||
``` | ||
do I have a service called project1 | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.