Skip to content
Merged
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
4 changes: 2 additions & 2 deletions jooby-mcp-apt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp</artifactId>
<artifactId>mcp-core</artifactId>
</dependency>

<dependency>
Expand All @@ -56,7 +56,7 @@
<dependency>
<groupId>com.palantir.javapoet</groupId>
<artifactId>javapoet</artifactId>
<version>0.11.0</version>
<version>0.12.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jooby-mcp-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp</artifactId>
<artifactId>mcp-core</artifactId>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion jooby-mcp-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
Expand Down
8 changes: 6 additions & 2 deletions jooby-mcp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
</dependency>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp</artifactId>
<artifactId>mcp-core</artifactId>
</dependency>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-json-jackson2</artifactId>
</dependency>
<dependency>
<groupId>io.jooby</groupId>
Expand Down Expand Up @@ -106,7 +110,7 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.42</version>
<version>2.2.45</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ public Mono<Void> notifyClients(String method, Object params) {
.then();
}

@Override
public Mono<Void> notifyClient(String sessionId, String method, Object params) {
return Mono.defer(() -> {
McpServerSession session = this.sessions.get(sessionId);
if (session == null) {
LOG.debug("Session {} not found", sessionId);
return Mono.empty();
}
return session.sendNotification(method, params);
});
}

@Override
public Mono<Void> closeGracefully() {
return Flux.fromIterable(sessions.values())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ public void setSessionFactory(McpStreamableServerSession.Factory sessionFactory)
this.sessionFactory = sessionFactory;
}

@Override
public Mono<Void> notifyClient(String sessionId, String method, Object params) {
return Mono.defer(() -> {
McpStreamableServerSession session = this.sessions.get(sessionId);
if (session == null) {
LOG.debug("Session {} not found", sessionId);
return Mono.empty();
}
return session.sendNotification(method, params);
});
}

@Override
public Mono<Void> notifyClients(String method, Object params) {
if (this.sessions.isEmpty()) {
Expand Down
13 changes: 9 additions & 4 deletions jooby-mcp/src/test/java/transport/StreamableTransportApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io.jooby.Jooby;
import io.jooby.jackson.JacksonModule;
import io.modelcontextprotocol.common.McpTransportContext;
import io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapper;
import io.modelcontextprotocol.json.jackson2.JacksonMcpJsonMapper;
import io.modelcontextprotocol.server.McpServer;
import io.modelcontextprotocol.server.McpServerFeatures;
import io.modelcontextprotocol.spec.McpSchema;
Expand All @@ -32,12 +32,17 @@ private void runMcpServer() {
McpServerFeatures.SyncToolSpecification toolSpec =
McpServerFeatures.SyncToolSpecification.builder()
.tool(McpSchema.Tool.builder()
.name("echo_tool")
.name("echo_tool")
.description("A tool that echoes back the input it receives.")
// .inputSchema(new McpSchema.JsonSchema(""))
.build()
.build()
)
.callHandler((exchange, request) -> new McpSchema.CallToolResult(request.arguments().get("input").toString(), false))
.callHandler((exchange, request) -> {
var input = request.arguments().get("input").toString();
return McpSchema.CallToolResult.builder()
.addTextContent(input)
.build();
})
.build();

McpServer.sync(transportProvider)
Expand Down
12 changes: 7 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
<maven.compiler.release>21</maven.compiler.release>
<revision>2.1.0</revision>

<jooby.version>4.0.15</jooby.version>
<jackson2.version>2.21.0</jackson2.version>
<jooby.version>4.0.17</jooby.version>
<jackson2.version>2.21.1</jackson2.version>
<jackson.annotations.version>2.21</jackson.annotations.version>
<mcp.sdk.version>0.18.1</mcp.sdk.version>
<lombok.version>1.18.42</lombok.version>
<mcp.sdk.version>1.1.0</mcp.sdk.version>
<lombok.version>1.18.44</lombok.version>
<junit.version>6.0.3</junit.version>
<pmd.version>7.16.0</pmd.version>
</properties>
Expand Down Expand Up @@ -106,8 +106,10 @@

<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp</artifactId>
<artifactId>mcp-bom</artifactId>
<version>${mcp.sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
Expand Down
Loading