Skip to content

Add Svelte 5 runes WebMCP example with note-taking app#13

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/sub-pr-12
Draft

Add Svelte 5 runes WebMCP example with note-taking app#13
Copilot wants to merge 3 commits intomainfrom
copilot/sub-pr-12

Conversation

Copy link

Copilot AI commented Dec 6, 2025

Description

New example demonstrating WebMCP integration in Svelte 5 using modern runes API. Implements a note-taking application with 6 AI-callable tools showcasing reactive state management with Svelte's fine-grained reactivity primitives.

Type of Change

  • New example
  • Bug fix in existing example
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Dependency update

Related Issues

N/A

Changes Made

  • Created /svelte directory with Svelte 5 example application
  • Implemented note-taking app with reactive state using $state and $derived runes
  • Registered 6 WebMCP tools: add_note, delete_note, list_notes, search_notes, toggle_pin_note, get_note_stats
  • Added comprehensive README with Svelte-specific patterns and concepts
  • Configured TypeScript strict mode and Vite build pipeline

New Example Details

  • Example name: Svelte 5 Runes Notes
  • Framework: Svelte 5 with runes API
  • WebMCP concepts demonstrated:
    • Tool registration with @mcp-b/global
    • Reactive state management with Svelte runes
    • Component-based tool registration pattern
    • Automatic cleanup on unmount
  • Tools registered: add_note, delete_note, list_notes, search_notes, toggle_pin_note, get_note_stats
  • Dependencies added: svelte@^5.16.0, @mcp-b/global@^1.0.9, vite@^6.0.3, @sveltejs/vite-plugin-svelte@^5.0.3

Testing

Commands Run

cd svelte
pnpm install     # ✓ Installed successfully
pnpm typecheck   # ✓ Passed
pnpm lint        # ✓ Passed (no linter configured)
pnpm build       # ✓ Passed
pnpm dev         # ✓ Runs without errors

Manual Testing with MCP-B Extension

  • Extension detects the page
  • All registered tools appear in extension
  • Each tool executes successfully
  • UI updates correctly after tool execution
  • Error cases handled gracefully
  • Tested in Chrome/Edge
  • Tested on mobile (if applicable)

Screenshot/Demo

Tools demonstrate Svelte's reactive state management - notes list updates automatically when tools modify state through runes.

Checklist

  • My code follows the style guidelines in CONTRIBUTING.md
  • I have used the modern WebMCP API (@mcp-b/global or @mcp-b/react-webmcp)
  • I have NOT used deprecated APIs from /relegated
  • I have performed a self-review of my own code
  • I have added JSDoc comments to all exported functions/components
  • I have created/updated README.md for the example
  • My changes generate no TypeScript errors
  • I have tested with the MCP-B Chrome Extension
  • All tools register and execute successfully
  • Example runs without console errors

Documentation

  • README.md includes clear description of what the example demonstrates
  • README.md has installation and usage instructions
  • README.md explains WebMCP concepts used
  • Code has explanatory comments for WebMCP-specific code
  • Dependencies are documented in package.json

Additional Notes

Key pattern demonstrated:

// WebMCPTools.svelte - Component-scoped tool registration
let notes = $state<Note[]>([]);

onMount(() => {
  const cleanup = navigator.modelContext.registerTool({
    name: 'add_note',
    execute: async (args) => {
      const note = { id: Date.now().toString(), ...args };
      notes = [...notes, note]; // Reactive update
      return { content: [{ type: 'text', text: JSON.stringify(note) }] };
    }
  });
  
  return cleanup; // Automatic cleanup on unmount
});

Svelte's runes provide more granular reactivity than React hooks, allowing computed values ($derived) to efficiently track only their dependencies.


For AI Agents: All checklist items verified and testing completed successfully.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Demonstrates Svelte 5 reactive primitives ($state, $derived, $effect)
- Notes app with 7 AI-callable tools for CRUD operations
- Uses @mcp-b/global for WebMCP tool registration
- Follows repository patterns with types/, lib/, components/ structure
- TypeScript strict mode with svelte-check
Copilot AI self-assigned this Dec 6, 2025
Copilot AI changed the title [WIP] Create simple Svelte runes WebMCP example app Add Svelte 5 runes WebMCP example with note-taking app Dec 6, 2025
Copilot AI requested a review from MiguelsPizza December 6, 2025 22:56
@MiguelsPizza MiguelsPizza force-pushed the claude/svelte-runes-webmcp-example-01EiHsKu3qSGRszTjHjA9SAr branch from 6809400 to c996275 Compare December 6, 2025 23:24
Base automatically changed from claude/svelte-runes-webmcp-example-01EiHsKu3qSGRszTjHjA9SAr to main December 6, 2025 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants