-
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 1 commit
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,110 @@ | ||
--- | ||
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) | ||
|
||
Defang has a [Model Context Protocol (MCP) server](https://github.com/DefangLabs/defang) with built-in tools to allow users to deploy and manage cloud services through a | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
supported IDE. | ||
|
||
For more detail on MCP architecture, visit the [official MCP documentation](https://modelcontextprotocol.io/introduction). | ||
commit111 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
### Overview | ||
|
||
An MCP server enhances the functionality of AI agents by enabling them to use external resources and tools to create responses or perform tasks (e.g. integrate with Defang). In the case of Defang's MCP Server, you can use deploy and manage your services by asking an AI agent to do so in an IDE. | ||
|
||
## Installation | ||
|
||
To run this server, you will need to install the [Defang CLI](/docs/getting-started). Then, you can run: | ||
|
||
```bash | ||
defang mcp --client=<your-ide> | ||
``` | ||
|
||
This sets up the MCP server to connect with your IDE. | ||
|
||
## Supported IDEs | ||
|
||
### Cursor | ||
|
||
``` | ||
defang mcp --client=cursor | ||
``` | ||
|
||
### Windsurf | ||
|
||
``` | ||
defang mcp --client=windsurf | ||
``` | ||
|
||
### VSCode / VSCode Insiders | ||
|
||
``` | ||
defang mcp --client=vscode | ||
``` | ||
|
||
### Claude Desktop | ||
|
||
(While this is not an IDE in the traditional sense, it can support MCP servers.) | ||
|
||
``` | ||
defang mcp --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
|
||
|
||
### `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. | ||
|
||
### `login` | ||
|
||
The `login` tool will open a browser to the Portal to authenticate to Defang. Once you are logged in, a session token is stored, and you will not need to log in again until the session expires or you manually log out. | ||
|
||
### `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. | ||
|
||
:::info | ||
This page is a guide to the Defang MCP Server detailing its usage, installation, and tools. 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 | ||
|
||
Let's say you are using an IDE with an AI agent. 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). | ||
|
||
In your IDE with your project open, 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 | ||
``` |
Oops, something went wrong.
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.