npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

p5js-ai-editor

v0.2.0

Published

A modern, web-based IDE for creating and editing p5.js sketches with AI assistance and Model Context Protocol (MCP) integration for Claude Desktop.

Readme

p5.js AI Editor

A modern, web-based IDE for creating and editing p5.js sketches with AI assistance and Model Context Protocol (MCP) integration for Claude Desktop.

Demo: Claude Desktop controlling the p5.js editor through natural language prompts via MCP server

Demo: Claude Desktop controlling the p5.js editor through natural language prompts via MCP server

Features

🎨 Full-Featured p5.js Editor

  • Live preview with instant code execution
  • File management (create, delete, rename files and folders)
  • Tabbed interface for multiple files
  • Start/Stop execution controls with visual indicators
  • Auto-save functionality

🔍 Development Tools

  • Real-time console with error display and console.log output
  • Color-coded log messages (errors, warnings, info)
  • Resizable panels with optimal workflow layout
  • Auto-scroll console with clear functionality

📁 Project Management

  • Multi-project support with dashboard view
  • Project cards with preview, metadata, and actions
  • Duplicate and delete projects
  • Auto-save to localStorage with project isolation
  • Dynamic routing (/ for dashboard, /project/[id] for editing)

🤖 Claude Desktop Integration (MCP)

  • TypeScript MCP Server: Control your editor directly from Claude Desktop
  • 13 AI Tools: Code updates, execution control, file management, UI control
  • Natural Language Commands: "Update the code to create a bouncing ball"
  • Real-time WebSocket Bridge: Instant communication between Claude and your editor
  • Project State Sharing: Claude can see and modify your current project

Getting Started

Prerequisites

  • Node.js 18+
  • npm, yarn, pnpm, or bun
  • Claude Desktop app

Installation

  1. Clone the repository

    git clone <repository-url>
    cd p5js-ai-editor
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open the application

Claude Desktop Integration Setup

1. Build the MCP Server

cd p5js-mcp-server-ts
npm install
npm run build

2. Configure Claude Desktop

  1. Generate configuration:

    cd p5js-mcp-server-ts
    node setup-claude.cjs
  2. Copy the configuration output

  3. Add to Claude Desktop:

    • Open Claude Desktop
    • Go to Settings (Claude menu → Settings)
    • Click Developer tab
    • Click "Edit Config"
    • Paste the configuration
    • Save and restart Claude Desktop

3. Complete Workflow

Start all components in this order:

  1. Start the webapp:

    npm run dev  # Runs on http://localhost:3000
  2. Start the WebSocket bridge:

    node websocket-bridge-server.js  # Runs on port 3001
  3. Open your project:

    • Go to http://localhost:3000
    • Open or create a project
    • Click "Enable MCP" button
  4. Use Claude Desktop:

    • Open Claude Desktop
    • Look for the hammer icon (🔨) in the chat input
    • Try commands like:
      • "Update the code to create a bouncing ball animation"
      • "Clear the console and start execution"
      • "Create a new file called 'utils.js'"

MCP Tools Available in Claude Desktop

🛠️ Code Management

  • update_code: Update p5.js code in the editor
  • select_file: Switch to a specific file
  • create_file: Create new files
  • delete_file: Delete files

▶️ Execution Control

  • start_execution: Start code execution
  • stop_execution: Stop code execution
  • toggle_execution: Toggle execution state

📱 Console Management

  • clear_console: Clear console messages
  • add_console_message: Add custom messages to console

🎛️ Layout Control

  • toggle_sidebar: Show/hide file explorer
  • update_project_name: Change project name

🧭 Navigation & System

  • go_to_dashboard: Navigate back to dashboard
  • check_connection: Check WebSocket connection status

💬 Example Commands for Claude

"Update the code to create a colorful particle system"
"Clear the console and start execution"
"Create a new file called 'particles.js' with a basic particle class"
"Toggle the sidebar and check the connection status"
"Stop execution and update the project name to 'My Art Project'"

