feat(sources): add Maven Central package source for JVM MCP servers#1209
Open
MukundaKatta wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat(sources): add Maven Central package source for JVM MCP servers#1209MukundaKatta wants to merge 1 commit intomodelcontextprotocol:mainfrom
MukundaKatta wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
8885358 to
c57da80
Compare
Add a `maven` registry type so JVM-based MCP servers (Java/Kotlin/Scala) can be published to Maven Central and resolved through the registry. Ownership is verified by reading the published POM and matching either an `<mcpName>` Maven property or an `mcp-name: <serverName>` line in the POM `<description>`. Maven Central already validates `groupId` domain ownership at publish time, so a matching declaration in the POM is sufficient to bind a package to an MCP server name in the same namespace. The identifier is the Maven `groupId:artifactId` coordinate (e.g., `org.example:my-mcp-server`); version stays in the dedicated `version` field so it's consistent with the other registry types. Closes modelcontextprotocol#1102
c57da80 to
e0315e4
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
#1102 asks for first-class support for JVM MCP servers (Java/Kotlin/Scala) so they can be published to Maven Central and discovered through the registry. Today the official registry covers npm, PyPI, NuGet, OCI and MCPB; JVM is the obvious gap, and the JVM ecosystem already has a strong single-shot CLI story via
jbang(per the discussion comment).What
Adds a new
mavenregistry type with the same shape as the existing JVM-friendly handlers, followingdocs/contributing/add-package-registry.md:RegistryTypeMaven,RegistryURLMaven(https://repo.maven.apache.org/maven2),RuntimeHintJBang.internal/validators/registries/maven.go):identifierisgroupId:artifactId(e.g.,io.github.example:demo-mcp-server);versionstays in the dedicated field.<base>/<group/path>/<artifactId>/<version>/<artifactId>-<version>.pomand parses it withencoding/xml.<mcpName>...</mcpName>Maven property (preferred, most explicit) or anmcp-name: <serverName>line in the POM<description>(mirrors the PyPI/NuGet README convention). Maven Central already validatesgroupIddomain ownership at publish time, so a matching declaration in the POM is enough to bind a package to a server name in the same namespace.io.LimitReaderto keep a hostile mirror from blowing up memory; sanity checks that the POM's owngroupId/artifactIdmatch the requested coordinate.internal/validators/package.goswitch.docs/reference/server-json/draft/server.schema.jsonandinternal/validators/schemas/2025-12-11.json: addmaventoregistryTypeexamples, the Maven Central URL toregistryBaseUrlexamples, andjbangtoruntimeHintexamples.docs/reference/api/openapi.yaml: same example additions.docs/reference/server-json/official-registry-requirements.md: add Maven Central to the supported-registries list.docs/reference/server-json/generic-server-json.md: add a Maven (JVM) example with thejbangruntime hint.Tested
internal/validators/registries/maven_test.goexercises:fileSha256/ non-Central base URL rejected,<mcpName>property and withmcp-name:description fallback (against anhttptest.Server),mcpName, missing ownership signal (asserts the error tells publishers exactly what to add), POMgroupIdmismatch, 404, and malformed XML.TestValidate_RegistryTypesAndUrlsinvalid_mavencase is updated to ainvalid_maven_wrong_baseurlcase (sincemavenis now a valid type, but the official registry still restricts it to Maven Central).ValidateMavenAthelper is exported only viamaven_export_test.goso the production binary stays minimal while tests can point the validator at an in-process repo.Closes #1102