Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OSGi Metadata Generation #10

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

konczdev
Copy link
Contributor

@konczdev konczdev commented Feb 15, 2025

Motivation and Context

Added OSGi metadata generation support using the bnd-maven-plugin to enable proper OSGi bundle creation. This change allows the SDK to be used in OSGi environments while maintaining compatibility with regular Java applications. The generated metadata includes:

  • Proper bundle naming and versioning
  • Explicit package exports with versions
  • Optional dependencies for Jakarta
  • Version ranges for required dependencies
  • Java 17 capability requirement

How Has This Been Tested?

  • Verified MANIFEST.MF generation with Maven build
  • Validated package exports and imports with correct versions

Breaking Changes

No breaking changes. This enhancement is completely backwards compatible:

  • Non-OSGi users are unaffected
  • Existing Maven builds continue to work as before
  • No API changes or runtime behavior modifications

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

The implementation uses bnd-maven-plugin 7.1.0 for metadata generation.

Example MANIFEST.MF with the current configuration

Manifest-Version: 1.0
Build-Jdk-Spec: 21
Created-By: 21.0.5 (Eclipse Adoptium)
Implementation-Title: mcp
Implementation-Version: 0.8.0-SNAPSHOT
Automatic-Module-Name: io.modelcontextprotocol.sdk.mcp
Bnd-LastModified: 1739627714629
Bundle-Description: Java SDK implementation of the Model Context Protocol, enabling seamless integration with language models and AI tools
Bundle-DocURL: https://github.com/modelcontextprotocol/java-sdk
Bundle-License: "MIT License";link="http://www.opensource.org/licenses/mit-license.php"
Bundle-ManifestVersion: 2
Bundle-Name: Bundle io.modelcontextprotocol.sdk : mcp
Bundle-SCM: url="https://github.com/modelcontextprotocol/java-sdk",connection="git://github.com/modelcontextprotocol/java-sdk.git",developer-connection="[email protected]/modelcontextprotocol/java-sdk.git",tag=HEAD
Bundle-SymbolicName: io.modelcontextprotocol.sdk.mcp
Bundle-Vendor: Anthropic
Bundle-Version: 0.8.0.SNAPSHOT
Export-Package:
 io.modelcontextprotocol.client;version="0.8.0.SNAPSHOT"
 io.modelcontextprotocol.client.transport;version="0.8.0.SNAPSHOT"
 io.modelcontextprotocol.server;version="0.8.0.SNAPSHOT"
 io.modelcontextprotocol.server.transport;version="0.8.0.SNAPSHOT"
 io.modelcontextprotocol.spec;version="0.8.0.SNAPSHOT"
 io.modelcontextprotocol.util;version="0.8.0.SNAPSHOT"
Import-Package:
 org.slf4j;version="[2.0,3)"
 jakarta.servlet;resolution:=optional;version="[6.1,7)"
 jakarta.servlet.annotation;resolution:=optional;version="[6.1,7)"
 jakarta.servlet.http;resolution:=optional;version="[6.1,7)"
 com.fasterxml.jackson.annotation;version="[2.17,3)"
 com.fasterxml.jackson.core.type;version="[2.17,3)"
 com.fasterxml.jackson.databind;version="[2.17,3)"
 org.reactivestreams;version="[1.0,2)"
 reactor.core;version="[3.7,4)"
 reactor.core.publisher;version="[3.7,4)"
 reactor.core.scheduler;version="[3.7,4)"
 reactor.util.annotation;version="[3.7,4)"
 reactor.util.context;version="[3.7,4)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
Tool: Bnd-7.1.0.202411251545

@konczdev konczdev changed the title Add OSGi Metadata Generation Support Add OSGi Metadata Generation Feb 16, 2025
@konczdev konczdev marked this pull request as draft February 16, 2025 08:22
@konczdev konczdev force-pushed the osgi-support branch 2 times, most recently from 73763a4 to 1912ee7 Compare February 16, 2025 08:37
@konczdev
Copy link
Contributor Author

Sorry for the lot updates, accidentally messed up the whitespaces.

@konczdev konczdev marked this pull request as ready for review February 16, 2025 08:39
@konczdev
Copy link
Contributor Author

@tzolov can I request a review for this PR?

Copy link
Contributor

@tzolov tzolov left a comment

Choose a reason for hiding this comment

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

Thans @konczdev
LGTM

@tzolov tzolov merged commit d9c4818 into modelcontextprotocol:main Feb 26, 2025
@tzolov tzolov added this to the 0.8.0 milestone Feb 26, 2025
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