feat(extensions): add Java/JDK support for MCP servers#1816
feat(extensions): add Java/JDK support for MCP servers#1816lily-de merged 4 commits intoblock:mainfrom
Conversation
Add support for running Java and Kotlin based MCP servers using jbang on Linux and macOS systems. This follows the pattern established by npx and uvx commands, using hermit for dependency management. Key changes: - Add jbang script that manages OpenJDK and jbang installations - Use hermit to manage OpenJDK installation (version 17) - Auto-trust common sources like quarkiverse - Support custom registries via GOOSE_JBANG_REGISTRY environment variable - Add Java documentation and examples to extension docs - Update Docker configuration to include OpenJDK and jbang Implementation details: - Downloads and manages jbang locally in ~/.config/goose/mcp-hermit - Always uses --fresh and --quiet flags for better UX - Supports custom registries through environment variables Note: Windows support will be added in a future update. Example: goose run --with-extension "jbang jdbc@quarkiverse/quarkus-mcp-servers" Tested with: - Quarkus JDBC MCP server - Weather stdio server from kotlin-sdk samples
michaelneale
left a comment
There was a problem hiding this comment.
nice - looks good to me and jbang shim will help for cases where people do need a jvm based MCP but dont want to go through all the setup
|
thank you from a JVM girlie! ❤️ |
|
tested on mac $ goose session --with-extension "jbang jdbc@quarkiverse/quarkus-mcp-servers"
Failed to start extension: Failed to start extension: Transport error: Stdio process error: No such file or directory (os error 2) |
Hi @angiejones, thanks for testing this locally! This is my first contribution to Goose and my understanding of the desired behavior here is still evolving. Since you posted your test results, I discovered that I have a However, I also have When first posting the PR, my assumption was the the shim would kick in for both the GUI and the CLI. Though upon further inspection, these do not appear to be used in the CLI. Is it sufficient to claim Java/Kotlin support if the CLI does not make use of the shim? |
* origin/main: feat: Adjust UX of extension installs in V2 settings (block#1836) fix: goose modes styling (block#1833) New toasts (block#1777) feat: bring back install-link-generator which was lost in the extensions-site revamp (block#1832) feat: settings v2 extension add refactor (block#1815) fix: Update link color in chat view for user messages (block#1717) (block#1754) fix windows native uvx (block#1775) fix: correct deep link install link format (block#1830) fix(cli): multiselect visibility for light themes (block#1716) docs: Update styling (block#1831) Refactor top bar (block#1829) Docs: Revamp extensions site (block#1260) fix: extension site not rendering servers (block#1824) feat: add pdf reader (block#1818) fix: fix allowing multiple selectors in goosebench (block#1814) Fix chat width issues (block#1813)
* main: ui: turn on extensions at startup (#1861) ui: models dropdown (#1860) fix: cli empty line (#1856) feat: Allow setting OpenAI timeout from config (#1819) feat: add retry for google (#1854) feat(extensions): add Java/JDK support for MCP servers (#1816) feat: extract `StdioProcessError(msg)` to try to display (#1855) fix: show window bugfix (#1840) fix: append the attachment path to the existing text in the input prompt (#1842) docs: updated docs for smart approval mode (#1853) styles: chat scroll interaction (#1837) ui: add description field to modal (#1846) feat: use temp dir for extracting goose binary (#1838) ui: remove and update extensions (#1847) fix: disappearing user text when stopped (#1839)
Update 2025-03-24
I've worked past the node integrity issue and was able to test the GUI on my machine. After adding 2 new commits to resolve a couple of issues, I have successfully added a Java-based extension to Goose with
jbang. I would appreciate reviewers also testing the GUI in the same manner.Screen.Recording.2025-03-24.at.2.25.43.PM.mov
Description
This PR adds support for Java and Kotlin-based MCP servers on Linux and macOS systems. It enables users to run JVM-based MCP servers using
jbang, following the same pattern established by ournpxanduvxintegrations.There are official Kotlin and Java MCP SDKs. Developers are already publishing MCP servers using those, so Goose needs the ability to install JDK-based extension to get access to them.
Note to Reviewers
I've tested this on my machine (see
Testingsection below), but would appreciate if others could test on M3 Macbooks, Linux machines or other supported (non-Windows) platformsKey Features
jbanginstallation in~/.config/goose/mcp-hermitGOOSE_JBANG_REGISTRYenvironment variable--freshand--quietflagsExample Usage
goose session --with-extension "jbang jdbc@quarkiverse/quarkus-mcp-servers"Documentation
Testing
Tested on an M2 Mac with Sequoia 15.3.2
CLI
GUI
just run-uiis currently failing with an npm integrity check.Platform Support
✅ Linux
✅ macOS
❌ Windows
Why jbang?
We evaluated several options for running Java/Kotlin MCP servers, including:
We chose jbang because it offers several key advantages for our use case:
Zero Installation Model: Like
npxfor Node.js anduvxfor Python, jbang allows running Java applications directly from source or JARs without requiring a local Java development environment. This aligns perfectly with our existing pattern for other language integrations.Script-First Approach: jbang treats Java code as scripts that can be run directly, making it ideal for MCP servers that are essentially single-purpose applications. This matches our philosophy of making extension development as straightforward as possible.
Built-in Dependency Management: jbang automatically handles dependencies declared in the code or catalog, similar to how
npxmanages npm packages. This eliminates the need for complex build tool configurations.Catalog Support: jbang's catalog feature allows publishing and running applications using simple aliases (e.g.,
jdbc@quarkiverse/quarkus-mcp-servers), making distribution and versioning of MCP servers much simpler.Cross-Platform: While our current implementation is Linux/macOS only, jbang itself is cross-platform, making future Windows support straightforward to implement.
Other solutions either required more complex setup (Maven/Gradle), didn't handle dependencies as elegantly (jpackage), or were too focused on development environments rather than runtime execution (SDKMan). GraalVM native-image, while powerful, would require compilation for each platform and doesn't align with our goal of running servers directly from source or JARs.