forked from kagent-dev/kmcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_java.go
More file actions
39 lines (31 loc) · 1.02 KB
/
Copy pathinit_java.go
File metadata and controls
39 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package commands
import (
"fmt"
"github.com/spf13/cobra"
)
var initJavaCmd = &cobra.Command{
Use: "java [project-name]",
Short: "Initialize a new Java MCP server project",
Long: `Initialize a new MCP server project using the Java framework.
This command will create a new directory with a basic Java MCP project structure,
including a pom.xml file, Maven project structure, and an example tool.`,
Args: cobra.ExactArgs(1),
RunE: runInitJava,
}
func init() {
initCmd.AddCommand(initJavaCmd)
}
func runInitJava(_ *cobra.Command, args []string) error {
projectName := args[0]
framework := frameworkJava
if err := runInitFramework(projectName, framework, nil); err != nil {
return err
}
fmt.Printf("✓ Successfully created Java MCP server project: %s\n", projectName)
fmt.Printf("\nNext steps:\n")
fmt.Printf("1. cd %s\n", projectName)
fmt.Printf("2. mvn clean install\n")
fmt.Printf("3. mvn exec:java -Dexec.mainClass=\"com.example.Main\"\n")
fmt.Printf("4. Add tools with: kmcp add-tool my-tool\n")
return nil
}