@simplysm/mcp-playwright 13.0.76 → 13.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,10 +50,9 @@ Returns all currently active session IDs.
|
|
|
50
50
|
|
|
51
51
|
**Input:** _(none)_
|
|
52
52
|
|
|
53
|
-
**Output:** JSON array of session ID strings.
|
|
53
|
+
**Output:** Pretty-printed JSON array of session ID strings.
|
|
54
54
|
|
|
55
55
|
```json
|
|
56
|
-
// Example response content
|
|
57
56
|
["session-a", "session-b"]
|
|
58
57
|
```
|
|
59
58
|
|
|
@@ -71,7 +70,7 @@ Closes a specific browser session and releases its resources.
|
|
|
71
70
|
|
|
72
71
|
## Playwright Proxy Tools
|
|
73
72
|
|
|
74
|
-
All tools from `@playwright/mcp` are forwarded by this server. Each forwarded tool has a `sessionId` field
|
|
73
|
+
All tools from `@playwright/mcp` are forwarded by this server. Each forwarded tool has a `sessionId` field added to its original input schema.
|
|
75
74
|
|
|
76
75
|
**Every proxied tool requires:**
|
|
77
76
|
|
|
@@ -80,7 +79,7 @@ All tools from `@playwright/mcp` are forwarded by this server. Each forwarded to
|
|
|
80
79
|
| `sessionId` | `string` | Yes | Session ID for browser isolation |
|
|
81
80
|
| _(original fields)_ | — | — | Same as the original `@playwright/mcp` tool |
|
|
82
81
|
|
|
83
|
-
If an error occurs during a proxied tool call, the session is automatically destroyed to avoid leaving a browser in
|
|
82
|
+
If an error occurs during a proxied tool call, the server checks whether the underlying connection is still alive. If the connection is broken, the session is automatically destroyed to avoid leaving a browser in an unusable state. If the connection is still alive, the error is returned without destroying the session.
|
|
84
83
|
|
|
85
84
|
## Server Internals
|
|
86
85
|
|
|
@@ -91,19 +90,24 @@ Internal class that manages the lifecycle of per-session Playwright MCP clients.
|
|
|
91
90
|
**Constructor**
|
|
92
91
|
|
|
93
92
|
```ts
|
|
94
|
-
new SessionManager(
|
|
93
|
+
new SessionManager(
|
|
94
|
+
config: NonNullable<Parameters<typeof createConnection>[0]>,
|
|
95
|
+
timeoutMs?: number,
|
|
96
|
+
version?: string,
|
|
97
|
+
)
|
|
95
98
|
```
|
|
96
99
|
|
|
97
100
|
| Parameter | Type | Default | Description |
|
|
98
101
|
|-----------|------|---------|-------------|
|
|
99
|
-
| `config` | `
|
|
100
|
-
| `timeoutMs` | `number` | `300000` (5 min) | Inactivity timeout before a session is auto-cleaned |
|
|
102
|
+
| `config` | `NonNullable<Parameters<typeof createConnection>[0]>` | — | Configuration passed to `@playwright/mcp`'s `createConnection` |
|
|
103
|
+
| `timeoutMs` | `number` | `300000` (5 min) | Inactivity timeout in milliseconds before a session is auto-cleaned |
|
|
104
|
+
| `version` | `string` | `"0.0.0"` | Version string reported by the internal MCP client |
|
|
101
105
|
|
|
102
106
|
**Methods**
|
|
103
107
|
|
|
104
108
|
| Method | Signature | Description |
|
|
105
109
|
|--------|-----------|-------------|
|
|
106
|
-
| `getOrCreate` | `(sessionId: string) => Promise<Client>` | Returns an existing MCP client for the session, or creates a new one. Updates the last-used timestamp on each call. |
|
|
110
|
+
| `getOrCreate` | `(sessionId: string) => Promise<Client>` | Returns an existing MCP client for the session, or creates a new one. Updates the last-used timestamp on each call. Concurrent calls for the same `sessionId` are deduplicated. |
|
|
107
111
|
| `destroy` | `(sessionId: string) => Promise<void>` | Closes and removes a single session. No-op if the session does not exist. |
|
|
108
112
|
| `disposeAll` | `() => Promise<void>` | Closes all sessions and stops the cleanup interval. Called on `SIGINT`/`SIGTERM`. |
|
|
109
113
|
| `list` | `() => string[]` | Returns an array of all currently active session IDs. |
|
|
@@ -116,7 +120,7 @@ Internal utility that adds the `sessionId` field to a Playwright tool's input sc
|
|
|
116
120
|
function injectSessionId(tool: Tool): Tool
|
|
117
121
|
```
|
|
118
122
|
|
|
119
|
-
-
|
|
123
|
+
- Adds `sessionId` to `inputSchema.properties`.
|
|
120
124
|
- Ensures `sessionId` appears first in the `required` array.
|
|
121
125
|
- Deduplicates `sessionId` if it is already present in `required`.
|
|
122
126
|
- Returns a new tool object; the original is not mutated.
|