A powerful Model Context Protocol (MCP) server for debugging Electron applications with deep Chrome DevTools Protocol integration.
- Overview
- Features
- Installation
- Usage
- Resource Endpoints
- Chrome DevTools Protocol Integration
- Examples
- Development
- Contributing
- License
Electron Debug MCP Server provides a bridge between the Model Context Protocol (MCP) and Electron applications, enabling advanced debugging capabilities through a standardized API. It allows you to start, monitor, debug, and control Electron applications programmatically, with deep integration with Chrome DevTools Protocol for advanced debugging features.
- Process Management
- π Start Electron applications with debugging enabled
- π Stop running Electron processes
- π List all active Electron processes
- π Monitor process status and logs
- Chrome DevTools Protocol Integration
- π― Discover and connect to debugging targets
- π§© Execute CDP commands across domains
- π Evaluate JavaScript in the context of pages
- π Reload pages or entire applications
- β―οΈ Pause and resume JavaScript execution
- Structured Resource Endpoints
- π Overview of all running Electron processes
- π Detailed debug information for specific processes
- π Access to process logs
- π― List of available debugging targets
- π Direct CDP access for specific targets
# Clone the repository
git clone https://github.com/yourusername/electron-mcp-server.git
# Navigate to the project directory
cd electron-mcp-server
# Install dependencies
npm install
# Build the project
npm run buildnpm run startThis will start the MCP server using stdio for communication.
The MCP server uses stdio for communication, so clients need to connect using the Model Context Protocol. You can:
- Use an MCP client library
- Connect directly via stdin/stdout
- Use a tool that supports MCP
The server exposes the following resource endpoints:
| Resource | Description |
|---|---|
electron://info |
Overview of all running Electron processes |
electron://process/{id} |
Detailed debug info for a specific process |
electron://logs/{id} |
Access to logs for a specific process |
electron://targets |
List of all available debug targets |
electron://cdp/{processId}/{targetId} |
CDP access for a specific target |
electron://operation/{operation} |
Operations to control Electron apps |
| Operation | Description |
|---|---|
start |
Start an Electron application |
stop |
Stop a running Electron process |
list |
List all running Electron processes |
reload |
Reload a specific page or application |
evaluate |
Execute JavaScript in a page context |
pause |
Pause JavaScript execution |
resume |
Resume JavaScript execution |
The server integrates with Chrome DevTools Protocol to provide deep debugging capabilities:
GET electron://targets
Returns all available debugging targets across all running Electron processes.
GET electron://cdp/{processId}/{targetId}
Provides information about the target and available CDP domains.
GET electron://cdp/{processId}/{targetId}/{domain}/{command}
Examples:
electron://cdp/electron-123456/page-1/Page/reload- Reload the pageelectron://cdp/electron-123456/page-1/Runtime/evaluate- Evaluate JavaScriptelectron://cdp/electron-123456/page-1/Debugger/pause- Pause execution
// Example request (using an MCP client)
const response = await mcpClient.readResource({
uri: "electron://operation/start",
content: JSON.stringify({
appPath: "C:\\path\\to\\your\\electron\\app",
debugPort: 9222 // Optional debugging port
})
});// Get detailed info about a specific app
const processId = "electron-1234567890";
const infoResponse = await mcpClient.readResource({
uri: `electron://process/${processId}`
});// Execute JavaScript in a page
const evalResponse = await mcpClient.readResource({
uri: `electron://cdp/electron-123456/page-1/Runtime/evaluate`,
content: JSON.stringify({
expression: "document.title",
returnByValue: true
})
});electron-mcp-server/
βββ src/
β βββ index.ts # Main server implementation
β βββ types/ # TypeScript type definitions
βββ build/ # Compiled JavaScript output
βββ package.json # Project dependencies and scripts
βββ tsconfig.json # TypeScript configuration
npm run buildnpm run devContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details.
Built with β€οΈ using TypeScript, Electron, and Chrome DevTools Protocol.