@mcp-fe/mcp-worker 0.0.16 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -188,7 +188,7 @@
188
188
  same page as the copyright notice for easier identification within
189
189
  third-party archives.
190
190
 
191
- Copyright 2026 [name of copyright owner]
191
+ Copyright 2026 Michal Kopecky
192
192
 
193
193
  Licensed under the Apache License, Version 2.0 (the "License");
194
194
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,479 +1,314 @@
1
1
  # @mcp-fe/mcp-worker
2
2
 
3
- The core package of the MCP-FE (Model Context Protocol - Frontend Edge) ecosystem. This library provides a browser-based MCP server implementation using Web Workers, enabling AI agents to query real-time frontend application state and user interaction data.
3
+ Browser-based MCP server running in Web Workers. Connect AI agents directly to your frontend application state.
4
4
 
5
- ## Overview
5
+ ## What is MCP-FE Worker?
6
6
 
7
- `@mcp-fe/mcp-worker` turns your browser into an active, queryable MCP node by running MCP server endpoints in a Web Worker. It bridges the gap between AI agents and the live state of your frontend application, making runtime data accessible through standard MCP tools.
7
+ `@mcp-fe/mcp-worker` turns your browser into a queryable MCP server. It allows AI agents (like Claude) to:
8
8
 
9
- ### Key Features
9
+ - 🔍 Query user interactions in real-time
10
+ - 📊 Access application state directly
11
+ - 🎯 Register custom tools dynamically
12
+ - 💾 Store and retrieve events from IndexedDB
10
13
 
11
- - **Browser-based MCP Server**: Full MCP server implementation running in Web Workers
12
- - **Dual Worker Support**: Uses SharedWorker (preferred) with ServiceWorker fallback
13
- - **IndexedDB Storage**: Persistent storage for user events and application state
14
- - **WebSocket Transport**: Real-time connection to MCP proxy servers
15
- - **Zero Backend Dependencies**: Runs entirely in the browser
16
- - **Authentication Support**: Built-in token-based authentication
17
- - **Connection Management**: Automatic reconnection and status monitoring
14
+ The MCP server runs in a Web Worker in your browser, requiring an MCP proxy server to bridge communication with AI agents.
18
15
 
19
- ## Architecture
20
-
21
- The package implements a **Worker-as-MCP-Edge-Server** pattern:
22
-
23
- ```
24
- Frontend App ←→ WorkerClient ←→ Web Worker (MCP Server) ←→ WebSocket ←→ MCP Proxy ←→ AI Agent
25
- ```
16
+ ## Key Concepts
26
17
 
27
- 1. **Frontend App**: Uses `workerClient` to send events and queries
28
- 2. **WorkerClient**: Manages worker lifecycle and provides clean API
29
- 3. **Web Worker**: Implements MCP server endpoints, stores data in IndexedDB
30
- 4. **WebSocket**: Maintains persistent connection to MCP proxy server
31
- 5. **MCP Proxy**: Bridges browser worker with external AI agents
32
- 6. **AI Agent**: Queries frontend state using standard MCP tools
18
+ ### MCP Server in Browser
33
19
 
34
- ## Installation
20
+ This library runs an **MCP server in your browser** using Web Workers, exposing frontend application context to AI agents. This enables AI agents to query live browser state (DOM, localStorage, React state, etc.) through the standard MCP protocol.
35
21
 
36
- ```bash
37
- npm install @mcp-fe/mcp-worker
38
- # or
39
- pnpm add @mcp-fe/mcp-worker
40
- # or
41
- yarn add @mcp-fe/mcp-worker
42
- ```
22
+ The key advantage is **making frontend context accessible** to AI agents without custom backend code for each use case.
43
23
 
44
- ## Quick Start
24
+ ### Dual Worker Strategy
45
25
 
46
- ### 1. Copy Worker Files to Public Directory
26
+ The library uses **SharedWorker** (preferred) or **ServiceWorker** (fallback):
47
27
 
48
- The package exports pre-built worker scripts that must be accessible from your web server:
28
+ - **SharedWorker**: Single instance shared across tabs, persistent connection
29
+ - **ServiceWorker**: Universal browser support, automatic fallback
49
30
 
50
- ```bash
51
- # Copy worker files to your public directory
52
- cp node_modules/@mcp-fe/mcp-worker/mcp-shared-worker.js public/
53
- cp node_modules/@mcp-fe/mcp-worker/mcp-service-worker.js public/
54
- ```
31
+ ### Dynamic Tool Registration
55
32
 
56
- For build tools like Vite, Webpack, or Nx, you can configure them to copy these files automatically:
33
+ Register custom MCP tools at runtime with **handlers running in the main thread**:
57
34
 
58
- **Vite example:**
59
35
  ```typescript
60
- // vite.config.ts
61
- import { defineConfig } from 'vite';
62
-
63
- export default defineConfig({
64
- // ... other config
65
- publicDir: 'public',
66
- build: {
67
- rollupOptions: {
68
- // Copy worker files during build
69
- external: ['@mcp-fe/mcp-worker/mcp-*.js']
70
- }
36
+ await workerClient.registerTool(
37
+ 'get_user_data',
38
+ 'Get current user information',
39
+ { type: 'object', properties: {} },
40
+ async () => {
41
+ const user = getCurrentUser(); // Full browser access!
42
+ return {
43
+ content: [{ type: 'text', text: JSON.stringify(user) }]
44
+ };
71
45
  }
72
- });
46
+ );
73
47
  ```
74
48
 
75
- ### 2. Initialize in Your Application
76
-
77
- ```typescript
78
- import { workerClient } from '@mcp-fe/mcp-worker';
49
+ Handlers have full access to:
50
+ - ✅ React context, hooks, state
51
+ - ✅ DOM API, localStorage
52
+ - All imports and dependencies
53
+ - ✅ Closures and external variables
79
54
 
80
- // Initialize the worker client
81
- async function initMCP() {
82
- try {
83
- await workerClient.init({
84
- sharedWorkerUrl: '/mcp-shared-worker.js', // optional, default value
85
- serviceWorkerUrl: '/mcp-service-worker.js', // optional, default value
86
- backendWsUrl: 'ws://localhost:3001' // your MCP proxy server
87
- });
88
-
89
- console.log('MCP Worker initialized successfully');
90
- } catch (error) {
91
- console.error('Failed to initialize MCP Worker:', error);
92
- }
93
- }
55
+ ## Architecture
94
56
 
95
- // Call during app startup
96
- initMCP();
97
57
  ```
98
-
99
- ### 3. Set Authentication Token (Optional)
100
-
101
- ```typescript
102
- // Set authentication token for user-specific data
103
- workerClient.setAuthToken('Bearer your-jwt-token-here');
104
-
105
- // Or queue the token before initialization
106
- workerClient.setAuthToken('Bearer token');
107
- await workerClient.init(/* options */);
58
+ Frontend App ←→ WorkerClient ←→ Web Worker ←→ WebSocket ←→ MCP Proxy ←→ AI Agent
59
+
60
+ IndexedDB
108
61
  ```
109
62
 
110
- ## API Reference
63
+ 1. **Frontend App** - Your application
64
+ 2. **WorkerClient** - Simple API for worker communication
65
+ 3. **Web Worker** - MCP server running in background
66
+ 4. **WebSocket** - Real-time connection to proxy
67
+ 5. **MCP Proxy** - Bridges browser with AI agents
68
+ 6. **AI Agent** - Queries your app via MCP protocol
111
69
 
112
- ### WorkerClient
70
+ ## Quick Start
113
71
 
114
- The main singleton instance for communicating with the MCP worker.
72
+ ### Installation
115
73
 
116
- #### `workerClient.init(options?)`
74
+ ```bash
75
+ npm install @mcp-fe/mcp-worker
76
+ # or
77
+ pnpm add @mcp-fe/mcp-worker
78
+ ```
117
79
 
118
- Initializes the worker client with optional configuration.
80
+ ### 1. Setup Worker Files
119
81
 
120
- **Parameters:**
121
- - `options?: WorkerClientInitOptions | ServiceWorkerRegistration`
82
+ Copy worker scripts to your public directory:
122
83
 
123
- **WorkerClientInitOptions:**
124
- ```typescript
125
- interface WorkerClientInitOptions {
126
- sharedWorkerUrl?: string; // Default: '/mcp-shared-worker.js'
127
- serviceWorkerUrl?: string; // Default: '/mcp-service-worker.js'
128
- backendWsUrl?: string; // Default: 'ws://localhost:3001'
129
- }
84
+ ```bash
85
+ cp node_modules/@mcp-fe/mcp-worker/mcp-shared-worker.js public/
86
+ cp node_modules/@mcp-fe/mcp-worker/mcp-service-worker.js public/
130
87
  ```
131
88
 
132
- **Examples:**
89
+ ### 2. Initialize
90
+
133
91
  ```typescript
134
- // Basic initialization with defaults
135
- await workerClient.init();
92
+ import { workerClient } from '@mcp-fe/mcp-worker';
136
93
 
137
- // Custom configuration
138
94
  await workerClient.init({
139
- backendWsUrl: 'wss://my-mcp-proxy.com/ws',
140
- sharedWorkerUrl: '/workers/mcp-shared-worker.js'
95
+ backendWsUrl: 'ws://localhost:3001' // Your MCP proxy URL
141
96
  });
142
-
143
- // Use existing ServiceWorker registration
144
- const registration = await navigator.serviceWorker.register('/mcp-service-worker.js');
145
- await workerClient.init(registration);
146
97
  ```
147
98
 
148
- #### `workerClient.post(type, payload?)`
99
+ ### 3. Store Events
149
100
 
150
- Send a fire-and-forget message to the worker.
151
-
152
- **Parameters:**
153
- - `type: string` - Message type
154
- - `payload?: Record<string, unknown>` - Message payload
155
-
156
- **Example:**
157
101
  ```typescript
158
- // Store a user event
159
102
  await workerClient.post('STORE_EVENT', {
160
103
  event: {
161
104
  type: 'click',
162
105
  element: 'button',
163
- elementText: 'Submit Form',
164
- path: '/checkout',
106
+ elementText: 'Submit',
165
107
  timestamp: Date.now()
166
108
  }
167
109
  });
168
110
  ```
169
111
 
170
- #### `workerClient.request(type, payload?, timeoutMs?)`
171
-
172
- Send a request expecting a response via MessageChannel.
173
-
174
- **Parameters:**
175
- - `type: string` - Request type
176
- - `payload?: Record<string, unknown>` - Request payload
177
- - `timeoutMs?: number` - Timeout in milliseconds (default: 5000)
178
-
179
- **Returns:** `Promise<T>` - Response data
180
-
181
- **Example:**
182
- ```typescript
183
- // Get stored events
184
- const response = await workerClient.request('GET_EVENTS', {
185
- type: 'click',
186
- limit: 10
187
- });
188
-
189
- console.log('Recent clicks:', response.events);
190
- ```
191
-
192
- #### `workerClient.setAuthToken(token)`
193
-
194
- Set authentication token for the current session.
195
-
196
- **Parameters:**
197
- - `token: string` - Authentication token (e.g., JWT)
198
-
199
- **Example:**
200
- ```typescript
201
- // Set token after user login
202
- workerClient.setAuthToken('Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6...');
203
-
204
- // Clear token on logout
205
- workerClient.setAuthToken('');
206
- ```
207
-
208
- #### `workerClient.getConnectionStatus()`
209
-
210
- Get current connection status to the MCP proxy server.
211
-
212
- **Returns:** `Promise<boolean>` - Connection status
112
+ ### 4. Register Custom Tools
213
113
 
214
- **Example:**
215
114
  ```typescript
