File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ get connected(): boolean
140140
141141Whether the client is currently connected to the bridge server.
142142
143+ ``` ts
144+ get connecting (): boolean
145+ ```
146+
147+ Whether the instance is currently attempting to connect to the bridge.
148+
149+ Returns ` true ` during the connection/authentication handshake,
150+ before ` connected ` becomes ` true ` or the connection fails.
151+
143152** Methods:**
144153
145154``` ts
@@ -320,6 +329,15 @@ addStateTools<T>(optionsOrCreated: {
320329 } | CreatedStateTools < T > ): [ToolDefinition , ToolDefinition | ToolDefinition [], () => void ]
321330```
322331
332+ ``` ts
333+ onConnectionStateChange (listener : () => void ): () => void
334+ ```
335+
336+ Subscribe to connection state changes.
337+
338+ The listener is called whenever ` connected ` or ` connecting ` changes.
339+ Returns an unsubscribe function.
340+
323341``` ts
324342disconnect (): void
325343```
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ mcpWeb: MCPWeb
1414
1515The MCPWeb instance for registering tools and making queries.
1616
17+ ``` ts
18+ isConnecting : boolean
19+ ```
20+
21+ Whether the MCPWeb instance is currently attempting to connect.
22+
1723``` ts
1824isConnected : boolean
1925```
@@ -117,6 +123,9 @@ Internal hook for managing MCPWeb connection lifecycle.
117123Connects on mount and disconnects on unmount.
118124Returns reactive connection state for triggering re-renders.
119125
126+ Subscribes to MCPWeb's connection state changes so that reconnection
127+ attempts (e.g. after a WebSocket drop) are reflected in React state.
128+
120129Handles React StrictMode's double-mount behavior by using a ref to track
121130whether we should actually disconnect on cleanup.
122131
Original file line number Diff line number Diff line change @@ -140,6 +140,15 @@ get connected(): boolean
140140
141141Whether the client is currently connected to the bridge server.
142142
143+ ``` ts
144+ get connecting (): boolean
145+ ```
146+
147+ Whether the instance is currently attempting to connect to the bridge.
148+
149+ Returns ` true ` during the connection/authentication handshake,
150+ before ` connected ` becomes ` true ` or the connection fails.
151+
143152** Methods:**
144153
145154``` ts
@@ -320,6 +329,15 @@ addStateTools<T>(optionsOrCreated: {
320329 } | CreatedStateTools < T > ): [ToolDefinition , ToolDefinition | ToolDefinition [], () => void ]
321330```
322331
332+ ``` ts
333+ onConnectionStateChange (listener : () => void ): () => void
334+ ```
335+
336+ Subscribe to connection state changes.
337+
338+ The listener is called whenever ` connected ` or ` connecting ` changes.
339+ Returns an unsubscribe function.
340+
323341``` ts
324342disconnect (): void
325343```
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ mcpWeb: MCPWeb
1414
1515The MCPWeb instance for registering tools and making queries.
1616
17+ ``` ts
18+ isConnecting : boolean
19+ ```
20+
21+ Whether the MCPWeb instance is currently attempting to connect.
22+
1723``` ts
1824isConnected : boolean
1925```
@@ -117,6 +123,9 @@ Internal hook for managing MCPWeb connection lifecycle.
117123Connects on mount and disconnects on unmount.
118124Returns reactive connection state for triggering re-renders.
119125
126+ Subscribes to MCPWeb's connection state changes so that reconnection
127+ attempts (e.g. after a WebSocket drop) are reflected in React state.
128+
120129Handles React StrictMode's double-mount behavior by using a ref to track
121130whether we should actually disconnect on cleanup.
122131
You can’t perform that action at this time.
0 commit comments