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

electron-test-mcp

v0.1.0

Published

MCP server for testing Electron apps via Playwright - supports both CDP connection and direct launch

Readme

electron-test-mcp

MCP (Model Context Protocol) server for testing Electron applications using Playwright.

Features

  • Two connection modes:
    • CDP Mode: Connect to a running Electron app via Chrome DevTools Protocol
    • Launch Mode: Launch a fresh Electron app instance for testing
  • Full Playwright API: screenshot, click, fill, type, hover, press, wait, evaluate, and more
  • Accessibility snapshots: Get the accessibility tree for element discovery
  • Main process access: Execute code in Electron's main process (launch mode only)

Installation

npm install -g electron-test-mcp
# or
npx electron-test-mcp

Usage with Claude Desktop / MCP Clients

Add to your MCP configuration:

{
  "mcpServers": {
    "electron-test": {
      "command": "npx",
      "args": ["electron-test-mcp"]
    }
  }
}

Connection Modes

CDP Mode (Recommended for Development)

Connect to an already running Electron app with remote debugging enabled:

# Start your Electron app with debugging port
electron your-app --remote-debugging-port=9222

# Or with electron-vite
electron-vite dev -- --remote-debugging-port=9222

Then use the connect tool:

connect({ port: 9222 })

Pros:

  • Works with your existing dev workflow
  • App state preserved between tests
  • Hot reload still works

Launch Mode

Launch a fresh Electron app instance:

launch({ appPath: "./out/main/index.js" })

Pros:

  • Clean state for each test
  • Access to main process via evaluateMain
  • Can pass custom environment variables

Available Tools

Connection

| Tool | Description | | ------------ | --------------------------------------- | | connect | Connect to running app via CDP | | disconnect | Disconnect from CDP (app keeps running) | | launch | Launch new Electron app instance | | close | Close launched app |

Interaction

| Tool | Description | | -------------- | ----------------------------------- | | click | Click an element | | fill | Fill text into input (clears first) | | type | Type text character by character | | hover | Hover over an element | | press | Press keyboard key | | drag | Drag and drop | | selectOption | Select from dropdown |

Inspection

| Tool | Description | | -------------- | -------------------------------------- | | screenshot | Take screenshot (returns base64 image) | | snapshot | Get accessibility tree | | getText | Get element text content | | getAttribute | Get element attribute | | isVisible | Check if element is visible | | count | Count matching elements |

Advanced

| Tool | Description | | -------------- | ------------------------------------------- | | wait | Wait for element state | | evaluate | Run JS in renderer process | | evaluateMain | Run code in main process (launch mode only) |

Selectors

Supports all Playwright selectors:

# CSS selectors
[data-testid="submit-btn"]
.my-class
#my-id

# Text selectors
text=Submit
text="Exact Match"

# Role selectors
role=button[name="Submit"]

# Combining
.form >> text=Submit

Examples

Basic Test Flow

1. connect({ port: 9222 })
2. snapshot()  // See the page structure
3. click('[data-testid="login-btn"]')
4. fill('[data-testid="email"]', '[email protected]')
5. fill('[data-testid="password"]', 'password123')
6. click('text=Sign In')
7. wait({ selector: '[data-testid="dashboard"]' })
8. screenshot()

Main Process Access (Launch Mode)

// Get app version
evaluateMain({
  script: "({ app }) => app.getVersion()",
});

// Show dialog
evaluateMain({
  script: "({ dialog }) => dialog.showMessageBox({ message: 'Hello!' })",
});

Tips for Testable Electron Apps

  1. Add data-testid attributes to important elements
  2. Enable remote debugging in development: --remote-debugging-port=9222
  3. Use semantic HTML for better accessibility snapshots
  4. Keep selectors stable - prefer data-testid over classes

License

MIT