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

@cgaspard/webappmcp

v0.2.3

Published

WebApp MCP - Model Context Protocol integration for web applications with server-side debugging tools

Readme

@cgaspard/webappmcp

WebApp MCP (Model Context Protocol) - A comprehensive toolkit for enabling AI assistants to interact with web applications through DOM inspection, user interaction simulation, state management, and server-side debugging.

Installation

npm install @cgaspard/webappmcp

For global CLI usage:

npm install -g @cgaspard/webappmcp

Quick Start

Express Middleware

import express from 'express';
import { webappMCP } from '@cgaspard/webappmcp';

const app = express();

// Add WebApp MCP middleware
app.use(webappMCP({
  transport: 'sse',
  wsPort: 4835,
  authentication: {
    enabled: true,
    token: process.env.MCP_AUTH_TOKEN
  },
  permissions: {
    serverExec: false  // Server-side JS execution (auto-disabled in production)
  },
  captureServerLogs: true,  // Enable server console log capture
  serverTools: false        // Server-side tools (auto-disabled in production)
}));

app.listen(3000, () => {
  console.log('Server running on port 3000');
  console.log('MCP SSE endpoint: http://localhost:3000/mcp/sse');
  console.log('WebSocket server: ws://localhost:3101');
});

Browser Client

ES Modules

import { WebAppMCPClient } from '@cgaspard/webappmcp';

const client = new WebAppMCPClient({
  serverUrl: 'ws://localhost:3101',
  autoConnect: true
});

client.connect();

Script Tag

<script src="https://unpkg.com/@cgaspard/webappmcp/dist/browser.min.js"></script>
<script>
  const client = new WebAppMCP.WebAppMCPClient({
    serverUrl: 'ws://localhost:3101',
    autoConnect: true
  });
  
  client.connect();
</script>

Standalone Server

# Run the standalone MCP server
webappmcp-server --port 3100 --ws-port 3101

Plugins

WebApp MCP uses a modular plugin architecture. Framework-specific functionality is available through separate npm packages:

Available Plugins

Using Plugins

const { webappMCP } = require('@cgaspard/webappmcp');
const vuePlugin = require('@cgaspard/webappmcp-vue').default;

app.use(webappMCP({
  wsPort: 4835,
  transport: 'sse',
  plugins: [vuePlugin]
}));

See the Plugin Architecture documentation for details on creating custom plugins.

Features

Core MCP Tools

  • DOM Operations

    • dom_query - Find elements using CSS selectors
    • dom_get_properties - Get element properties and attributes
    • dom_get_text - Extract text content
    • dom_get_html - Get HTML structure
    • dom_manipulate - Modify DOM elements
  • User Interactions

    • interaction_click - Click on elements
    • interaction_type - Type text into inputs
    • interaction_scroll - Scroll page or elements
    • interaction_hover - Hover over elements
  • State Management

    • state_get_variable - Access JavaScript variables
    • state_local_storage - Read/write localStorage
    • console_get_logs - Retrieve browser console logs with regex filtering
  • Server-Side Tools (NEW)

    • console_get_server_logs - Retrieve Node.js server console logs with regex filtering
    • server_execute_js - Execute JavaScript code on the server (sandboxed)
    • server_get_system_info - Get process, memory, CPU, and OS information
    • server_get_env - Inspect environment variables (with sensitive data masking)
  • Visual Capture

    • capture_screenshot - Take full page screenshots
    • capture_element_screenshot - Capture specific elements
  • Diagnostic Tools

    • webapp_list_clients - List connected browser clients
    • javascript_inject - Execute JavaScript code
    • execute_javascript - Execute JavaScript with async support

Framework Integration

React

import { useEffect } from 'react';
import { WebAppMCPClient } from '@cgaspard/webappmcp';

function App() {
  useEffect(() => {
    const client = new WebAppMCPClient({
      serverUrl: 'ws://localhost:3101',
      autoConnect: true
    });
    
    client.connect();
    
    return () => client.disconnect();
  }, []);
  
  return <div>Your React App</div>;
}

Vue

import { WebAppMCPClient } from '@cgaspard/webappmcp';

export default {
  mounted() {
    this.mcpClient = new WebAppMCPClient({
      serverUrl: 'ws://localhost:3101',
      autoConnect: true
    });
    
    this.mcpClient.connect();
  },
  
  beforeUnmount() {
    if (this.mcpClient) {
      this.mcpClient.disconnect();
    }
  }
}

Configuration

Middleware Options

{
  transport: 'sse',          // 'sse', 'stdio', 'socket', 'none'
  mcpPort: 3100,            // MCP server port
  wsPort: 3101,             // WebSocket server port
  cors: {                   // CORS configuration
    origin: true,
    credentials: true
  },
  authentication: {         // Optional auth
    enabled: false,
    token: 'your-token'
  },
  debug: false              // Enable debug logging (default: false)
}

Client Options

{
  serverUrl: 'ws://localhost:3101',    // WebSocket URL
  autoConnect: true,                   // Auto-connect on init
  reconnect: true,                     // Auto-reconnect
  reconnectInterval: 5000,             // Reconnect interval (ms)
  maxReconnectAttempts: 10,           // Max reconnect attempts
  enableDevTools: false,               // Show DevTools overlay
  debug: false                         // Enable debug logging (default: false)
}

MCP Client Configuration

Claude Desktop App

Add using the command line:

claude mcp add webapp-sse sse:http://localhost:3000/mcp/sse

Or manually edit your configuration:

{
  "mcpServers": {
    "webapp-sse": {
      "transport": {
        "type": "sse",
        "url": "http://localhost:3000/mcp/sse"
      }
    }
  }
}

Claude Code CLI

Add to your Claude Code configuration (~/.config/claude-code/settings.json):

{
  "mcpServers": {
    "webapp": {
      "transport": {
        "type": "sse", 
        "url": "http://localhost:3000/mcp/sse"
      }
    }
  }
}

Cline (VS Code Extension)

Add to your Cline MCP settings in VS Code:

{
  "webapp": {
    "transport": {
      "type": "sse",
      "url": "http://localhost:3000/mcp/sse"
    }
  }
}

Continue.dev

Add to your Continue configuration (~/.continue/config.json):

{
  "models": [...],
  "mcpServers": {
    "webapp": {
      "transport": {
        "type": "sse",
        "url": "http://localhost:3000/mcp/sse"
      }
    }
  }
}

Zed Editor

Add to your Zed assistant panel settings:

{
  "mcpServers": {
    "webapp": {
      "transport": {
        "type": "sse",
        "url": "http://localhost:3000/mcp/sse"
      }
    }
  }
}

Examples

See the examples directory for complete working examples with:

  • Basic Express integration
  • Todo app with vanilla JavaScript
  • React Todo app
  • Vue.js Todo app

License

MIT