Move mcp-json into mcp-core, add OSGi support
Co-authored-by: Luca Chang <131398524+LucaButBoring@users.noreply.github.com> Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
parent
be5ec12e1b
commit
c3b9ab09ea
5 changed files with 368 additions and 353 deletions
|
|
@ -10,7 +10,7 @@
|
|||
</parent>
|
||||
<artifactId>mcp-json-jackson2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Java MCP SDK JSON Jackson</name>
|
||||
<name>Java MCP SDK JSON Jackson 2</name>
|
||||
<description>Java MCP SDK JSON implementation based on Jackson 2</description>
|
||||
<url>https://github.com/modelcontextprotocol/java-sdk</url>
|
||||
<scm>
|
||||
|
|
@ -20,30 +20,59 @@
|
|||
</scm>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>bnd-maven-plugin</artifactId>
|
||||
<version>${bnd-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bnd-process</id>
|
||||
<goals>
|
||||
<goal>bnd-process</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<bnd><![CDATA[
|
||||
Bundle-Name: Bundle ${project.groupId} : ${project.artifactId}
|
||||
version: ${versionmask;===;${version_cleanup;${project.version}}}
|
||||
Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
|
||||
Bundle-Version: ${version}
|
||||
Automatic-Module-Name: ${project.groupId}.${project.artifactId}
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: io.modelcontextprotocol.json,io.modelcontextprotocol.json.schema, \
|
||||
*;
|
||||
Service-Component: OSGI-INF/io.modelcontextprotocol.json.jackson2.JacksonMcpJsonMapperSupplier.xml,OSGI-INF/io.modelcontextprotocol.json.schema.jackson2.JacksonJsonSchemaValidatorSupplier.xml
|
||||
-noimportjava: true;
|
||||
-nouses: true;
|
||||
-removeheaders: Private-Package
|
||||
]]>
|
||||
</bnd>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.modelcontextprotocol.sdk</groupId>
|
||||
<artifactId>mcp-json</artifactId>
|
||||
<version>0.18.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.modelcontextprotocol.sdk</groupId>
|
||||
<artifactId>mcp-core</artifactId>
|
||||
<version>0.18.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.networknt</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapperSupplier" immediate="true">
|
||||
<service>
|
||||
<provide interface="io.modelcontextprotocol.json.McpJsonMapperSupplier"/>
|
||||
</service>
|
||||
<implementation class="io.modelcontextprotocol.json.jackson2.JacksonMcpJsonMapperSupplier"/>
|
||||
</scr:component>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="io.modelcontextprotocol.json.schema.jackson.JacksonJsonSchemaValidatorSupplier" immediate="true">
|
||||
<service>
|
||||
<provide interface="io.modelcontextprotocol.json.schema.JsonSchemaValidatorSupplier"/>
|
||||
</service>
|
||||
<implementation class="io.modelcontextprotocol.json.schema.jackson2.JacksonJsonSchemaValidatorSupplier"/>
|
||||
</scr:component>
|
||||
|
|
@ -14,7 +14,7 @@ class McpJsonMapperTest {
|
|||
|
||||
@Test
|
||||
void shouldUseJackson2Mapper() {
|
||||
assertThat(McpJsonMapper.getDefault()).isInstanceOf(JacksonMcpJsonMapper.class);
|
||||
assertThat(McpJsonDefaults.getDefaultMcpJsonMapper()).isInstanceOf(JacksonMcpJsonMapper.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import io.modelcontextprotocol.json.McpJsonDefaults;
|
||||
import io.modelcontextprotocol.json.schema.jackson2.DefaultJsonSchemaValidator;
|
||||
|
||||
class JsonSchemaValidatorTest {
|
||||
|
||||
@Test
|
||||
void shouldUseJackson2Mapper() {
|
||||
assertThat(JsonSchemaValidator.getDefault()).isInstanceOf(DefaultJsonSchemaValidator.class);
|
||||
assertThat(McpJsonDefaults.getDefaultJsonSchemaValidator()).isInstanceOf(DefaultJsonSchemaValidator.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue