MCPcopy
hub / github.com/nanbingxyz/5ire / MCPServersManagerBridge

Class MCPServersManagerBridge

src/main/bridge/mcp-servers-manager-bridge.ts:5–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import { MCPServersManager } from "@/main/services/mcp-servers-manager";
4
5export class MCPServersManagerBridge extends Bridge.define("mcp-servers-manager", () => {
6 const service = Container.inject(MCPServersManager);
7
8 return {
9 createServer: service.createServer.bind(service),
10 updateServer: service.updateServer.bind(service),
11 deleteServer: service.deleteServer.bind(service),
12 activateServer: service.activateServer.bind(service),
13 deactivateServer: service.deactivateServer.bind(service),
14 liveServers: () => {
15 const abort = new AbortController();
16
17 return new ReadableStream<Awaited<ReturnType<typeof service.liveServers>>["initialResults"]>({
18 cancel: () => {
19 abort.abort();
20 },
21 start: (controller) => {
22 service
23 .liveServers()
24 .then((live) => {
25 if (abort.signal.aborted) {
26 return;
27 }
28
29 live.refresh().catch();
30 controller.enqueue(live.initialResults);
31
32 abort.signal.addEventListener("abort", live.subscribe(controller.enqueue.bind(controller)));
33 })
34 .catch((error) => {
35 controller.error(error);
36 });
37 },
38 });
39 },
40 };
41}) {}

Callers

nothing calls this directly

Calls 5

defineMethod · 0.80
injectMethod · 0.80
liveServersMethod · 0.80
errorMethod · 0.80
abortMethod · 0.65

Tested by

no test coverage detected