|
8 | 8 | cliClient "github.com/DefangLabs/defang/src/pkg/cli/client"
|
9 | 9 | "github.com/DefangLabs/defang/src/pkg/login"
|
10 | 10 | "github.com/DefangLabs/defang/src/pkg/mcp"
|
11 |
| - "github.com/DefangLabs/defang/src/pkg/mcp/prompts" |
12 |
| - "github.com/DefangLabs/defang/src/pkg/mcp/resources" |
13 |
| - "github.com/DefangLabs/defang/src/pkg/mcp/tools" |
14 | 11 | "github.com/DefangLabs/defang/src/pkg/term"
|
15 | 12 | "github.com/mark3labs/mcp-go/server"
|
16 | 13 | "github.com/spf13/cobra"
|
@@ -42,48 +39,14 @@ var mcpServerCmd = &cobra.Command{
|
42 | 39 | term.DefaultTerm = term.NewTerm(os.Stdin, logFile, logFile)
|
43 | 40 | }
|
44 | 41 |
|
45 |
| - // Setup knowledge base |
46 |
| - term.Debug("Setting up knowledge base") |
47 |
| - if err := mcp.SetupKnowledgeBase(); err != nil { |
48 |
| - return fmt.Errorf("failed to setup knowledge base: %w", err) |
49 |
| - } |
| 42 | + cluster := getCluster() |
50 | 43 |
|
51 | 44 | // Create a new MCP server
|
52 | 45 | term.Debug("Creating MCP server")
|
53 |
| - s := server.NewMCPServer( |
54 |
| - "Deploy with Defang", |
55 |
| - RootCmd.Version, |
56 |
| - server.WithResourceCapabilities(true, true), // Enable resource management and notifications |
57 |
| - server.WithPromptCapabilities(true), // Enable interactive prompts |
58 |
| - server.WithToolCapabilities(true), // Enable dynamic tool list updates |
59 |
| - server.WithInstructions(` |
60 |
| -Defang provides tools for deploying web applications to cloud providers (AWS, GCP, Digital Ocean) using a compose.yaml file. |
61 |
| -
|
62 |
| -There are a number of available tools to help with deployment, configuration, and manage applications deployed with Defang. |
63 |
| -
|
64 |
| -deploy - This tool deploys a web application to the cloud using the compose.yaml file in the application's working directory. |
65 |
| -destroy - This tool spins down and removes a deployed project from the cloud, cleaning up all associated resources. |
66 |
| -estimate - This tool estimates the cost of running a deployed application based on its resource usage and cloud provider pricing. |
67 |
| -services - This tool lists all running services for a deployed application, providing status and resource usage information |
68 |
| -list_configs - This tool lists all configuration variables for a deployed application, allowing you to view current settings. |
69 |
| -remove_config - This tool removes a configuration variable for a deployed application, allowing you to clean up unused settings. |
70 |
| -set_config - This tool sets or updates configuration variables for a deployed application, allowing you to manage environment variables and secrets. |
71 |
| - `), |
72 |
| - ) |
73 |
| - |
74 |
| - cluster := getCluster() |
75 |
| - |
76 |
| - // Setup resources |
77 |
| - term.Debug("Setting up resources") |
78 |
| - resources.SetupResources(s) |
79 |
| - |
80 |
| - //setup prompts |
81 |
| - term.Debug("Setting up prompts") |
82 |
| - prompts.SetupPrompts(s, cluster, &providerID) |
83 |
| - |
84 |
| - // Setup tools |
85 |
| - term.Debug("Setting up tools") |
86 |
| - tools.SetupTools(s, cluster, authPort, &providerID) |
| 46 | + s, err := mcp.NewDefangMCPServer(RootCmd.Version, cluster, authPort, &providerID) |
| 47 | + if err != nil { |
| 48 | + return fmt.Errorf("failed to create MCP server: %w", err) |
| 49 | + } |
87 | 50 |
|
88 | 51 | // Start auth server for docker login flow
|
89 | 52 | if authPort != 0 {
|
|
0 commit comments