Skip to content

feat: add java init framework#75

Merged
jmhbh merged 3 commits into
kagent-dev:mainfrom
ankittk:feature/support-java
Sep 3, 2025
Merged

feat: add java init framework#75
jmhbh merged 3 commits into
kagent-dev:mainfrom
ankittk:feature/support-java

Conversation

@ankittk

@ankittk ankittk commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Issue: #71
feat: add Java framework support for MCP server generation

  • Add comprehensive Java framework support including Maven project structure,
  • Java MCP SDK integration, tool generation with PascalCase naming, and
  • Kubernetes deployment manifests. Includes templates for Main.java,
  • MCPServer.java, Tool interface, and example tools with proper Java
  • conventions and Docker containerization support.

Make sure you have java and maven installed locally
To test:

  • go test ./pkg/cli/internal/frameworks/java/...
  • build the binary: go build -o bin/kmcp ./cmd/kmcp
  • create a new java mcp project:
./bin/kmcp init java test-java-server --non-interactive \
  --description "Test Java MCP Server" \
  --author "Ankit" \
  --email "ankit@example.com"
  • cd test-java-project
    ../bin/kmcp add-tool weather --description "Get weather information"
    ../bin/kmcp add-tool database --description "Database operations"

  • Generate manifest
    ../bin/kmcp deploy --dry-run --file kmcp.yaml

@ankittk ankittk force-pushed the feature/support-java branch 6 times, most recently from 5ebf764 to f5de79a Compare August 29, 2025 12:49

@jmhbh jmhbh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, STDIO works but there seems to be some issues when deploying running the server using http

Comment thread pkg/cli/internal/commands/run.go Outdated
Comment thread pkg/cli/internal/frameworks/java/templates/Dockerfile.tmpl Outdated
return []string{"dist/index.js"}
case manifest.FrameworkJava:
if deployTransport == transportHTTP {
return []string{"-jar", "app.jar", "--transport", "http", "--host", "0.0.0.0", "--port", fmt.Sprintf("%d", targetPort)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you able to get --transport http to work? I kept running into an issue requiring a sessionId to be present.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you test now?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with your latest changes but the /mcp endpoint was missing. I pushed a commit to fix that and its now working with the inspector so the command dist/kmcp deploy --file my-java/kmcp.yaml --transport http now works out of the box. Could you take a look at the changes and let me know if they look good to you?

@ankittk ankittk force-pushed the feature/support-java branch 2 times, most recently from c33ab72 to 19656ee Compare August 29, 2025 21:05
Signed-off-by: ankittk <ankit.kumar@getweave.com>
@ankittk ankittk force-pushed the feature/support-java branch from 19656ee to 2243dcf Compare September 1, 2025 19:21
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
Signed-off-by: JM Huibonhoa <jm.huibonhoa@solo.io>
@jmhbh jmhbh merged commit ddbe082 into kagent-dev:main Sep 3, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants