Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dist/
downloads/
eggs/
.eggs/
lib/
/lib/
lib64/
parts/
sdist/
Expand Down
14 changes: 8 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ MCP server for Selenium WebDriver browser automation. JavaScript (ES Modules), N
## File Map

```text
src/lib/server.js ← ALL server logic: tool definitions, state, helpers, cleanup
src/index.js ← Thin CLI wrapper, spawns server.js as child process
test/mcp-client.mjs ← Reusable MCP test client (JSON-RPC over stdio)
test/*.test.mjs ← Tests grouped by feature
test/fixtures/*.html ← HTML files loaded via file:// URLs in tests
src/lib/server.js ← ALL server logic: tool definitions, state, helpers, cleanup
src/lib/accessibility-snapshot.js ← Browser-side JS injected via executeScript to build accessibility tree
bin/mcp-selenium.js ← CLI entry point, spawns server.js as child process
test/mcp-client.mjs ← Reusable MCP test client (JSON-RPC over stdio)
test/*.test.mjs ← Tests grouped by feature
test/fixtures/*.html ← HTML files loaded via file:// URLs in tests
```

## Architecture

**Single-file server** — everything is in `server.js`. 18 tools, 1 resource.
Server logic lives in `server.js`, with browser-injected scripts in separate files. 18 tools, 2 resources.

State is a module-level object:
```js
Expand Down Expand Up @@ -80,3 +81,4 @@ Tests talk to the real MCP server over stdio. No mocking. Each test file uses **
| `tools.test.mjs` | get_element_attribute, execute_script, window, frame, alert |
| `cookies.test.mjs` | add_cookie, get_cookies, delete_cookie |
| `bidi.test.mjs` | diagnostics (console/errors/network), session isolation |
| `resources.test.mjs` | accessibility-snapshot resource (tree structure, filtering, no-session error) |
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,29 @@ Gets browser diagnostics captured via WebDriver BiDi (auto-enabled when supporte

</details>

<details>
<summary><strong>Resources</strong></summary>

MCP resources provide read-only data that clients can access without calling a tool.

### browser-status://current
Returns the current browser session status (active session ID or "no active session").

| Property | Value |
|----------|-------|
| MIME type | `text/plain` |
| Requires browser | No |

### accessibility://current
Returns an accessibility tree snapshot of the current page — a compact, structured JSON representation of interactive elements and text content. Much smaller than full HTML. Useful for understanding page layout and finding elements to interact with.

| Property | Value |
|----------|-------|
| MIME type | `application/json` |
| Requires browser | Yes |

</details>

---

<details>
Expand Down
Loading