14
14
import jakarta .enterprise .context .ApplicationScoped ;
15
15
import jakarta .enterprise .inject .Produces ;
16
16
17
+ import io .quarkus .devui .runtime .spi .McpEvent ;
18
+ import io .quarkus .devui .runtime .spi .McpServerConfiguration ;
17
19
import io .smallrye .mutiny .Multi ;
18
20
import io .smallrye .mutiny .operators .multi .processors .BroadcastProcessor ;
19
21
22
24
*/
23
25
@ ApplicationScoped
24
26
public class McpDevUIJsonRpcService {
25
-
26
27
private final BroadcastProcessor <McpClientInfo > connectedClientStream = BroadcastProcessor .create ();
28
+ private final BroadcastProcessor <McpEvent > mcpEventStream = BroadcastProcessor .create ();
27
29
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 ?
29
31
30
32
private final Set <McpClientInfo > connectedClients = new HashSet <>();
31
33
private McpServerConfiguration mcpServerConfiguration ;
@@ -43,7 +45,12 @@ public Set<McpClientInfo> getConnectedClients() {
43
45
}
44
46
45
47
public Multi <McpClientInfo > getConnectedClientStream () {
46
- return connectedClientStream ;
48
+ return this .connectedClientStream ;
49
+ }
50
+
51
+ @ Produces
52
+ public Multi <McpEvent > getEventStream () {
53
+ return this .mcpEventStream ;
47
54
}
48
55
49
56
public void addClientInfo (McpClientInfo clientInfo ) {
@@ -59,12 +66,14 @@ public McpServerConfiguration getMcpServerConfiguration() {
59
66
public McpServerConfiguration enable () {
60
67
this .mcpServerConfiguration .enable ();
61
68
storeConfiguration (this .mcpServerConfiguration .toProperties ());
69
+ mcpEventStream .onNext (new McpEvent (true ));
62
70
return this .mcpServerConfiguration ;
63
71
}
64
72
65
73
public McpServerConfiguration disable () {
66
74
this .mcpServerConfiguration .disable ();
67
75
storeConfiguration (this .mcpServerConfiguration .toProperties ());
76
+ mcpEventStream .onNext (new McpEvent (false ));
68
77
return this .mcpServerConfiguration ;
69
78
}
70
79
0 commit comments