Prerequisites: Node.js 18+, MCP-B Chrome Extension
Quick Setup
1. Install Dependencies
- React
- Vanilla JS
- Script Tag (No Build)
2. Start Your Dev Server
3. Open in Chrome with MCP-B Extension
- Navigate to your local dev server (e.g.,
http://localhost:5173) - Click the MCP-B extension icon
- Check the “Tools” tab to see your registered tools
Development Workflow
React Development
Vanilla JavaScript Development
Hot Reload Support
WebMCP works seamlessly with hot module replacement (HMR):Vite
Tools registered withuseWebMCP() automatically handle HMR - they’ll re-register when your component code changes.
Webpack
For vanilla JS with Webpack HMR:Debugging Tools
Browser DevTools
Access the MCP bridge in the console:MCP-B Extension Inspector
- Click the MCP-B extension icon
- Go to the “Tools” tab
- See all registered tools from your page
- Test tools directly from the inspector
React DevTools
TheuseWebMCP hook exposes execution state:
Testing
Unit Testing Tools
E2E Testing with Playwright
Environment Configuration
Development vs Production
Troubleshooting
Tools not appearing in extension
Tools not appearing in extension
- Ensure
@mcp-b/globalis imported - Check browser console for errors
- Verify extension is installed and enabled
- Refresh the page after starting dev server
- Check extension popup “Tools” tab
Tools not executing
Tools not executing
- Check tool handler for errors
- Verify inputSchema matches arguments
- Ensure async handler returns proper format
- Check browser console for exceptions
React tools registering multiple times
React tools registering multiple times
This is normal in React StrictMode (development only).
useWebMCP() handles this correctly and deduplicates registrations.HMR breaking tool registration
HMR breaking tool registration
Use
useWebMCP() in React - it handles HMR automatically. For vanilla JS, unregister tools in HMR disposal hooks.