Skip to content

feat(spi): adds implementation-neutral SPI module #178

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions mcp-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,24 @@

<dependencyManagement>
<dependencies>
<!-- Core MCP -->
<!-- MCP Spec -->
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp</artifactId>
<artifactId>mcp-spi</artifactId>
<version>${project.version}</version>
</dependency>

<!-- MCP Jacson Schema -->
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-schema-jackson</artifactId>
<version>${project.version}</version>
</dependency>

<!-- MCP Reactor -->
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-reactor</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
31 changes: 31 additions & 0 deletions mcp-logging-slf4j/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-parent</artifactId>
<version>0.10.0-SNAPSHOT</version>
</parent>

<artifactId>mcp-logging-slf4j</artifactId>
<packaging>jar</packaging>
<name>Java SDK MCP SLF4J</name>
<description>Java SDK Logging SLF4J of the Model Context Protocol</description>
<url>https://github.com/modelcontextprotocol/java-sdk</url>

<dependencies>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-spi</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2025-2025 the original author or authors.
*/

package io.modelcontextprotocol.logger;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Aliaksei Darafeyeu
*/
public class Slf4jMcpLogger implements McpLogger {

private final Logger delegate;

public Slf4jMcpLogger(Class<?> clazz) {
this.delegate = LoggerFactory.getLogger(clazz);
}

@Override
public void debug(final String message) {
delegate.debug(message);
}

@Override
public void info(final String message) {
delegate.info(message);
}

@Override
public void warn(final String message) {
delegate.warn(message);
}

@Override
public void warn(final String message, final Throwable t) {
delegate.warn(message, t);
}

@Override
public void error(final String message, final Throwable t) {
delegate.error(message, t);
}

}
2 changes: 1 addition & 1 deletion mcp/README.md → mcp-reactor/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Java MCP SDK

Java SDK implementation of the Model Context Protocol, enabling seamless integration with language models and AI tools.
Java SDK Reactor implementation of the Model Context Protocol, enabling seamless integration with language models and AI tools.
For comprehensive guides and API documentation, visit the [MCP Java SDK Reference Documentation](https://modelcontextprotocol.io/sdk/java/mcp-overview).

114 changes: 30 additions & 84 deletions mcp/pom.xml → mcp-reactor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<artifactId>mcp-parent</artifactId>
<version>0.10.0-SNAPSHOT</version>
</parent>
<artifactId>mcp</artifactId>
<artifactId>mcp-reactor</artifactId>
<packaging>jar</packaging>
<name>Java MCP SDK</name>
<description>Java SDK implementation of the Model Context Protocol, enabling seamless integration with language models and AI tools</description>
<name>Java SDK MCP Reactor</name>
<description>Java SDK Reactor implementation of the Model Context Protocol, enabling seamless integration with language models and AI tools</description>
<url>https://github.com/modelcontextprotocol/java-sdk</url>

<scm>
Expand Down Expand Up @@ -65,61 +65,53 @@
</build>

<dependencies>

<!--MCP-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-spi</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-schema-jackson</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-logging-slf4j</artifactId>
<version>${project.version}</version>
</dependency>

<!--Reactor-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</dependency>


<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-http</artifactId>
<scope>test</scope>
</dependency>

<!-- The Spring Context is required due to the reactor-netty connector being dependent on
the Spring Lifecycle, as discussed here:
https://github.com/spring-projects/spring-framework/issues/31180 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>

<!-- Used by the HttpServletSseServerTransport -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>

<!--For test-->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assert4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand All @@ -138,70 +130,24 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>

<!-- Mockito cannot mock this class: class java.net.http.HttpClient. the bytebuddy helps. -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.javacrumbs.json-unit</groupId>
<artifactId>json-unit-assertj</artifactId>
<version>${json-unit-assertj.version}</version>
<scope>test</scope>
</dependency>


<!-- Used by the HttpServletSseServerTransport -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${jakarta.servlet.version}</version>
<scope>provided</scope>
</dependency>

<!-- Tomcat dependencies for testing -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
<scope>test</scope>
</dependency>

</dependencies>


Expand Down
Loading