216
- const isConnected = await workerClient.getConnectionStatus();
217
- console.log('MCP connection:', isConnected ? 'Connected' : 'Disconnected');
115
+ await workerClient.registerTool(
116
+ 'get_todos',
117
+ 'Get all todos',
118
+ { type: 'object', properties: {} },
119
+ async () => ({
120
+ content: [{ type: 'text', text: JSON.stringify(todos) }]
121
+ })
122
+ );
218
123
  ```
219
124
 
220
- #### Connection Status Events
125
+ **That's it!** AI agents can now query your app via MCP protocol.
221
126
 
222
- Subscribe to connection status changes:
127
+ ## Documentation
223
128
 
224
- ```typescript
225
- // Listen for connection changes
226
- const handleConnectionChange = (connected: boolean) => {
227
- console.log('Connection status changed:', connected);
228
- };
229
-
230
- workerClient.onConnectionStatus(handleConnectionChange);
231
-
232
- // Stop listening
233
- workerClient.offConnectionStatus(handleConnectionChange);
234
- ```
129
+ ### Core Documentation
235
130
 
236
- ## Worker Implementation Details
131
+ - **[Quick Start Guide](./docs/guide.md)** - Complete guide to dynamic tool registration
132
+ - **[API Reference](./docs/api.md)** - Full API documentation
133
+ - **[Worker Details](./docs/worker-details.md)** - Implementation details
134
+ - **[Architecture](./docs/architecture.md)** - How the proxy pattern works
135
+ - **[Initialization](./docs/initialization.md)** - Init queue handling
237
136
 
238
- ### SharedWorker vs ServiceWorker
137
+ ### Examples
239
138
 
240
- **SharedWorker (Preferred):**
241
- - Single instance shared across all browser windows/tabs on the same origin
242
- - Maintains persistent WebSocket connection even when tabs are closed
243
- - Better for multi-tab applications
244
- - Supported in Chrome, Firefox, and Safari
139
+ - **[Quick Start Examples](./examples/quick-start.ts)** - 4 simple examples
140
+ - **[Advanced Examples](./examples/dynamic-tools.ts)** - Validation, async, error handling
141
+ - **[Examples Guide](./examples/README.md)** - How to use examples
245
142
 
246
- **ServiceWorker (Fallback):**
247
- - Runs in background with browser-managed lifecycle
248
- - Automatic fallback when SharedWorker is unavailable
249
- - Handles offline scenarios and background sync
250
- - Universal browser support
143
+ ### React Integration
251
144
 
252
- The `WorkerClient` automatically chooses the best available option.
145
+ - **[React Hooks Guide](../react-event-tracker/REACT_MCP_TOOLS.md)** - React integration
146
+ - **[React Examples](../react-event-tracker/src/examples/ReactMCPToolsExamples.tsx)** - Component examples
253
147
 
254
- ### Data Storage
148
+ ## Common Use Cases
255
149
 
256
- Events are stored in IndexedDB with the following schema:
150
+ ### Track User Interactions
257
151
 
258
152
  ```typescript
259
- interface UserEvent {
260
- id: string;
261
- type: 'navigation' | 'click' | 'input' | 'custom';
262
- timestamp: number;
263
- path?: string;
264
- from?: string; // navigation: previous route
265
- to?: string; // navigation: current route
266
- element?: string; // interaction: element tag
267
- elementId?: string; // interaction: element ID
268
- elementClass?: string; // interaction: element classes
269
- elementText?: string; // interaction: element text content
270
- metadata?: Record<string, unknown>;
271
- }
153
+ // Clicks, navigation, form inputs
154
+ await workerClient.post('STORE_EVENT', {
155
+ event: { type: 'click', element: 'button', ... }
156
+ });
272
157
  ```
273
158
 
274
- ### MCP Tools Exposed
275
-
276
- The worker exposes these MCP tools to AI agents:
277
-
278
- - `get_user_events` - Query stored user interaction events
279
- - `get_connection_status` - Check WebSocket connection status
280
- - `get_session_info` - Get current session information
281
-
282
- ## Advanced Usage
283
-
284
- ### Custom Event Storage
159
+ ### Expose Application State
285
160
 
286
161
  ```typescript
287
- // Store custom business events
288
- await workerClient.post('STORE_EVENT', {
289
- event: {
290
- type: 'custom',
291
- timestamp: Date.now(),
292
- metadata: {
293
- eventName: 'purchase_completed',
294
- orderId: '12345',
295
- amount: 99.99,
296
- currency: 'USD'
297
- }
298
- }
299
- });
162
+ await workerClient.registerTool('get_cart', 'Get shopping cart', ...,
163
+ async () => ({ content: [{ type: 'text', text: JSON.stringify(cart) }] })
164
+ );
300
165
  ```
301
166
 
302
- ### Querying Specific Events
167
+ ### Query Stored Events
303
168
 
304
169
  ```typescript
305
- // Get navigation events from the last hour
306
- const response = await workerClient.request('GET_EVENTS', {
170
+ const events = await workerClient.request('GET_EVENTS', {
307
171
  type: 'navigation',
308
- startTime: Date.now() - (60 * 60 * 1000),
309
172
  limit: 50
310
173
  });
311
-
312
- // Get clicks on specific elements
313
- const clicks = await workerClient.request('GET_EVENTS', {
314
- type: 'click',
315
- path: '/checkout',
316
- limit: 20
317
- });
318
174
  ```
319
175
 
320
- ### Error Handling
176
+ ### Monitor Connection Status
321
177
 
322
178
  ```typescript
323
- try {
324
- await workerClient.init();
325
- } catch (error) {
326
- if (error.message.includes('SharedWorker')) {
327
- console.log('SharedWorker not supported, falling back to ServiceWorker');
328
- } else {
329
- console.error('Worker initialization failed:', error);
330
- }
331
- }
332
-
333
- // Handle request timeouts
334
- try {
335
- const data = await workerClient.request('GET_EVENTS', {}, 2000); // 2s timeout
336
- } catch (error) {
337
- if (error.message.includes('timeout')) {
338
- console.log('Request timed out, worker may be busy');
339
- }
340
- }
341
- ```
342
-
343
- ## Integration with Higher-Level Libraries
344
-
345
- This package is designed to be used with higher-level integration libraries:
346
-
347
- - **[@mcp-fe/event-tracker](../event-tracker/README.md)**: Framework-agnostic event tracking
348
- - **[@mcp-fe/react-event-tracker](../react-event-tracker/README.md)**: React-specific hooks and components
349
-
350
- **Example with event-tracker:**
351
- ```typescript
352
- import { initEventTracker, trackEvent } from '@mcp-fe/event-tracker';
353
-
354
- // Initialize (uses @mcp-fe/mcp-worker internally)
355
- await initEventTracker({
356
- backendWsUrl: 'ws://localhost:3001'
357
- });
358
-
359
- // Track events (stored via mcp-worker)
360
- await trackEvent({
361
- type: 'click',
362
- element: 'button',
363
- elementText: 'Save Changes'
179
+ const connected = await workerClient.getConnectionStatus();
180
+ workerClient.onConnectionStatus((connected) => {
181
+ console.log('MCP connection:', connected);
364
182
  });
365
183
  ```
366
184
 
367
- ## Setting Up MCP Proxy Server
368
-
369
- The worker connects to an MCP proxy server that bridges browser workers with AI agents. You need a Node.js MCP proxy running to use this package effectively.
185
+ ## MCP Proxy Server
370
186
 
371
- ### Using the Official Docker Image
187
+ The worker connects to an MCP proxy server that bridges browser with AI agents.
372
188
 
373
- The easiest way to run the MCP proxy server is using the official Docker image:
189
+ ### Using Docker (Recommended)
374
190
 
375
191
  ```bash
376
- # Pull and run the MCP proxy server
377
192
  docker pull ghcr.io/mcp-fe/mcp-fe/mcp-server:main
378
193
  docker run -p 3001:3001 ghcr.io/mcp-fe/mcp-fe/mcp-server:main
379
194
  ```
380
195
 
381
- The server will be available at `ws://localhost:3001` for your frontend applications.
196
+ Server available at `ws://localhost:3001`
382
197
 
198
+ ### Development
383
199
 
384
- **With Environment Variables:**
385
200
  ```bash
386
- docker run -p 3001:3001 \
387
- -e NODE_ENV=production \
388
- -e PORT=3001 \
389
- ghcr.io/mcp-fe/mcp-fe/mcp-server:main
201
+ git clone https://github.com/mcp-fe/mcp-fe.git
202
+ cd mcp-fe
203
+ pnpm install
204
+ nx serve mcp-server
390
205
  ```
391
206
 
392
- ### Development Setup
207
+ See [mcp-server docs](../../apps/mcp-server/README.md) for complete setup.
393
208
 
394
- For development, you can run the proxy server from source:
209
+ ## Features
395
210
 
396
- ```bash
397
- # Clone the MCP-FE repository
398
- git clone https://github.com/mcp-fe/mcp-fe.git
399
- cd mcp-fe
211
+ ### Dynamic Tool Registration
400
212
 
401
- # Install dependencies
402
- pnpm install
213
+ Register custom MCP tools at runtime:
403
214
 
404
- # Start the MCP proxy server
405
- nx serve mcp-server
215
+ ```typescript
216
+ await workerClient.registerTool(
217
+ 'get_user_data',
218
+ 'Get current user information',
219
+ { type: 'object', properties: {} },
220
+ async () => {
221
+ const user = getCurrentUser(); // Full browser access!
222
+ return {
223
+ content: [{
224
+ type: 'text',
225
+ text: JSON.stringify(user)
226
+ }]
227
+ };
228
+ }
229
+ );
230
+ ```
231
+
232
+ **Learn more:**
233
+ - [Guide](./docs/guide.md) - Complete step-by-step guide
234
+ - [Quick Start Examples](./examples/quick-start.ts) - Ready-to-use examples
235
+ - [Advanced Examples](./examples/dynamic-tools.ts) - Validation, async, error handling
236
+ - [React Integration](../react-event-tracker/REACT_MCP_TOOLS.md) - React hooks
237
+
238
+ ### Event Storage
239
+
240
+ Store and query user interactions:
241
+
242
+ ```typescript
243
+ // Store event
244
+ await workerClient.post('STORE_EVENT', {
245
+ event: { type: 'click', element: 'button', ... }
246
+ });
247
+
248
+ // Query events
249
+ const events = await workerClient.request('GET_EVENTS', {
250
+ type: 'click',
251
+ limit: 10
252
+ });
406
253
  ```
407
254
 
408
- The proxy server handles:
409
- - WebSocket connections from browser workers
410
- - MCP protocol message routing
411
- - Tool call forwarding between AI agents and frontend applications
412
- - Connection management and error handling
255
+ ### Connection Management
413
256
 
414
- See the [mcp-server documentation](../../apps/mcp-server/README.md) and main [MCP-FE documentation](../../README.md) for complete proxy server setup and configuration options.
257
+ Monitor MCP proxy connection:
258
+
259
+ ```typescript
260
+ const connected = await workerClient.getConnectionStatus();
261
+ workerClient.onConnectionStatus((connected) => {
262
+ console.log('Status:', connected);
263
+ });
264
+ ```
415
265
 
416
266
  ## Browser Compatibility
417
267
 
418
- - **Chrome/Chromium**: Full support (SharedWorker + ServiceWorker)
419
- - **Firefox**: Full support (SharedWorker + ServiceWorker)
420
- - **Safari**: SharedWorker support, ServiceWorker fallback
421
- - **Edge**: Full support (Chromium-based)
268
+ - **Chrome/Chromium 80+** - Full support
269
+ - **Firefox 78+** - Full support
270
+ - **Safari 16.4+** - Full support
271
+ - **Edge 80+** - Full support (Chromium-based)
422
272
 
423
- **Minimum Requirements:**
424
- - ES2020+ support
425
- - WebWorker support
426
- - IndexedDB support
427
- - WebSocket support (for MCP proxy connection)
273
+ **Requirements:** ES2020+, WebWorker, IndexedDB, WebSocket
428
274
 
429
- ## Troubleshooting
275
+ See [Worker Details](./docs/worker-details.md) for more information.
430
276
 
431
- ### Worker Files Not Found (404)
277
+ ## Troubleshooting
432
278
 
433
- **Problem**: `Failed to load worker script` errors
279
+ ### Worker files not found (404)
434
280
 
435
- **Solution**:
436
- 1. Ensure worker files are copied to your public directory
437
- 2. Verify the URLs match your server configuration
438
- 3. Check browser Network tab for 404 errors
281
+ Ensure worker files are in your public directory and paths match:
439
282
 
440
283
  ```typescript
441
- // Custom paths if needed
442
284
  await workerClient.init({
443
- sharedWorkerUrl: '/assets/workers/mcp-shared-worker.js',
444
- serviceWorkerUrl: '/assets/workers/mcp-service-worker.js'
285
+ sharedWorkerUrl: '/path/to/mcp-shared-worker.js',
286
+ serviceWorkerUrl: '/path/to/mcp-service-worker.js'
445
287
  });
446
288
  ```
447
289
 
448
- ### Connection Issues
449
-
450
- **Problem**: `getConnectionStatus()` returns `false`
451
-
452
- **Solution**:
453
- 1. Verify MCP proxy server is running on the specified URL
454
- 2. Check WebSocket connection in browser Developer Tools
455
- 3. Verify CORS settings if proxy is on different origin
290
+ ### Connection issues
456
291
 
457
- ### SharedWorker Not Working
292
+ 1. Verify MCP proxy server is running
293
+ 2. Check WebSocket connection in DevTools Network tab
294
+ 3. Verify CORS settings if on different origin
458
295
 
459
- **Problem**: Falls back to ServiceWorker unexpectedly
296
+ ### SharedWorker not available
460
297
 
461
- **Solution**:
462
- 1. SharedWorker requires HTTPS in production
463
- 2. Some browsers disable SharedWorker in private/incognito mode
464
- 3. Enterprise browser policies may block SharedWorker
298
+ SharedWorker requires HTTPS in production and may be blocked in incognito mode. The library automatically falls back to ServiceWorker.
465
299
 
300
+ **For more help:** See [Worker Details](./docs/worker-details.md#troubleshooting)
466
301
 
467
302
  ## Related Packages
468
303
 
469
- - **[Main MCP-FE Project](../../README.md)**: Complete documentation and examples
470
- - **[@mcp-fe/event-tracker](../event-tracker/README.md)**: Framework-agnostic event tracking API
471
- - **[@mcp-fe/react-event-tracker](../react-event-tracker/README.md)**: React integration hooks
304
+ - [Main MCP-FE Project](../../README.md) - Complete documentation
305
+ - [@mcp-fe/event-tracker](../event-tracker/README.md) - Framework-agnostic event tracking
306
+ - [@mcp-fe/react-event-tracker](../react-event-tracker/README.md) - React integration hooks
472
307
 
473
308
  ## License
474
309
 
475
- Licensed under the Apache License, Version 2.0. See the [LICENSE](../../LICENSE) file for details.
310
+ Licensed under the Apache License, Version 2.0. See [LICENSE](../../LICENSE) for details.
476
311
 
477
312
  ---
478
313
 
479
- **Note**: This package is the foundational layer of the MCP-FE ecosystem. For most applications, consider using the higher-level integration packages like `@mcp-fe/react-event-tracker` which provide a more convenient API.
314
+ **For most applications, consider using [@mcp-fe/react-event-tracker](../react-event-tracker/README.md) for a more convenient React-focused API.**