Skip to content

Commit 375a9a0

Browse files
Changes that allows Mcp usage from Chappie
Signed-off-by: Phillip Kruger <[email protected]>
1 parent 4fbccca commit 375a9a0

File tree

9 files changed

+43
-5
lines changed

9 files changed

+43
-5
lines changed

bom/application/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@
680680
<artifactId>quarkus-devui</artifactId>
681681
<version>${project.version}</version>
682682
</dependency>
683+
<dependency>
684+
<groupId>io.quarkus</groupId>
685+
<artifactId>quarkus-devui-spi</artifactId>
686+
<version>${project.version}</version>
687+
</dependency>
683688
<dependency>
684689
<groupId>io.quarkus</groupId>
685690
<artifactId>quarkus-devui-deployment</artifactId>

extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/menu/MCPProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void createMCPPage(BuildProducer<SettingPageBuildItem> settingPageProducer,
6161

6262
@BuildStep(onlyIf = IsDevelopment.class)
6363
@io.quarkus.deployment.annotations.Record(ExecutionTime.STATIC_INIT)
64-
void registerDevUiHandlers(
64+
void registerStreamableHTTPHandlers(
6565
BuildProducer<RouteBuildItem> routeProducer,
6666
DevUIRecorder recorder,
6767
LaunchModeBuildItem launchModeBuildItem,

extensions/devui/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<module>deployment</module>
2020
<module>test-spi</module>
2121
<module>deployment-spi</module>
22+
<module>runtime-spi</module>
2223
</modules>
2324
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<artifactId>quarkus-devui-parent</artifactId>
6+
<groupId>io.quarkus</groupId>
7+
<version>999-SNAPSHOT</version>
8+
</parent>
9+
10+
<artifactId>quarkus-devui-spi</artifactId>
11+
<name>Quarkus - Dev UI - Runtime SPI</name>
12+
<description>Quarkus Dev UI SPI</description>
13+
14+
</project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package io.quarkus.devui.runtime.spi;
2+
3+
public record McpEvent(boolean enabled) {
4+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.quarkus.devui.runtime.mcp;
1+
package io.quarkus.devui.runtime.spi;
22

33
import java.util.HashMap;
44
import java.util.Map;

extensions/devui/runtime/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<groupId>io.quarkus</groupId>
2323
<artifactId>quarkus-assistant-dev</artifactId>
2424
</dependency>
25+
<dependency>
26+
<groupId>io.quarkus</groupId>
27+
<artifactId>quarkus-devui-spi</artifactId>
28+
</dependency>
2529
</dependencies>
2630

2731
<build>

extensions/devui/runtime/src/main/java/io/quarkus/devui/runtime/mcp/McpDevUIJsonRpcService.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import jakarta.enterprise.context.ApplicationScoped;
1515
import jakarta.enterprise.inject.Produces;
1616

17+
import io.quarkus.devui.runtime.spi.McpEvent;
18+
import io.quarkus.devui.runtime.spi.McpServerConfiguration;
1719
import io.smallrye.mutiny.Multi;
1820
import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;
1921

@@ -22,10 +24,10 @@
2224
*/
2325
@ApplicationScoped
2426
public class McpDevUIJsonRpcService {
25-
2627
private final BroadcastProcessor<McpClientInfo> connectedClientStream = BroadcastProcessor.create();
28+
private final BroadcastProcessor<McpEvent> mcpEventStream = BroadcastProcessor.create();
2729

28-
// TODO: We need to be able to deregister a client if the connection drops. Mayby ping it ?
30+
// TODO: We need to be able to deregister a client if the connection drops. Maybe ping it ?
2931

3032
private final Set<McpClientInfo> connectedClients = new HashSet<>();
3133
private McpServerConfiguration mcpServerConfiguration;
@@ -43,7 +45,12 @@ public Set<McpClientInfo> getConnectedClients() {
4345
}
4446

4547
public Multi<McpClientInfo> getConnectedClientStream() {
46-
return connectedClientStream;
48+
return this.connectedClientStream;
49+
}
50+
51+
@Produces
52+
public Multi<McpEvent> getEventStream() {
53+
return this.mcpEventStream;
4754
}
4855

4956
public void addClientInfo(McpClientInfo clientInfo) {
@@ -59,12 +66,14 @@ public McpServerConfiguration getMcpServerConfiguration() {
5966
public McpServerConfiguration enable() {
6067
this.mcpServerConfiguration.enable();
6168
storeConfiguration(this.mcpServerConfiguration.toProperties());
69+
mcpEventStream.onNext(new McpEvent(true));
6270
return this.mcpServerConfiguration;
6371
}
6472

6573
public McpServerConfiguration disable() {
6674
this.mcpServerConfiguration.disable();
6775
storeConfiguration(this.mcpServerConfiguration.toProperties());
76+
mcpEventStream.onNext(new McpEvent(false));
6877
return this.mcpServerConfiguration;
6978
}
7079

extensions/devui/runtime/src/main/java/io/quarkus/devui/runtime/mcp/McpHttpHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.quarkus.devui.runtime.jsonrpc.JsonRpcRequest;
1313
import io.quarkus.devui.runtime.jsonrpc.json.JsonMapper;
1414
import io.quarkus.devui.runtime.mcp.model.InitializeResponse;
15+
import io.quarkus.devui.runtime.spi.McpServerConfiguration;
1516
import io.vertx.core.Handler;
1617
import io.vertx.core.http.HttpMethod;
1718
import io.vertx.ext.web.RoutingContext;

0 commit comments

Comments
 (0)