stealthmcp 0.1.0__tar.gz

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,67 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: macos-latest
14
+ outputs:
15
+ version: ${{ steps.version.outputs.version }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v5
19
+ - name: Read and validate version
20
+ id: version
21
+ run: |
22
+ version=$(uv run python -c "import re, pathlib; print(re.search(r'^__version__ = \"([^\"]+)\"', pathlib.Path('bin/stealth_browser.py').read_text(), re.M).group(1))")
23
+ test "v${version}" = "${GITHUB_REF_NAME}" || { echo "Tag ${GITHUB_REF_NAME} does not match __version__ ${version}"; exit 1; }
24
+ echo "version=${version}" >> "$GITHUB_OUTPUT"
25
+ - name: Run tests
26
+ run: |
27
+ uv sync --locked
28
+ uv run pytest tests/ -q
29
+ - name: Build sdist and wheel
30
+ run: uv build --out-dir dist
31
+ - name: Verify wheel contents
32
+ run: |
33
+ uv run python - <<'PY'
34
+ import glob, zipfile
35
+ wheel = glob.glob("dist/stealthmcp-*.whl")[0]
36
+ names = zipfile.ZipFile(wheel).namelist()
37
+ assert "stealth_browser.py" in names, names
38
+ entry = next(n for n in names if n.endswith("entry_points.txt"))
39
+ assert "stealth-browser = stealth_browser:main" in zipfile.ZipFile(wheel).read(entry).decode(), entry
40
+ print(f"Verified {wheel}")
41
+ PY
42
+ - name: Smoke-test built wheel
43
+ run: |
44
+ uv tool install --python 3.14 dist/stealthmcp-*.whl
45
+ stealth-browser --version
46
+ stealth-browser --doctor
47
+ - uses: actions/upload-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ publish:
53
+ needs: build
54
+ runs-on: macos-latest
55
+ environment:
56
+ name: pypi
57
+ url: https://pypi.org/project/stealthmcp/
58
+ permissions:
59
+ id-token: write
60
+ steps:
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ name: dist
64
+ path: dist/
65
+ - uses: astral-sh/setup-uv@v5
66
+ - name: Publish to PyPI
67
+ run: uv publish --trusted-publishing always dist/*
@@ -0,0 +1,30 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: macos-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v5
14
+ - name: Install dependencies
15
+ run: uv sync --locked
16
+ - name: Run test suite
17
+ run: uv run pytest tests/ -q
18
+
19
+ package:
20
+ runs-on: macos-latest
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ - uses: astral-sh/setup-uv@v5
24
+ - name: Build wheel
25
+ run: uv build --wheel --out-dir dist
26
+ - name: Install wheel as a tool
27
+ run: |
28
+ uv tool install --python 3.14 dist/stealthmcp-*.whl
29
+ stealth-browser --version
30
+ stealth-browser --doctor
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ .env
3
+ __pycache__/
4
+ *.py[cod]
5
+ .venv/
@@ -0,0 +1,8 @@
1
+ # AGENTS.md
2
+
3
+ - **Layout**: `bin/stealth_browser.py` is the canonical MCP server + CLI source; `bin/stealth-browser` is a symlink preserving the legacy `uv run --script` path. `bin/stealth-browser-audit` (transcript mining) stays a standalone PEP 723 script. The server is packaged as `stealthmcp` with a `stealth-browser` console script. Keep the PEP 723 block and `pyproject.toml` dependencies identical (test enforces this).
4
+ - **Tests**: Run with `uv sync --locked && uv run pytest tests/ -x`. Tests load the server module via `SourceFileLoader` from `bin/stealth-browser` (repo-root-relative), so no compilation or PATH setup is needed.
5
+ - **Skills**: `skills/<name>/SKILL.md` is the canonical, shareable location for workflows around these CLIs. Harnesses discover this directory via `~/.gemini/config/skills.json` (AGY) and the `skills` array in `opencode.jsonc` (OpenCode) — never copy skills elsewhere.
6
+ - **Shipper deployment**: The Postgres shipper is personal infrastructure and lives outside this repo, in the private `home_directory` dotfiles repo (`scripts/stealth-browser-shipper` + the `com.levon.stealth-browser-audit-shipper` LaunchAgent). It reuses `bin/stealth-browser-audit` from this repo as its parsing source of truth.
7
+ - **MCP registration points**: the installed `stealth-browser` console script (`uv tool install stealthmcp`), registered via `claude mcp add -s user stealth-browser -- stealth-browser` or `opencode mcp add --global`. Existing local configs using an absolute checkout path remain valid via the symlink.
8
+ - **Style**: Indent with one tab per hierarchy level. Every CLI subcommand must appear in `--help`. Keep code self-explanatory with zero comments; place context and rationale in commit or PR bodies.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Levon Tumanyan
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.
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.5
2
+ Name: stealthmcp
3
+ Version: 0.1.0
4
+ Summary: Stealth browser automation MCP server for AI coding agents on macOS
5
+ Project-URL: Homepage, https://github.com/levontumanyan/stealth-browser-mcp
6
+ Project-URL: Repository, https://github.com/levontumanyan/stealth-browser-mcp
7
+ Project-URL: Issues, https://github.com/levontumanyan/stealth-browser-mcp/issues
8
+ Author: Levon Tumanyan
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: adblock==0.6.0
13
+ Requires-Dist: mcp==1.30.0
14
+ Requires-Dist: patchright==1.64.4
15
+ Description-Content-Type: text/markdown
16
+
17
+ # stealth-browser-mcp
18
+
19
+ [![PyPI](https://img.shields.io/pypi/v/stealthmcp)](https://pypi.org/project/stealthmcp/)
20
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
21
+ [![tests](https://github.com/levontumanyan/stealth-browser-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/levontumanyan/stealth-browser-mcp/actions/workflows/tests.yml)
22
+ ![macOS](https://img.shields.io/badge/platform-macOS-lightgrey)
23
+ ![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)
24
+ ![uv](https://img.shields.io/badge/powered%20by-uv-%231284da)
25
+
26
+ Stealth browser automation for AI coding agents on macOS — an MCP server (`stealth-browser`) and a transcript-driven audit CLI (`stealth-browser-audit`).
27
+
28
+ # Why stealth-browser?
29
+
30
+ Launching a second browser binary alongside an active one on macOS can corrupt shared IPC rendezvous ports, freezing tab creation and IPC in your main browser. `stealth-browser` avoids this completely:
31
+
32
+ 1. **CDP First**: Attempts to attach to an existing browser session over `http://127.0.0.1:9222` (`STEALTH_BROWSER_CDP_PORT`).
33
+ 2. **Standalone Stealth Fallback**: Falls back to launching a dedicated Patchright stealth Chromium instance (`~/.agent-chromium-profile`) with native stealth masking and an isolated profile.
34
+ 3. **Clean Lifecycle & Idle Watchdog**: Automatically shuts down the background Patchright Node driver after 5 minutes of inactivity (`STEALTH_BROWSER_IDLE_TIMEOUT=300`) and guarantees immediate subprocess teardown on `SIGTERM`, `SIGHUP`, or `stdin` EOF.
35
+
36
+ # Quickstart
37
+
38
+ Prerequisites:
39
+
40
+ - **macOS** — the server uses `osascript` for human handoff and macOS-specific browser paths.
41
+ - **[uv](https://docs.astral.sh/uv/getting-started/installation/)** — install with `brew install uv` or the official installer. uv manages Python and dependencies; no system Python setup is needed.
42
+ - A first-launch browser download (~195 MB network, ~370 MB on disk) via `stealth-browser --install-browser`.
43
+
44
+ Install the tool and register it with your agent — no clone and no absolute path required:
45
+
46
+ ```sh
47
+ uv tool install stealthmcp
48
+ stealth-browser --install-browser
49
+ stealth-browser --doctor
50
+ ```
51
+
52
+ Upgrade or remove later with `uv tool upgrade stealthmcp` / `uv tool uninstall stealthmcp`.
53
+
54
+ If `stealth-browser` is not found after install, run `uv tool update-shell` to add uv's tool directory (`~/.local/bin`) to your `PATH`. GUI-launched clients that ignore your shell `PATH` can use the full shim path printed by `uv tool dir` (for example `~/.local/bin/stealth-browser`).
55
+
56
+ ## MCP Configuration
57
+
58
+ The install above provides a `stealth-browser` command on your `PATH`. The cleanest setup uses your client's CLI, which writes the config for you:
59
+
60
+ ```sh
61
+ claude mcp add -s user stealth-browser -- stealth-browser
62
+ opencode mcp add --global stealth-browser -- stealth-browser
63
+ ```
64
+
65
+ Or add the following to your agent's config (`~/.gemini/config/mcp_config.json`, `~/.config/opencode/opencode.jsonc`, `~/.claude.json`, or `.cursor/mcp.json`). No username-specific path needed:
66
+
67
+ ```json
68
+ {
69
+ "mcpServers": {
70
+ "stealth-browser": {
71
+ "command": "stealth-browser",
72
+ "args": []
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Other install methods
79
+
80
+ - **No install (try it):** `uvx --from stealthmcp stealth-browser --doctor`, or run straight from the source without a checkout: `uv run https://raw.githubusercontent.com/levontumanyan/stealth-browser-mcp/main/bin/stealth_browser.py --doctor`.
81
+ - **pipx:** `pipx install stealthmcp`, then the same `stealth-browser` command.
82
+ - **Existing checkout:** `uv run --script /absolute/path/to/stealth-browser-mcp/bin/stealth-browser` keeps working unchanged. Add that checkout's `bin/` to your `PATH` and run `stealth-browser --help` for a local dev setup.
83
+
84
+ ## Verification
85
+
86
+ `stealth-browser --doctor` checks Python, dependency versions, cheat-sheet creation, and browser/CDP availability, then exits non-zero on failure. Add `--smoke` to actually launch Chromium and open a tab. `stealth-browser --version` prints the installed version.
87
+
88
+ ## Available MCP Tools
89
+
90
+ - `status`: Check connection status and list all open tabs with indices and stable ids.
91
+ - `navigate`: Navigate the active tab or open a new tab (`new_tab=True`).
92
+ - `get_content` / `extract`: Extract visible text or structured fields from `body` or any CSS/XPath selector.
93
+ - `click` / `type` / `press_key` / `scroll`: Interact with page elements.
94
+ - `screenshot`: Capture a viewport screenshot for multimodal agent inspection.
95
+ - `evaluate_js`: Execute JavaScript in the active page context.
96
+ - `switch_tab` / `new_tab` / `close_tab`: Full multi-tab management (closing the last tab automatically closes the browser).
97
+ - `close_browser`: Completely close the browser window, terminate the browser process, and release all resources.
98
+ - `wait_for_human`: Pause for interactive login/2FA/CAPTCHA with a macOS notification; pin follow-up calls to the tab's stable `tN` id.
99
+
100
+ Headless by default; keep it that way and use `wait_for_human()` for interactive login/2FA/CAPTCHA.
101
+
102
+ # Audit
103
+
104
+ - `stealth-browser-audit [--since 14d] [--session <sid-prefix>] [--diff <baseline.json>]` — mine local AGY and OpenCode transcripts for stealth-browser usage, error rates, latency, and workarounds; produces a prioritized improvement plan or before/after scorecard. The audit CLI lives in the repo checkout (`bin/stealth-browser-audit`) and is not part of the installed `stealthmcp` tool.
105
+
106
+ # Development
107
+
108
+ ```sh
109
+ git clone https://github.com/levontumanyan/stealth-browser-mcp.git
110
+ cd stealth-browser-mcp
111
+ uv sync
112
+ uv run pytest tests/ -x
113
+ ```
114
+
115
+ `bin/stealth_browser.py` is the canonical source; `bin/stealth-browser` is a symlink that preserves the historical path and PEP 723 `uv run --script` workflow. Dependencies are declared in both the script's PEP 723 block and `pyproject.toml`, and a test keeps them in sync.
116
+
117
+ # Agent Skills (`skills/`)
118
+
119
+ Reusable agent workflows live in [`skills/`](skills/), one directory per skill with a `SKILL.md`:
120
+
121
+ - `stealth-browser-audit` — mine local agent transcripts for stealth-browser usage, errors, latency, and workarounds.
122
+ - `stealth-browser-subagent` — delegate heavy browser flows to an isolated subagent so DOM output stays out of the parent context.
123
+
124
+ Register the directory with your harness instead of copying files:
125
+
126
+ - **OpenCode**: add `"~/repos/stealth-browser-mcp/skills"` to the `skills` array in your `opencode.jsonc`.
127
+ - **Google Antigravity (`agy`)**: add `{ "path": "~/repos/stealth-browser-mcp/skills" }` to the `entries` of `~/.gemini/config/skills.json`.
@@ -0,0 +1,111 @@
1
+ # stealth-browser-mcp
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/stealthmcp)](https://pypi.org/project/stealthmcp/)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+ [![tests](https://github.com/levontumanyan/stealth-browser-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/levontumanyan/stealth-browser-mcp/actions/workflows/tests.yml)
6
+ ![macOS](https://img.shields.io/badge/platform-macOS-lightgrey)
7
+ ![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)
8
+ ![uv](https://img.shields.io/badge/powered%20by-uv-%231284da)
9
+
10
+ Stealth browser automation for AI coding agents on macOS — an MCP server (`stealth-browser`) and a transcript-driven audit CLI (`stealth-browser-audit`).
11
+
12
+ # Why stealth-browser?
13
+
14
+ Launching a second browser binary alongside an active one on macOS can corrupt shared IPC rendezvous ports, freezing tab creation and IPC in your main browser. `stealth-browser` avoids this completely:
15
+
16
+ 1. **CDP First**: Attempts to attach to an existing browser session over `http://127.0.0.1:9222` (`STEALTH_BROWSER_CDP_PORT`).
17
+ 2. **Standalone Stealth Fallback**: Falls back to launching a dedicated Patchright stealth Chromium instance (`~/.agent-chromium-profile`) with native stealth masking and an isolated profile.
18
+ 3. **Clean Lifecycle & Idle Watchdog**: Automatically shuts down the background Patchright Node driver after 5 minutes of inactivity (`STEALTH_BROWSER_IDLE_TIMEOUT=300`) and guarantees immediate subprocess teardown on `SIGTERM`, `SIGHUP`, or `stdin` EOF.
19
+
20
+ # Quickstart
21
+
22
+ Prerequisites:
23
+
24
+ - **macOS** — the server uses `osascript` for human handoff and macOS-specific browser paths.
25
+ - **[uv](https://docs.astral.sh/uv/getting-started/installation/)** — install with `brew install uv` or the official installer. uv manages Python and dependencies; no system Python setup is needed.
26
+ - A first-launch browser download (~195 MB network, ~370 MB on disk) via `stealth-browser --install-browser`.
27
+
28
+ Install the tool and register it with your agent — no clone and no absolute path required:
29
+
30
+ ```sh
31
+ uv tool install stealthmcp
32
+ stealth-browser --install-browser
33
+ stealth-browser --doctor
34
+ ```
35
+
36
+ Upgrade or remove later with `uv tool upgrade stealthmcp` / `uv tool uninstall stealthmcp`.
37
+
38
+ If `stealth-browser` is not found after install, run `uv tool update-shell` to add uv's tool directory (`~/.local/bin`) to your `PATH`. GUI-launched clients that ignore your shell `PATH` can use the full shim path printed by `uv tool dir` (for example `~/.local/bin/stealth-browser`).
39
+
40
+ ## MCP Configuration
41
+
42
+ The install above provides a `stealth-browser` command on your `PATH`. The cleanest setup uses your client's CLI, which writes the config for you:
43
+
44
+ ```sh
45
+ claude mcp add -s user stealth-browser -- stealth-browser
46
+ opencode mcp add --global stealth-browser -- stealth-browser
47
+ ```
48
+
49
+ Or add the following to your agent's config (`~/.gemini/config/mcp_config.json`, `~/.config/opencode/opencode.jsonc`, `~/.claude.json`, or `.cursor/mcp.json`). No username-specific path needed:
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "stealth-browser": {
55
+ "command": "stealth-browser",
56
+ "args": []
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Other install methods
63
+
64
+ - **No install (try it):** `uvx --from stealthmcp stealth-browser --doctor`, or run straight from the source without a checkout: `uv run https://raw.githubusercontent.com/levontumanyan/stealth-browser-mcp/main/bin/stealth_browser.py --doctor`.
65
+ - **pipx:** `pipx install stealthmcp`, then the same `stealth-browser` command.
66
+ - **Existing checkout:** `uv run --script /absolute/path/to/stealth-browser-mcp/bin/stealth-browser` keeps working unchanged. Add that checkout's `bin/` to your `PATH` and run `stealth-browser --help` for a local dev setup.
67
+
68
+ ## Verification
69
+
70
+ `stealth-browser --doctor` checks Python, dependency versions, cheat-sheet creation, and browser/CDP availability, then exits non-zero on failure. Add `--smoke` to actually launch Chromium and open a tab. `stealth-browser --version` prints the installed version.
71
+
72
+ ## Available MCP Tools
73
+
74
+ - `status`: Check connection status and list all open tabs with indices and stable ids.
75
+ - `navigate`: Navigate the active tab or open a new tab (`new_tab=True`).
76
+ - `get_content` / `extract`: Extract visible text or structured fields from `body` or any CSS/XPath selector.
77
+ - `click` / `type` / `press_key` / `scroll`: Interact with page elements.
78
+ - `screenshot`: Capture a viewport screenshot for multimodal agent inspection.
79
+ - `evaluate_js`: Execute JavaScript in the active page context.
80
+ - `switch_tab` / `new_tab` / `close_tab`: Full multi-tab management (closing the last tab automatically closes the browser).
81
+ - `close_browser`: Completely close the browser window, terminate the browser process, and release all resources.
82
+ - `wait_for_human`: Pause for interactive login/2FA/CAPTCHA with a macOS notification; pin follow-up calls to the tab's stable `tN` id.
83
+
84
+ Headless by default; keep it that way and use `wait_for_human()` for interactive login/2FA/CAPTCHA.
85
+
86
+ # Audit
87
+
88
+ - `stealth-browser-audit [--since 14d] [--session <sid-prefix>] [--diff <baseline.json>]` — mine local AGY and OpenCode transcripts for stealth-browser usage, error rates, latency, and workarounds; produces a prioritized improvement plan or before/after scorecard. The audit CLI lives in the repo checkout (`bin/stealth-browser-audit`) and is not part of the installed `stealthmcp` tool.
89
+
90
+ # Development
91
+
92
+ ```sh
93
+ git clone https://github.com/levontumanyan/stealth-browser-mcp.git
94
+ cd stealth-browser-mcp
95
+ uv sync
96
+ uv run pytest tests/ -x
97
+ ```
98
+
99
+ `bin/stealth_browser.py` is the canonical source; `bin/stealth-browser` is a symlink that preserves the historical path and PEP 723 `uv run --script` workflow. Dependencies are declared in both the script's PEP 723 block and `pyproject.toml`, and a test keeps them in sync.
100
+
101
+ # Agent Skills (`skills/`)
102
+
103
+ Reusable agent workflows live in [`skills/`](skills/), one directory per skill with a `SKILL.md`:
104
+
105
+ - `stealth-browser-audit` — mine local agent transcripts for stealth-browser usage, errors, latency, and workarounds.
106
+ - `stealth-browser-subagent` — delegate heavy browser flows to an isolated subagent so DOM output stays out of the parent context.
107
+
108
+ Register the directory with your harness instead of copying files:
109
+
110
+ - **OpenCode**: add `"~/repos/stealth-browser-mcp/skills"` to the `skills` array in your `opencode.jsonc`.
111
+ - **Google Antigravity (`agy`)**: add `{ "path": "~/repos/stealth-browser-mcp/skills" }` to the `entries` of `~/.gemini/config/skills.json`.
@@ -0,0 +1 @@
1
+ stealth_browser.py