Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
example: [vanilla, react]
example: [vanilla, react, rails]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
needs: lint-and-typecheck
strategy:
matrix:
example: [vanilla, react]
example: [vanilla, react, rails]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
14 changes: 13 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Welcome! This document helps you navigate the WebMCP Examples repository efficie
- **Key file**: `react/src/App.tsx` - React component with `useWebMCP` hooks
- **API used**: `useWebMCP()` hook

#### Rails + Stimulus
- **[rails/README.md](./rails/README.md)** - Bookmarks manager using Stimulus controllers
- **Location**: `/rails`
- **Key file**: `rails/app/javascript/controllers/bookmarks_webmcp_controller.ts` - Stimulus controller with WebMCP tools
- **API used**: `navigator.modelContext.registerTool()` in Stimulus

### Legacy Examples (Deprecated - DO NOT USE)
- **[relegated/README.md](./relegated/README.md)** - Old examples using deprecated MCP SDK
- **Warning**: These use the legacy `@modelcontextprotocol/sdk` API
Expand All @@ -40,7 +46,7 @@ Welcome! This document helps you navigate the WebMCP Examples repository efficie

```bash
# Navigate to the example
cd vanilla # or react
cd vanilla # or react, rails

# Install dependencies
pnpm install
Expand All @@ -55,6 +61,7 @@ pnpm dev
2. **Choose the right location**:
- `/vanilla` for pure TypeScript/JavaScript
- `/react` for React-based examples
- `/rails` for Rails with Stimulus examples
3. **Create self-contained directory** with:
- `README.md` - Documentation
- `package.json` - Dependencies
Expand Down Expand Up @@ -152,6 +159,11 @@ example-name/
- Root: `react/src/App.tsx`
- Config: `react/vite.config.ts`

**Rails Example:**
- Entry: `rails/app/javascript/application.ts`
- Controller: `rails/app/javascript/controllers/bookmarks_webmcp_controller.ts`
- Config: `rails/vite.config.ts`

## WebMCP Package Documentation

- **[@mcp-b/global](https://docs.mcp-b.ai/packages/global)** - Core WebMCP polyfill for vanilla JS
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ git clone https://github.com/WebMCP-org/examples.git
cd examples

# Choose an example
cd vanilla # or react
cd vanilla # or react, rails

# Install and run
pnpm install
Expand Down Expand Up @@ -88,6 +88,25 @@ A task management application showcasing React integration with the `useWebMCP()

---

### Rails Example

**Location:** `/rails`

A bookmarks management application demonstrating Rails 7+ integration with Stimulus controllers.

**Features:**
- Uses `navigator.modelContext.registerTool()` with Stimulus controllers
- Follows Rails conventions (`app/javascript/controllers/`)
- Pure business logic separated into `lib/` modules
- Compatible with Vite, importmaps, or esbuild
- 6 AI-callable tools (bookmark CRUD operations + search + stats)

**Tech:** Rails 7+, Stimulus, TypeScript, Vite, `@mcp-b/global`

[→ Documentation](./rails/README.md)

---

### Legacy Examples (Deprecated)

**Location:** `/relegated`
Expand Down Expand Up @@ -204,7 +223,7 @@ WebMCP enables AI assistants to interact with websites through APIs instead of s

```bash
# Development (per example)
cd vanilla # or react
cd vanilla # or react, rails
pnpm dev # Run development server
pnpm build # Build for production
pnpm preview # Preview production build
Expand All @@ -223,6 +242,7 @@ pnpm preview # Preview production build
### Example Documentation
- [Vanilla Example](./vanilla/README.md) - Vanilla JavaScript implementation
- [React Example](./react/README.md) - React with hooks implementation
- [Rails Example](./rails/README.md) - Rails with Stimulus controllers
- [Legacy Examples](./relegated/README.md) - Deprecated implementations

## Tech Stack
Expand Down
28 changes: 28 additions & 0 deletions rails/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Dependencies
node_modules/

# Build output
dist/

# Vite
*.local

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*

# Editor
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store

# Rails specific (for reference when integrating)
/tmp/
/log/
/storage/
Loading