Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1725363

Browse filesBrowse files
Merge pull request #129 from executeautomation/Reverted-SSE-support,-as-its-breaking-the-existing-flow
Reverted sse support, as its breaking the existing flow
2 parents e4064d1 + c76f148 commit 1725363
Copy full SHA for 1725363

File tree

Expand file treeCollapse file tree

9 files changed

+23
-170
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+23
-170
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-32Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Using Smithery
4343
To install Playwright MCP for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@executeautomation/playwright-mcp-server):
4444

4545
```bash
46-
npx -y @smithery/cli install @executeautomation/playwright-mcp-server --client claude
46+
npx @smithery/cli install @executeautomation/playwright-mcp-server --client claude
4747
```
4848
#### Installation in VS Code
4949

@@ -88,36 +88,6 @@ Here's the Claude Desktop configuration to use the Playwright server:
8888
}
8989
```
9090

91-
## SSE (Server-Sent Events) Support
92-
93-
Playwright MCP Server now supports real-time event streaming via Server-Sent Events (SSE).
94-
95-
### How to Use
96-
97-
- The server exposes an SSE endpoint at `http://localhost:3001/events`.
98-
- You can connect to this endpoint using any SSE-compatible client (such as EventSource in the browser or curl).
99-
- Events are sent in real-time as they occur (e.g., new console logs, screenshots, etc.).
100-
101-
### Example (JavaScript)
102-
```js
103-
const evtSource = new EventSource('http://localhost:3001/events');
104-
evtSource.addEventListener('console_log_entry', (event) => {
105-
const data = JSON.parse(event.data);
106-
console.log('Console log:', data.log);
107-
});
108-
evtSource.addEventListener('screenshot', (event) => {
109-
const data = JSON.parse(event.data);
110-
console.log('Screenshot event:', data);
111-
});
112-
```
113-
114-
### Available Events
115-
- `console_log_entry`: Fired when a new console log is captured.
116-
- `console_logs`: Fired when all logs are requested.
117-
- `screenshot`: Fired when a screenshot is taken or requested.
118-
119-
This allows you to build real-time dashboards, monitoring tools, or simply observe browser activity as it happens.
120-
12191
## Testing
12292

12393
This project uses Jest for testing. The tests are located in the `src/__tests__` directory.
@@ -138,7 +108,6 @@ npm run test:custom # Run tests with custom script (same as node run-tests.cj
138108

139109
The test coverage report will be generated in the `coverage` directory.
140110

141-
142111
### Running evals
143112

