mcp-server-webdriver 0.6.0__py3-none-any.whl

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.
@@ -0,0 +1,431 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-webdriver
3
+ Version: 0.6.0
4
+ Summary: MCP Server for browser automation via Selenium WebDriver + geckodriver (Firefox)
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: browser-automation,firefox,geckodriver,mcp,selenium,webdriver
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: fastmcp>=2.10.0
10
+ Requires-Dist: selenium>=4.0.0
11
+ Provides-Extra: auto-driver
12
+ Requires-Dist: webdriver-manager>=4.0.0; extra == 'auto-driver'
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
15
+ Requires-Dist: pytest>=8.0; extra == 'dev'
16
+ Requires-Dist: webdriver-manager>=4.0.0; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # mcp-server-webdriver
20
+
21
+ ![mcp-server-webdriver](mcp-server-webdriver.svg)
22
+
23
+ MCP Server that lets AI agents control a real web browser via **Selenium WebDriver** (Firefox + geckodriver).
24
+ Built with [FastMCP](https://gofastmcp.com).
25
+
26
+ ---
27
+
28
+ ## What it does
29
+
30
+ The server eliminates the copy-paste loop between the browser and the AI assistant.
31
+ Instead of opening DevTools, copying errors, pasting them into a chat, and repeating,
32
+ the assistant opens the browser itself, navigates, captures errors and screenshots,
33
+ and diagnoses the problem directly.
34
+
35
+ ```
36
+ You: "Why is the checkout button broken on /cart?"
37
+
38
+ AI: browser_open → browser_navigate("/cart")
39
+ → devtools_report # JS errors? network failures?
40
+ → browser_screenshot # what does it look like?
41
+ → devtools_computed_css("button#checkout") # hidden? wrong z-index?
42
+ → "The button has pointer-events: none — overridden by .disabled class
43
+ applied when cart.js fails to load (404 on /static/cart.js)."
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Requirements
49
+
50
+ | Dependency | Version |
51
+ |---|---|
52
+ | Python | ≥ 3.11 |
53
+ | [FastMCP](https://pypi.org/project/fastmcp/) | ≥ 2.10 |
54
+ | [selenium](https://pypi.org/project/selenium/) | ≥ 4.0 |
55
+ | Firefox | any recent |
56
+ | [geckodriver](https://github.com/mozilla/geckodriver) | ≥ 0.34 |
57
+
58
+ ---
59
+
60
+ ## Installation
61
+
62
+ ### Recommended — Debian package from VitexSoftware repository
63
+
64
+ ```bash
65
+ sudo curl -fsSL http://repo.vitexsoftware.com/KEY.gpg -o /usr/share/keyrings/vitexsoftware-archive-keyring.gpg
66
+ echo "deb [signed-by=/usr/share/keyrings/vitexsoftware-archive-keyring.gpg] http://repo.vitexsoftware.com trixie main" \
67
+ | sudo tee /etc/apt/sources.list.d/vitexsoftware.list
68
+ sudo apt update
69
+ sudo apt install python3-mcp-server-webdriver
70
+ ```
71
+
72
+ This installs `gecko-driver`, `python3-selenium`, `python3-fastmcp`, and
73
+ `mcp-server-webdriver` in a single step.
74
+
75
+ ### Alternative — system package manager
76
+
77
+ ```bash
78
+ # Debian/Ubuntu (official repos — may be older geckodriver):
79
+ sudo apt install firefox-geckodriver
80
+
81
+ # macOS:
82
+ brew install geckodriver
83
+
84
+ # Rust / cargo (build from source):
85
+ cargo install geckodriver
86
+ ```
87
+
88
+ Then install Python dependencies:
89
+
90
+ ```bash
91
+ pip install fastmcp selenium
92
+ ```
93
+
94
+ ### Fallback — webdriver-manager (auto-download)
95
+
96
+ ```bash
97
+ pip install fastmcp selenium webdriver-manager
98
+ # geckodriver is downloaded automatically on first browser_open call
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Usage
104
+
105
+ ```
106
+ mcp-server-webdriver [OPTIONS]
107
+
108
+ OPTIONS
109
+ -P <profile> Start Firefox with a named profile
110
+ --profile <path> Start Firefox with a profile directory at <path>
111
+ -h, --help Show help and exit
112
+ ```
113
+
114
+ The server speaks MCP over stdin/stdout and is launched automatically
115
+ by the MCP client — not by hand.
116
+
117
+ ---
118
+
119
+ ## Use cases
120
+
121
+ ### Debug a broken page
122
+
123
+ Ask: *"Why does /dashboard show a blank screen?"*
124
+
125
+ The assistant will:
126
+
127
+ 1. `browser_open` — open Firefox headlessly
128
+ 2. `browser_navigate` — go to `/dashboard`
129
+ 3. `devtools_report` — get JS errors, console output, and failed network resources in one call
130
+ 4. `browser_screenshot` — see what the page actually looks like
131
+ 5. Explain the root cause from the combined evidence
132
+
133
+ `devtools_report` is the primary diagnostic tool — equivalent to opening the Console
134
+ and Network tabs in DevTools and reading them simultaneously.
135
+
136
+ ---
137
+
138
+ ### Diagnose a CSS / layout problem
139
+
140
+ Ask: *"The sidebar overlaps the content area on mobile. Why?"*
141
+
142
+ 1. `browser_open` — open the page
143
+ 2. `browser_screenshot` — capture the broken layout
144
+ 3. `devtools_computed_css(".sidebar")` — check `position`, `width`, `z-index`, `overflow`
145
+ 4. `devtools_css_variables("--")` — verify design tokens loaded correctly
146
+ 5. `devtools_network_failed` — check whether any stylesheet failed to load
147
+
148
+ ---
149
+
150
+ ### Automate a login flow
151
+
152
+ Ask: *"Log into the app at /login with user=admin, password=secret and screenshot the dashboard."*
153
+
154
+ 1. `browser_open` — start the browser
155
+ 2. `browser_navigate` — go to `/login`
156
+ 3. `browser_fill("#username", "admin")` — type username
157
+ 4. `browser_fill("#password", "secret")` — type password
158
+ 5. `browser_press_key("enter")` — submit the form
159
+ 6. `browser_wait("#dashboard", condition="visible")` — wait for redirect
160
+ 7. `browser_screenshot` — capture the result
161
+
162
+ ---
163
+
164
+ ### Inject a session cookie to skip login
165
+
166
+ Ask: *"Check the admin panel using my existing session token."*
167
+
168
+ 1. `browser_open` — start the browser
169
+ 2. `browser_navigate` — go to the app's root so the cookie domain matches
170
+ 3. `browser_set_cookie("session", "<token>")` — inject the auth cookie
171
+ 4. `browser_navigate` — now navigate to the protected page
172
+ 5. `browser_screenshot` — confirm access
173
+
174
+ ---
175
+
176
+ ### Enumerate page content
177
+
178
+ Ask: *"List all the navigation links on the homepage."*
179
+
180
+ 1. `browser_open` + `browser_navigate` — open the page
181
+ 2. `browser_find_elements("nav a")` — get all links with their text, href, and visibility
182
+ 3. Return the structured list
183
+
184
+ ---
185
+
186
+ ### Interact with hover menus
187
+
188
+ Ask: *"Click the third item in the Products dropdown."*
189
+
190
+ 1. `browser_hover(".nav-products")` — trigger the `:hover` state that reveals the dropdown
191
+ 2. `browser_wait(".dropdown-menu", condition="visible")` — wait for animation
192
+ 3. `browser_find_elements(".dropdown-menu a")` — list the items
193
+ 4. `browser_click(".dropdown-menu a:nth-child(3)")` — click the right one
194
+
195
+ ---
196
+
197
+ ### Test a multi-step form
198
+
199
+ Ask: *"Fill out the registration form and submit it."*
200
+
201
+ 1. `browser_fill("#first-name", "Alice")`
202
+ 2. `browser_fill("#last-name", "Smith")`
203
+ 3. `browser_fill("#email", "alice@example.com")`
204
+ 4. `browser_select("#country", "Czech Republic")`
205
+ 5. `browser_press_key("tab")` — move focus to next field
206
+ 6. `browser_click("button[type=submit"]")`
207
+ 7. `browser_wait(".success-message", condition="visible")`
208
+ 8. `devtools_report` — check for any JS errors or failed API calls during submission
209
+
210
+ ---
211
+
212
+ ### Handle JS dialogs
213
+
214
+ Ask: *"Click the Delete button and confirm the dialog."*
215
+
216
+ 1. `browser_click("#delete-btn")`
217
+ 2. `browser_accept_dialog` — click OK on the `confirm("Are you sure?")`
218
+ 3. `browser_wait(".deleted-notice", condition="present")`
219
+
220
+ ---
221
+
222
+ ### Scroll and capture a long page
223
+
224
+ Ask: *"Screenshot the footer of the page."*
225
+
226
+ 1. `browser_open` + `browser_navigate`
227
+ 2. `browser_scroll("footer")` — scroll the footer element into view
228
+ 3. `browser_screenshot("footer")` — capture just the footer element
229
+
230
+ Or scroll by offset to trigger lazy-loaded content:
231
+
232
+ 1. `browser_scroll(by=True, y=1000)` — scroll down 1000 px
233
+ 2. `browser_wait(".lazy-section", condition="visible")` — wait for lazy content
234
+ 3. `browser_screenshot` — capture the now-loaded content
235
+
236
+ ---
237
+
238
+ ### Use a real Firefox profile (stay logged in)
239
+
240
+ Configure the server with a named profile that already has your session:
241
+
242
+ ```json
243
+ {
244
+ "mcpServers": {
245
+ "webdriver": {
246
+ "command": "mcp-server-webdriver",
247
+ "args": ["-P", "work"]
248
+ }
249
+ }
250
+ }
251
+ ```
252
+
253
+ The browser starts with your existing cookies, saved passwords, and extensions.
254
+ Ask: *"Check my GitHub notifications."* — no login step needed.
255
+
256
+ ---
257
+
258
+ ### Audit network performance
259
+
260
+ Ask: *"Which resources on /shop are slowest to load?"*
261
+
262
+ 1. `browser_open` + `browser_navigate("/shop")`
263
+ 2. `devtools_network_all(slow_ms=500, limit=20)` — requests over 500 ms, capped at 20 entries
264
+ 3. Report the slowest assets with their URLs, types, and durations
265
+
266
+ ---
267
+
268
+ ## Available Tools
269
+
270
+ ### Session management
271
+
272
+ | Tool | Description |
273
+ |---|---|
274
+ | `browser_open` | Open Firefox (URL optional, default `about:blank`); accepts `width`, `height`, `user_agent` for mobile emulation |
275
+ | `browser_close` | Quit the browser session |
276
+ | `browser_status` | Session state, geckodriver version, BiDi status, current viewport size, buffer counts |
277
+ | `browser_set_viewport` | Resize the viewport mid-session (e.g. 390×844 for iPhone 14) |
278
+
279
+ ### Navigation
280
+
281
+ | Tool | Description |
282
+ |---|---|
283
+ | `browser_navigate` | Navigate to a URL (bare hostnames get `https://`) |
284
+ | `browser_back` | Go back in history |
285
+ | `browser_forward` | Go forward in history |
286
+ | `browser_refresh` | Reload the current page |
287
+
288
+ ### Page inspection
289
+
290
+ | Tool | Description |
291
+ |---|---|
292
+ | `browser_screenshot` | Full-page or element PNG screenshot |
293
+ | `browser_get_title` | Current page `<title>` |
294
+ | `browser_get_url` | Current URL |
295
+ | `browser_get_source` | Raw HTML source |
296
+ | `browser_get_text` | Visible text (whole page or CSS selector) |
297
+ | `browser_get_attribute` | Value of an HTML attribute on an element |
298
+ | `browser_find_elements` | List all elements matching a CSS selector |
299
+
300
+ ### Interaction
301
+
302
+ | Tool | Description |
303
+ |---|---|
304
+ | `browser_click` | Click element (CSS selector) |
305
+ | `browser_fill` | Type text into an input field (clears first by default) |
306
+ | `browser_select` | Select `<option>` in a `<select>` dropdown |
307
+ | `browser_execute_js` | Run JavaScript — returns JSON |
308
+ | `browser_wait` | Wait: `visible` / `clickable` / `present` / `text:<str>` |
309
+ | `browser_scroll` | Scroll to coords, by offset, or element into view |
310
+ | `browser_press_key` | Send `enter` / `tab` / `escape` / arrow / F-keys |
311
+ | `browser_hover` | Hover mouse over element (`:hover` states, tooltips, dropdowns) |
312
+ | `browser_switch_frame` | Switch into `<iframe>` or back to main document |
313
+
314
+ ### Dialogs & cookies
315
+
316
+ | Tool | Description |
317
+ |---|---|
318
+ | `browser_accept_dialog` | Accept a JS `alert()` / `confirm()` / `prompt()` |
319
+ | `browser_dismiss_dialog` | Dismiss a JS `confirm()` / `prompt()` |
320
+ | `browser_get_cookies` | Read all cookies for the current page |
321
+ | `browser_set_cookie` | Inject a cookie (auth tokens, session IDs) |
322
+
323
+ ### DevTools (require BiDi — Firefox + geckodriver ≥ 0.34)
324
+
325
+ | Tool | Description |
326
+ |---|---|
327
+ | `devtools_report` | **Main diagnostic tool** — JS errors + console + failed/slow network |
328
+ | `devtools_js_errors` | JavaScript exceptions only |
329
+ | `devtools_console` | Console output (log / warn / error / info / debug) |
330
+ | `devtools_network_failed` | Failed resources (4xx, 5xx, DNS errors) |
331
+ | `devtools_network_all` | All network requests (supports `limit=` and filters) |
332
+ | `devtools_clear` | Clear buffered DevTools data (use before navigating) |
333
+ | `devtools_enable_bidi` | Attach BiDi listeners to a running session |
334
+ | `devtools_computed_css` | Computed CSS properties of an element |
335
+ | `devtools_element_info` | Bounding box, visibility, attributes, aria, outerHTML |
336
+ | `devtools_css_variables` | CSS custom properties (`--var`) in scope |
337
+
338
+ ---
339
+
340
+ ## Environment variables
341
+
342
+ | Variable | Default | Description |
343
+ |---|---|---|
344
+ | `GECKODRIVER_PATH` | _(unset)_ | Absolute path to geckodriver binary (highest priority) |
345
+ | `GECKODRIVER_AUTO_INSTALL` | `true` | Set to `false` to disable webdriver-manager fallback |
346
+ | `FIREFOX_BINARY` | _(unset)_ | Path to a custom Firefox executable |
347
+ | `FIREFOX_PROFILE` | _(unset)_ | Named Firefox profile — same as `-P` |
348
+ | `FIREFOX_PROFILE_DIR` | _(unset)_ | Profile directory path — same as `--profile` |
349
+
350
+ ---
351
+
352
+ ## geckodriver resolution order
353
+
354
+ | # | Source | Configure via |
355
+ |---|---|---|
356
+ | 1 | `GECKODRIVER_PATH` env variable | Absolute path to the binary |
357
+ | 2 | **System PATH** (default) | `apt install gecko-driver` from repo.vitexsoftware.com |
358
+ | 3 | webdriver-manager auto-download | Fallback; disable with `GECKODRIVER_AUTO_INSTALL=false` |
359
+
360
+ ---
361
+
362
+ ## MCP client configuration
363
+
364
+ Minimal config:
365
+
366
+ ```json
367
+ {
368
+ "mcpServers": {
369
+ "webdriver": {
370
+ "command": "mcp-server-webdriver"
371
+ }
372
+ }
373
+ }
374
+ ```
375
+
376
+ With a named Firefox profile (stays logged in, uses saved passwords):
377
+
378
+ ```json
379
+ {
380
+ "mcpServers": {
381
+ "webdriver": {
382
+ "command": "mcp-server-webdriver",
383
+ "args": ["-P", "work"]
384
+ }
385
+ }
386
+ }
387
+ ```
388
+
389
+ With a profile directory and explicit geckodriver path:
390
+
391
+ ```json
392
+ {
393
+ "mcpServers": {
394
+ "webdriver": {
395
+ "command": "mcp-server-webdriver",
396
+ "args": ["--profile", "/home/user/.mozilla/firefox/abc123.dev"],
397
+ "env": {
398
+ "GECKODRIVER_PATH": "/usr/bin/geckodriver"
399
+ }
400
+ }
401
+ }
402
+ }
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Running tests
408
+
409
+ ```bash
410
+ # Unit tests only (no browser required):
411
+ pytest tests/ -m "not integration"
412
+
413
+ # All tests including browser integration:
414
+ pytest tests/
415
+ ```
416
+
417
+ ---
418
+
419
+ ## Related MCP Servers by VitexSoftware
420
+
421
+ | Server | Description |
422
+ |---|---|
423
+ | [abraflexi-mcp-server](https://github.com/VitexSoftware/abraflexi-mcp-server) | AbraFlexi accounting/ERP integration — invoices, contacts, products, bank transactions |
424
+ | [mastodon-mcp-server](https://github.com/VitexSoftware/mastodon-mcp-server) | Mastodon integration — timelines, posting, account management, search |
425
+ | [semaphore-mcp-server](https://github.com/VitexSoftware/semaphore-mcp-server) | Semaphore UI integration — manage Ansible, Terraform and other automation workflows |
426
+
427
+ ---
428
+
429
+ ## License
430
+
431
+ MIT
@@ -0,0 +1,6 @@
1
+ server.py,sha256=C_gpqNHP0o1jEMkvPdehVHKUlCIXTujLRaaBSDB5rcM,66988
2
+ mcp_server_webdriver-0.6.0.dist-info/METADATA,sha256=GzQ9U4Oz0fJFgZf1KG18cgdQTFFW0-MUwa79Zbc0WfQ,13335
3
+ mcp_server_webdriver-0.6.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
4
+ mcp_server_webdriver-0.6.0.dist-info/entry_points.txt,sha256=F3yZ8iJTtBe6dEP3X3JsoRAl8l8nfI6Ys0tH-0Y4T8c,53
5
+ mcp_server_webdriver-0.6.0.dist-info/licenses/LICENSE,sha256=Jq20BBGH3E8jqwC6CzzK7p_tat1N2j1J21BlOQ7YoWU,1069
6
+ mcp_server_webdriver-0.6.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-server-webdriver = server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cybervitexus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.