Architecture

Claude Desktop ↔ MCP Server (TypeScript) ↔ WebSocket Bridge ↔ p5.js Editor
  • Claude Desktop: Connects to MCP Server via stdio transport
  • MCP Server: Translates natural language into WebSocket commands
  • WebSocket Bridge: Forwards commands between MCP server and webapp
  • p5.js Editor: Receives commands and updates UI/code in real-time

WebSocket Testing (Development)

For testing without Claude Desktop, use the interactive test server:

node test-websocket-server.js

Test Commands

| Command | Description | |---------|-------------| | 1-6 | Send predefined p5.js code samples | | start/stop/toggle | Control execution | | clearconsole | Clear console messages | | sidebar | Toggle file explorer | | status | Show connection status |

Project Structure

p5js-ai-editor/
├── app/                          # Next.js app directory
│   ├── project/[id]/            # Dynamic project routes
│   └── page.tsx                 # Dashboard page
├── components/
│   ├── dashboard-ui/            # Dashboard components
│   ├── editor-ui/               # Editor components
│   │   └── WebSocketListener.tsx # MCP WebSocket client
│   └── ui/                      # Shared UI components
├── p5js-mcp-server-ts/          # TypeScript MCP Server
│   ├── src/index.ts             # Main MCP server
│   ├── dist/                    # Compiled output
│   └── setup-claude.cjs         # Claude Desktop setup script
├── websocket-bridge-server.js   # WebSocket bridge server
├── test-websocket-server.js     # Development test server
└── README.md

Development

Architecture

  • Frontend: Next.js 14 with App Router
  • UI Framework: Shadcn UI + TailwindCSS
  • State Management: React useState with localStorage persistence
  • WebSocket: Socket.IO client/server
  • MCP Integration: TypeScript SDK with stdio transport
  • Code Editor: HTML textarea (ready for Monaco/CodeMirror integration)
  • Preview: Iframe with p5.js CDN injection

Key Components

  • ProjectDashboard: Main landing page with project overview
  • ProjectManager: Core editor with file management and layout
  • WebSocketListener: Handles MCP server connections and code updates
  • Console: Real-time log display with message categorization
  • Preview: Sandboxed p5.js execution environment

API Reference

WebSocket Events

MCP Server → WebSocket Bridge → Webapp

  • Code Updates:

    • codeUpdate: Update editor code
      { code: string }
  • Execution Control:

    • startExecution, stopExecution, toggleExecution
  • Console Control:

    • clearConsole
    • addConsoleMessage: Add console message
      { type: 'info'|'warn'|'error', message: string, timestamp: number }
  • File Control:

    • selectFile: Switch to file ("sketch.js")
    • createFile: Create new file ({ name: string, content: string })
    • deleteFile: Delete file ("filename.js")
  • Layout Control:

    • toggleSidebar, updateProjectName, backToDashboard

localStorage Schema

interface Project {
  id: string;
  name: string;
  files: { [filename: string]: string };
  openTabs: string[];
  activeTab: string;
  createdAt: string;
  lastModified: string;
}

Troubleshooting

MCP Server Not Showing in Claude

  • Check Claude Desktop logs: ~/Library/Logs/Claude/mcp*.log
  • Verify configuration file syntax
  • Ensure absolute paths are correct
  • Try running server manually: npm start in p5js-mcp-server-ts/

WebSocket Connection Issues

  • Start components in correct order (webapp → bridge → enable MCP)
  • Check that bridge server is running on port 3001
  • Verify "Enable MCP" button is clicked in webapp
  • Use check_connection tool in Claude Desktop

Commands Not Working

  • Ensure all three components are running (webapp, bridge, MCP enabled)
  • Check bridge server logs for [MCP→WebApp] forwarding messages
  • Verify Claude Desktop shows hammer icon (🔨)

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Test with Claude Desktop integration
  4. Submit a pull request

License

This project is open source and available under the MIT License.

Acknowledgments