Auto-Mounting with mcp-use
When usingmcp-use to create your MCP server, the inspector is automatically available at /inspector.
Example
The inspector is automatically mounted when using
mcp-use/server. No additional configuration needed.Manual Integration
Express Integration
Mount the inspector on an Express application:Hono Integration
Mount the inspector on a Hono application:Path Customization
The inspector is mounted at/inspector by default. To use a different path, you can use a path prefix with your framework:
Express with Custom Path
Hono with Custom Path
Configuration Options
mountInspector Options
The mountInspector function accepts an optional configuration object:
| Option | Type | Default | Description |
|---|---|---|---|
autoConnectUrl | string | null | undefined | MCP server URL to auto-connect on load |
devMode | boolean | true if not production | Enables same-origin sandbox for MCP Apps widgets (no subdomain required) |
sandboxOrigin | string | null | undefined | Override the sandbox origin for MCP Apps widgets |
devMode
When devMode is true, the inspector uses same-origin for the MCP Apps widget sandbox instead of requiring a sandbox-{hostname} subdomain. This is essential when running behind reverse proxies (ngrok, E2B, Cloudflare tunnels) where that subdomain does not exist.
When using mcp-use/server, devMode is automatically set to true in development and false in production.
sandboxOrigin
Override the sandbox origin used for MCP Apps widget iframes. Use this when you have a specific domain configured for sandboxed content in production.
Embeddable Chat Components
The inspector also exports client-side chat UI components from@mcp-use/inspector/client for embedding into your own React app.
ChatTab Quick Start
Use ChatTab when you want the full chat experience with the smallest integration surface.
ChatTab Customization Props
| Prop | Type | Description |
|---|---|---|
hideTitle | boolean | Hides the chat header title (Chat) |
hideModelBadge | boolean | Hides the selected model badge in the landing state |
hideServerUrl | boolean | Hides the MCP server URL shown in the landing state |
clearButtonLabel | string | Custom label for the clear/new-chat button |
clearButtonHideIcon | boolean | Hides the clear/new-chat button icon |
clearButtonHideShortcut | boolean | Hides the keyboard shortcut hint on the clear/new-chat button |
clearButtonVariant | "default" | "secondary" | "ghost" | "outline" | Visual button variant for the clear/new-chat button |
Advanced Composition (MessageList / ChatHeader / ChatLandingForm)
For custom layouts, compose lower-level exports from @mcp-use/inspector/client.
When using MessageList, pass serverBaseUrl from your MCP connection URL so widget resource rendering uses the correct server origin:
Environment Detection
The inspector automatically detects the framework:- Express: Detects Express app instance
- Hono: Detects Hono app instance
- Auto-detection: Works with both frameworks
Client Files
The inspector includes built client files. If files are missing, you’ll see a warning:Best Practices
Development vs Production
Development:- Mount inspector directly in development
- Use default
/inspectorpath - Enable hot reload for inspector UI
- Consider mounting only in staging environments
- Use custom paths for security
- Restrict access with authentication middleware
Security Considerations
Example with Authentication
Multiple MCP Servers
When mounting the inspector, it can connect to multiple MCP servers:- Mount inspector once on your main application
- Connect to different MCP servers from the inspector UI
- Each server appears as a separate connection
CORS Configuration
If your MCP server is on a different origin, configure CORS:Reverse Proxy Support
The inspector and MCP Apps widgets work behind reverse proxies such as ngrok, E2B sandboxes, and Cloudflare tunnels. To set this up:- Set
MCP_URLto the public-facing URL of your server. This ensures widget asset URLs and Vite HMR WebSocket connections route correctly through the proxy.
-
devModeis enabled automatically in development, so MCP Apps widgets use same-origin sandboxing (nosandbox-{hostname}subdomain required). - Vite HMR works through the proxy — a WebSocket proxy forwards HMR connections from the main HTTP server to Vite’s internal port automatically.
MCP_URL.
Widget Server URL
Widgets rendered via MCP Apps have access to awindow.__mcpServerUrl global variable containing the server’s origin URL. Use this to construct API URLs dynamically instead of hardcoding localhost:
Embedding Widget Iframes
If you need to embed inspector widgets in iframes from your own application (e.g., embedding widgets in your dashboard or admin panel), you can configure allowed origins using theMCP_INSPECTOR_FRAME_ANCESTORS environment variable.
By default, the inspector uses:
- Development mode (when
devServerBaseUrlis detected):frame-ancestors *(allows all origins) - Production mode:
frame-ancestors 'self'(same-origin only)
Troubleshooting
Inspector Not Loading
Issue: Inspector page shows blank or errors. Solutions:- Check that client files are built:
yarn buildin inspector package - Verify the mount path is correct
- Check browser console for errors
- Ensure no route conflicts with
/inspector
Route Conflicts
Issue: Your routes conflict with inspector paths. Solution: Use a custom path or ensure your routes don’t overlap with/inspector/*.
Build Errors
Issue: Inspector fails to mount with build errors. Solutions:- Ensure
@mcp-use/inspectoris properly installed - Check Node.js version compatibility
- Verify all dependencies are installed
- Rebuild the inspector package
Related Documentation
- Getting Started - Basic inspector usage
- CLI Usage - Standalone inspector usage
- Self-Hosting - Docker deployment