144113
The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found [here](https://www.mcpevals.io/docs).

‎docs/docs/intro.mdx

Copy file name to clipboardExpand all lines: docs/docs/intro.mdx
-28Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,3 @@ Modify your `claude-desktop-config.json` file as shown below
7070
This video should give you an high level overview of what Claude's MCP is and how helpful it will soon become for AI agents
7171

7272
<YouTubeVideoEmbed videoId="hGJQMbpsTi4" />
73-
74-
## 🟢 Real-Time Event Streaming (SSE)
75-
76-
Playwright MCP Server now supports real-time event streaming via Server-Sent Events (SSE).
77-
78-
- The server exposes an SSE endpoint at `http://localhost:3001/events`.
79-
- You can connect to this endpoint using any SSE-compatible client (such as EventSource in the browser or curl).
80-
- Events are sent in real-time as they occur (e.g., new console logs, screenshots, etc.).
81-
82-
**Example (JavaScript):**
83-
```js
84-
const evtSource = new EventSource('http://localhost:3001/events');
85-
evtSource.addEventListener('console_log_entry', (event) => {
86-
const data = JSON.parse(event.data);
87-
console.log('Console log:', data.log);
88-
});
89-
evtSource.addEventListener('screenshot', (event) => {
90-
const data = JSON.parse(event.data);
91-
console.log('Screenshot event:', data);
92-
});
93-
```
94-
95-
**Available Events:**
96-
- `console_log_entry`: Fired when a new console log is captured.
97-
- `console_logs`: Fired when all logs are requested.
98-
- `screenshot`: Fired when a screenshot is taken or requested.
99-
100-
This allows you to build real-time dashboards, monitoring tools, or simply observe browser activity as it happens.

‎docs/docs/playwright-web/Supported-Tools.mdx

Copy file name to clipboardExpand all lines: docs/docs/playwright-web/Supported-Tools.mdx
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@ sidebar_position: 1
44

55
import YouTubeVideoEmbed from '@site/src/components/HomepageFeatures/YouTubeVideoEmbed';
66

7-
# 🛠️ Supported Tools
8-
9-
> **🟢 Real-Time Event Streaming (SSE) is now supported!**
10-
>
11-
> - Connect to `http://localhost:3001/events` for real-time updates (console logs, screenshots, etc.).
12-
> - Use any SSE-compatible client (e.g., EventSource in the browser).
13-
> - Events: `console_log_entry`, `console_logs`, `screenshot`.
7+
# ��️ Supported Tools
148

159
Playwright MCP for Browser automation has following key features
1610
- Console log monitoring

‎docs/docs/release.mdx

Copy file name to clipboardExpand all lines: docs/docs/release.mdx
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import YouTubeVideoEmbed from '@site/src/components/HomepageFeatures/YouTubeVide
55

66
# Release Notes
77

8-
## Version 1.0.4
9-
- **SSE (Server-Sent Events) Support**: Added real-time event streaming via SSE
10-
- New SSE server runs on `http://localhost:3001/events`
11-
- Real-time streaming of browser console logs and screenshots to any SSE-compatible client
12-
- Example usage and event types (`console_log_entry`, `console_logs`, `screenshot`) documented in README and docs
13-
- Enables building real-time dashboards, monitoring tools, or observing browser activity as it happens
8+
## Version 1.0.5
9+
- **Removed SSE (Server-Sent Events) Support**: All SSE-related code, endpoints, and documentation have been fully removed. The server now only supports STDIO transport for communication with clients.
10+
- **Codebase Cleanup**: Removed all references to SseServer, /events endpoint, and related event streaming features from the code and documentation.
11+
- **Version bump**: Incremented version to 1.0.5.
1412

13+
## Version 1.0.4
1514
- **New Tool: `playwright_iframe_fill`**
1615
- Fill input fields inside iframes using CSS selectors
1716

@@ -22,7 +21,7 @@ import YouTubeVideoEmbed from '@site/src/components/HomepageFeatures/YouTubeVide
2221
- Captures uncaught exceptions and unhandled Promise rejections in browser logs for better debugging
2322

2423
- **Documentation Updates**
25-
- Added/updated documentation for new tools, SSE support, and improved installation/configuration instructions
24+
- Added/updated documentation for new tools and improved installation/configuration instructions
2625

2726
- **Test Coverage**
2827
- Added and updated tests for new tools and features

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@executeautomation/playwright-mcp-server",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Model Context Protocol servers for Playwright",
55
"license": "MIT",
66
"author": "ExecuteAutomation, Ltd (https://executeautomation.com)",

‎src/index.ts

Copy file name to clipboardExpand all lines: src/index.ts
+14-29Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,40 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
44
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
55
import { createToolDefinitions } from "./tools.js";
66
import { setupRequestHandlers } from "./requestHandler.js";
7-
import { SseServer } from './sseServer.js';
8-
import http from 'http';
9-
10-
export const SSE_SERVER_SYMBOL = Symbol('sseServer');
11-
12-
// Custom interface to allow symbol property
13-
interface McpServerWithSSE extends Server {
14-
[key: symbol]: any;
15-
}
167

178
async function runServer() {
18-
const server: McpServerWithSSE = new Server(
9+
const server = new Server(
1910
{
2011
name: "executeautomation/playwright-mcp-server",
21-
version: "1.0.4",
12+
version: "1.0.5",
2213
},
2314
{
2415
capabilities: {
2516
resources: {},
2617
tools: {},
2718
},
2819
}
29-
) as McpServerWithSSE;
20+
);
3021

3122
// Create tool definitions
3223
const TOOLS = createToolDefinitions();
3324

3425
// Setup request handlers
3526
setupRequestHandlers(server, TOOLS);
3627

37-
// Start HTTP server for SSE only if not in test environment
38-
let sseServer;
39-
if (process.env.NODE_ENV !== 'test') {
40-
let httpServer;
41-
try {
42-
httpServer = http.createServer();
43-
sseServer = new SseServer();
44-
sseServer.attachToServer(httpServer);
45-
httpServer.listen(3001, () => {
46-
console.log('SSE server listening on http://localhost:3001/events');
47-
});
48-
} catch (err) {
49-
console.error('Failed to initialize SSE server:', err);
50-
}
51-
if (sseServer) {
52-
server[SSE_SERVER_SYMBOL] = sseServer;
53-
}
28+
// Graceful shutdown logic
29+
function shutdown() {
30+
console.log('Shutdown signal received');
31+
process.exit(0);
5432
}
5533

34+
process.on('SIGINT', shutdown);
35+
process.on('SIGTERM', shutdown);
36+
process.on('exit', shutdown);
37+
process.on('uncaughtException', (err) => {
38+
console.error('Uncaught Exception:', err);
39+
});
40+
5641
// Create transport and connect
5742
const transport = new StdioServerTransport();
5843
await server.connect(transport);

‎src/requestHandler.ts

Copy file name to clipboardExpand all lines: src/requestHandler.ts
-19Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
Tool
88
} from "@modelcontextprotocol/sdk/types.js";
99
import { handleToolCall, getConsoleLogs, getScreenshots } from "./toolHandler.js";
10-
import { SSE_SERVER_SYMBOL } from './index.js';
1110

1211
export function setupRequestHandlers(server: Server, tools: Tool[]) {
1312
// List resources handler
@@ -32,15 +31,6 @@ export function setupRequestHandlers(server: Server, tools: Tool[]) {
3231

3332
if (uri === "console://logs") {
3433
const logs = getConsoleLogs().join("\n");
35-
// Broadcast logs to SSE clients
36-
try {
37-
const sseServer = (server as any)[SSE_SERVER_SYMBOL];
38-
if (sseServer) {
39-
sseServer.broadcast('console_logs', { logs });
40-
}
41-
} catch (err) {
42-
console.error('Failed to broadcast console logs via SSE:', err);
43-
}
4434
return {
4535
contents: [{
4636
uri,
@@ -54,15 +44,6 @@ export function setupRequestHandlers(server: Server, tools: Tool[]) {
5444
const name = uri.split("://")[1];
5545
const screenshot = getScreenshots().get(name);
5646
if (screenshot) {
57-
// Broadcast screenshot event to SSE clients
58-
try {
59-
const sseServer = (server as any)[SSE_SERVER_SYMBOL];
60-
if (sseServer) {
61-
sseServer.broadcast('screenshot', { name, screenshot });
62-
}
63-
} catch (err) {
64-
console.error('Failed to broadcast screenshot via SSE:', err);
65-
}
6647
return {
6748
contents: [{
6849
uri,

‎src/sseServer.ts

Copy file name to clipboardExpand all lines: src/sseServer.ts
-41Lines changed: 0 additions & 41 deletions
This file was deleted.

‎src/tools/browser/console.ts

Copy file name to clipboardExpand all lines: src/tools/browser/console.ts
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { BrowserToolBase } from './base.js';
22
import { ToolContext, ToolResponse, createSuccessResponse } from '../common/types.js';
3-
import { SSE_SERVER_SYMBOL } from '../../index.js';
43

54
/**
65
* Tool for retrieving and filtering console logs from the browser
@@ -16,11 +15,6 @@ export class ConsoleLogsTool extends BrowserToolBase {
1615
registerConsoleMessage(type: string, text: string): void {
1716
const logEntry = `[${type}] ${text}`;
1817
this.consoleLogs.push(logEntry);
19-
// Broadcast new log entry to SSE clients
20-
const sseServer = (this.server as any)[SSE_SERVER_SYMBOL];
21-
if (sseServer) {
22-
sseServer.broadcast('console_log_entry', { log: logEntry });
23-
}
2418
}
2519

2620
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.