Skip to main content

Full Example

Production-ready Rails example with Stimulus controllers

Quick start

Installation

With importmap (Rails 7+):
With npm/yarn:

The pattern

Use Stimulus connect/disconnect for lifecycle management:

Turbo persistence

Attach controllers to <body> for persistence across Turbo navigations:

Common issues

Include the CSRF token in fetch requests:
Place controllers on <body> so they persist, or handle turbo:load event.
Pin the package: bin/importmap pin @mcp-b/global

Development

Use Chrome DevTools MCP for AI-driven development - your AI can write, discover, and test tools in real-time.