cdp-bridge 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,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: cdp-bridge
3
+ Version: 0.1.0
4
+ Summary: MCP server that bridges clients to a real browser through CDP and a companion extension.
5
+ Project-URL: Homepage, https://github.com/Unagi-cq/cdp-bridge-mcp
6
+ Project-URL: Repository, https://github.com/Unagi-cq/cdp-bridge-mcp
7
+ Project-URL: Issues, https://github.com/Unagi-cq/cdp-bridge-mcp/issues
8
+ Keywords: mcp,browser,cdp,automation
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: beautifulsoup4>=4.14.3
15
+ Requires-Dist: bottle>=0.13.4
16
+ Requires-Dist: mcp>=1.27.0
17
+ Requires-Dist: requests>=2.33.1
18
+ Requires-Dist: simple-websocket-server>=0.4.4
19
+
20
+ <h1 align="center">CDP Bridge MCP</h1>
21
+
22
+ <div align="center">
23
+
24
+ [![PyPI](https://img.shields.io/pypi/v/cdp-bridge?label=PyPI)](https://pypi.org/project/cdp-bridge/)
25
+ [![Python](https://img.shields.io/badge/Python-3.12%2B-blue)](https://www.python.org/)
26
+ [![MCP](https://img.shields.io/badge/MCP-Browser%20Bridge-green)](https://modelcontextprotocol.io/)
27
+ [![GitHub](https://img.shields.io/badge/GitHub-Unagi--cq%2Fcdp--bridge--mcp-black)](https://github.com/Unagi-cq/cdp-bridge-mcp)
28
+
29
+ </div>
30
+
31
+ <p align="center">
32
+ CDP Bridge MCP 是一个连接 MCP 客户端与真实浏览器会话的桥接服务。它通过配套的 Chromium 扩展接入浏览器页面,让大模型客户端可以读取标签页、扫描页面、执行 JavaScript、截图、导航和读取 Cookie。
33
+ </p>
34
+
35
+ <p align="center">
36
+ <a href="#中文说明">中文</a> | <a href="#english">English</a>
37
+ </p>
38
+
39
+ ## 中文说明
40
+
41
+ ### 项目介绍
42
+
43
+ CDP Bridge MCP 适合需要让大模型操作真实浏览器的场景。和无状态 HTTP 抓取不同,它连接的是你已经登录、已经打开的浏览器页面,因此可以复用真实浏览器里的登录态、Cookie、页面状态和前端渲染结果。
44
+
45
+ 项目由两部分组成:
46
+
47
+ - **MCP Server**:Python 包,发布到 PyPI 后可通过 `uvx cdp-bridge` 启动。
48
+ - **浏览器扩展**:随 Python 包一起发布,用于把 Chromium 标签页连接到本地 MCP Server。
49
+
50
+ 代码仓库:<https://github.com/Unagi-cq/cdp-bridge-mcp>
51
+
52
+ ### 功能
53
+
54
+ - 标签页管理:获取当前已连接浏览器标签页列表,并切换活动标签页。
55
+ - 页面扫描:提取当前页面的简化 HTML 或纯文本内容,减少无关脚本、样式和隐藏元素。
56
+ - JavaScript 执行:在真实页面上下文中执行 JavaScript,并返回执行结果。
57
+ - 页面导航:控制活动标签页跳转到指定 URL。
58
+ - 页面截图:通过 CDP 截取当前页面 PNG,并返回 base64 数据。
59
+ - Cookie 读取:读取当前页面或指定 URL 的 Cookie。
60
+ - 真实会话复用:可使用浏览器中已有登录态,适合需要账号态页面的自动化和检索场景。
61
+
62
+ ### 安装与启动
63
+
64
+ 安装 `uv` 后,发布到 PyPI 的版本可以直接用 `uvx` 启动:
65
+
66
+ ```bash
67
+ uvx cdp-bridge
68
+ ```
69
+
70
+ 在 MCP 客户端中可以这样配置:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "cdp-bridge": {
76
+ "command": "uvx",
77
+ "args": ["cdp-bridge"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ ### 加载浏览器扩展
84
+
85
+ 浏览器扩展已经包含在 Python 包内。安装或通过 `uvx` 使用后,可以打印扩展目录:
86
+
87
+ ```bash
88
+ uvx --from cdp-bridge cdp-bridge-extension-path
89
+ ```
90
+
91
+ 然后在 Chrome 或其他 Chromium 浏览器中加载:
92
+
93
+ 1. 打开 `chrome://extensions/`。
94
+ 2. 开启“开发者模式”。
95
+ 3. 点击“加载已解压的扩展程序”。
96
+ 4. 选择 `cdp-bridge-extension-path` 输出的目录。
97
+ 5. 启动 MCP Server 后,刷新需要操作的网页。
98
+
99
+ 默认情况下,扩展会连接本地服务地址 `127.0.0.1:18765`。
100
+
101
+ ### 可用工具
102
+
103
+ MCP Server 当前暴露以下工具:
104
+
105
+ | 工具名 | 说明 |
106
+ | --- | --- |
107
+ | `browser_get_tabs` | 获取已连接标签页列表 |
108
+ | `browser_scan` | 扫描当前页面内容,可返回简化 HTML 或纯文本 |
109
+ | `browser_execute_js` | 在当前标签页执行 JavaScript |
110
+ | `browser_switch_tab` | 切换活动标签页 |
111
+ | `browser_navigate` | 跳转当前标签页到指定 URL |
112
+ | `browser_screenshot` | 获取页面截图 |
113
+ | `browser_cookies` | 读取 Cookie |
114
+
115
+ ### 本地开发
116
+
117
+ 克隆仓库:
118
+
119
+ ```bash
120
+ git clone git@github.com:Unagi-cq/cdp-bridge-mcp.git
121
+ cd cdp-bridge-mcp
122
+ ```
123
+
124
+ 从源码运行:
125
+
126
+ ```bash
127
+ uv run cdp-bridge
128
+ ```
129
+
130
+ 构建发布包:
131
+
132
+ ```bash
133
+ uv build
134
+ ```
135
+
136
+ 检查发布包:
137
+
138
+ ```bash
139
+ uvx twine check dist/*
140
+ ```
141
+
142
+ 发布到 PyPI:
143
+
144
+ ```bash
145
+ uv publish
146
+ ```
147
+
148
+ ### 注意事项
149
+
150
+ - 本项目需要 Python 3.12 或更高版本。
151
+ - 浏览器扩展需要和 MCP Server 同时运行,否则工具会提示没有连接的浏览器标签页。
152
+ - 页面自动化会运行在你的真实浏览器会话中,请只连接你信任的 MCP 客户端。
153
+ - 如果修改了扩展文件,重新构建包前请确认 `src/cdp_bridge/tmwd_cdp_bridge` 中的文件已经更新。
154
+
155
+ ## English
156
+
157
+ ### Introduction
158
+
159
+ CDP Bridge MCP is an MCP server for connecting model clients to real browser sessions. Instead of fetching pages as stateless HTTP documents, it works with tabs already open in your Chromium-based browser, so the model can use existing login state, cookies, rendered DOM, and live page context.
160
+
161
+ The project has two parts:
162
+
163
+ - **MCP Server**: a Python package that can be launched with `uvx cdp-bridge` after publishing to PyPI.
164
+ - **Browser extension**: a packaged Chromium extension that connects browser tabs to the local MCP server.
165
+
166
+ Repository: <https://github.com/Unagi-cq/cdp-bridge-mcp>
167
+
168
+ ### Features
169
+
170
+ - Tab management: list connected browser tabs and switch the active tab.
171
+ - Page scanning: extract simplified HTML or plain text from the active page.
172
+ - JavaScript execution: run JavaScript in the real page context.
173
+ - Navigation: navigate the active tab to a target URL.
174
+ - Screenshots: capture a PNG screenshot through CDP and return base64 data.
175
+ - Cookie access: read cookies for the current page or a specific URL.
176
+ - Real session reuse: operate on pages with your existing browser login state.
177
+
178
+ ### Install and Run
179
+
180
+ After installing `uv`, the PyPI package can be launched with:
181
+
182
+ ```bash
183
+ uvx cdp-bridge
184
+ ```
185
+
186
+ Example MCP client configuration:
187
+
188
+ ```json
189
+ {
190
+ "mcpServers": {
191
+ "cdp-bridge": {
192
+ "command": "uvx",
193
+ "args": ["cdp-bridge"]
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ ### Load the Browser Extension
200
+
201
+ The Chromium extension is included in the Python package. Print its local path with:
202
+
203
+ ```bash
204
+ uvx --from cdp-bridge cdp-bridge-extension-path
205
+ ```
206
+
207
+ Then load it in Chrome or another Chromium-based browser:
208
+
209
+ 1. Open `chrome://extensions/`.
210
+ 2. Enable Developer mode.
211
+ 3. Click "Load unpacked".
212
+ 4. Select the directory printed by `cdp-bridge-extension-path`.
213
+ 5. Start the MCP server and refresh the page you want to operate on.
214
+
215
+ By default, the extension connects to `127.0.0.1:18765`.
216
+
217
+ ### Tools
218
+
219
+ The MCP server exposes these tools:
220
+
221
+ | Tool | Description |
222
+ | --- | --- |
223
+ | `browser_get_tabs` | List connected browser tabs |
224
+ | `browser_scan` | Scan the active page as simplified HTML or plain text |
225
+ | `browser_execute_js` | Execute JavaScript in the active tab |
226
+ | `browser_switch_tab` | Switch the active tab |
227
+ | `browser_navigate` | Navigate the active tab to a URL |
228
+ | `browser_screenshot` | Capture a page screenshot |
229
+ | `browser_cookies` | Read cookies |
230
+
231
+ ### Development
232
+
233
+ Clone the repository:
234
+
235
+ ```bash
236
+ git clone git@github.com:Unagi-cq/cdp-bridge-mcp.git
237
+ cd cdp-bridge-mcp
238
+ ```
239
+
240
+ Run from source:
241
+
242
+ ```bash
243
+ uv run cdp-bridge
244
+ ```
245
+
246
+ Build the package:
247
+
248
+ ```bash
249
+ uv build
250
+ ```
251
+
252
+ Check the distribution files:
253
+
254
+ ```bash
255
+ uvx twine check dist/*
256
+ ```
257
+
258
+ Publish to PyPI:
259
+
260
+ ```bash
261
+ uv publish
262
+ ```
263
+
264
+ ### Notes
265
+
266
+ - Python 3.12 or newer is required.
267
+ - The browser extension and MCP server must run at the same time.
268
+ - Browser automation runs in your real browser session, so only connect clients you trust.
269
+ - If extension files are changed, make sure `src/cdp_bridge/tmwd_cdp_bridge` is updated before building the package.
@@ -0,0 +1,250 @@
1
+ <h1 align="center">CDP Bridge MCP</h1>
2
+
3
+ <div align="center">
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/cdp-bridge?label=PyPI)](https://pypi.org/project/cdp-bridge/)
6
+ [![Python](https://img.shields.io/badge/Python-3.12%2B-blue)](https://www.python.org/)
7
+ [![MCP](https://img.shields.io/badge/MCP-Browser%20Bridge-green)](https://modelcontextprotocol.io/)
8
+ [![GitHub](https://img.shields.io/badge/GitHub-Unagi--cq%2Fcdp--bridge--mcp-black)](https://github.com/Unagi-cq/cdp-bridge-mcp)
9
+
10
+ </div>
11
+
12
+ <p align="center">
13
+ CDP Bridge MCP 是一个连接 MCP 客户端与真实浏览器会话的桥接服务。它通过配套的 Chromium 扩展接入浏览器页面,让大模型客户端可以读取标签页、扫描页面、执行 JavaScript、截图、导航和读取 Cookie。
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="#中文说明">中文</a> | <a href="#english">English</a>
18
+ </p>
19
+
20
+ ## 中文说明
21
+
22
+ ### 项目介绍
23
+
24
+ CDP Bridge MCP 适合需要让大模型操作真实浏览器的场景。和无状态 HTTP 抓取不同,它连接的是你已经登录、已经打开的浏览器页面,因此可以复用真实浏览器里的登录态、Cookie、页面状态和前端渲染结果。
25
+
26
+ 项目由两部分组成:
27
+
28
+ - **MCP Server**:Python 包,发布到 PyPI 后可通过 `uvx cdp-bridge` 启动。
29
+ - **浏览器扩展**:随 Python 包一起发布,用于把 Chromium 标签页连接到本地 MCP Server。
30
+
31
+ 代码仓库:<https://github.com/Unagi-cq/cdp-bridge-mcp>
32
+
33
+ ### 功能
34
+
35
+ - 标签页管理:获取当前已连接浏览器标签页列表,并切换活动标签页。
36
+ - 页面扫描:提取当前页面的简化 HTML 或纯文本内容,减少无关脚本、样式和隐藏元素。
37
+ - JavaScript 执行:在真实页面上下文中执行 JavaScript,并返回执行结果。
38
+ - 页面导航:控制活动标签页跳转到指定 URL。
39
+ - 页面截图:通过 CDP 截取当前页面 PNG,并返回 base64 数据。
40
+ - Cookie 读取:读取当前页面或指定 URL 的 Cookie。
41
+ - 真实会话复用:可使用浏览器中已有登录态,适合需要账号态页面的自动化和检索场景。
42
+
43
+ ### 安装与启动
44
+
45
+ 安装 `uv` 后,发布到 PyPI 的版本可以直接用 `uvx` 启动:
46
+
47
+ ```bash
48
+ uvx cdp-bridge
49
+ ```
50
+
51
+ 在 MCP 客户端中可以这样配置:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "cdp-bridge": {
57
+ "command": "uvx",
58
+ "args": ["cdp-bridge"]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### 加载浏览器扩展
65
+
66
+ 浏览器扩展已经包含在 Python 包内。安装或通过 `uvx` 使用后,可以打印扩展目录:
67
+
68
+ ```bash
69
+ uvx --from cdp-bridge cdp-bridge-extension-path
70
+ ```
71
+
72
+ 然后在 Chrome 或其他 Chromium 浏览器中加载:
73
+
74
+ 1. 打开 `chrome://extensions/`。
75
+ 2. 开启“开发者模式”。
76
+ 3. 点击“加载已解压的扩展程序”。
77
+ 4. 选择 `cdp-bridge-extension-path` 输出的目录。
78
+ 5. 启动 MCP Server 后,刷新需要操作的网页。
79
+
80
+ 默认情况下,扩展会连接本地服务地址 `127.0.0.1:18765`。
81
+
82
+ ### 可用工具
83
+
84
+ MCP Server 当前暴露以下工具:
85
+
86
+ | 工具名 | 说明 |
87
+ | --- | --- |
88
+ | `browser_get_tabs` | 获取已连接标签页列表 |
89
+ | `browser_scan` | 扫描当前页面内容,可返回简化 HTML 或纯文本 |
90
+ | `browser_execute_js` | 在当前标签页执行 JavaScript |
91
+ | `browser_switch_tab` | 切换活动标签页 |
92
+ | `browser_navigate` | 跳转当前标签页到指定 URL |
93
+ | `browser_screenshot` | 获取页面截图 |
94
+ | `browser_cookies` | 读取 Cookie |
95
+
96
+ ### 本地开发
97
+
98
+ 克隆仓库:
99
+
100
+ ```bash
101
+ git clone git@github.com:Unagi-cq/cdp-bridge-mcp.git
102
+ cd cdp-bridge-mcp
103
+ ```
104
+
105
+ 从源码运行:
106
+
107
+ ```bash
108
+ uv run cdp-bridge
109
+ ```
110
+
111
+ 构建发布包:
112
+
113
+ ```bash
114
+ uv build
115
+ ```
116
+
117
+ 检查发布包:
118
+
119
+ ```bash
120
+ uvx twine check dist/*
121
+ ```
122
+
123
+ 发布到 PyPI:
124
+
125
+ ```bash
126
+ uv publish
127
+ ```
128
+
129
+ ### 注意事项
130
+
131
+ - 本项目需要 Python 3.12 或更高版本。
132
+ - 浏览器扩展需要和 MCP Server 同时运行,否则工具会提示没有连接的浏览器标签页。
133
+ - 页面自动化会运行在你的真实浏览器会话中,请只连接你信任的 MCP 客户端。
134
+ - 如果修改了扩展文件,重新构建包前请确认 `src/cdp_bridge/tmwd_cdp_bridge` 中的文件已经更新。
135
+
136
+ ## English
137
+
138
+ ### Introduction
139
+
140
+ CDP Bridge MCP is an MCP server for connecting model clients to real browser sessions. Instead of fetching pages as stateless HTTP documents, it works with tabs already open in your Chromium-based browser, so the model can use existing login state, cookies, rendered DOM, and live page context.
141
+
142
+ The project has two parts:
143
+
144
+ - **MCP Server**: a Python package that can be launched with `uvx cdp-bridge` after publishing to PyPI.
145
+ - **Browser extension**: a packaged Chromium extension that connects browser tabs to the local MCP server.
146
+
147
+ Repository: <https://github.com/Unagi-cq/cdp-bridge-mcp>
148
+
149
+ ### Features
150
+
151
+ - Tab management: list connected browser tabs and switch the active tab.
152
+ - Page scanning: extract simplified HTML or plain text from the active page.
153
+ - JavaScript execution: run JavaScript in the real page context.
154
+ - Navigation: navigate the active tab to a target URL.
155
+ - Screenshots: capture a PNG screenshot through CDP and return base64 data.
156
+ - Cookie access: read cookies for the current page or a specific URL.
157
+ - Real session reuse: operate on pages with your existing browser login state.
158
+
159
+ ### Install and Run
160
+
161
+ After installing `uv`, the PyPI package can be launched with:
162
+
163
+ ```bash
164
+ uvx cdp-bridge
165
+ ```
166
+
167
+ Example MCP client configuration:
168
+
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "cdp-bridge": {
173
+ "command": "uvx",
174
+ "args": ["cdp-bridge"]
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Load the Browser Extension
181
+
182
+ The Chromium extension is included in the Python package. Print its local path with:
183
+
184
+ ```bash
185
+ uvx --from cdp-bridge cdp-bridge-extension-path
186
+ ```
187
+
188
+ Then load it in Chrome or another Chromium-based browser:
189
+
190
+ 1. Open `chrome://extensions/`.
191
+ 2. Enable Developer mode.
192
+ 3. Click "Load unpacked".
193
+ 4. Select the directory printed by `cdp-bridge-extension-path`.
194
+ 5. Start the MCP server and refresh the page you want to operate on.
195
+
196
+ By default, the extension connects to `127.0.0.1:18765`.
197
+
198
+ ### Tools
199
+
200
+ The MCP server exposes these tools:
201
+
202
+ | Tool | Description |
203
+ | --- | --- |
204
+ | `browser_get_tabs` | List connected browser tabs |
205
+ | `browser_scan` | Scan the active page as simplified HTML or plain text |
206
+ | `browser_execute_js` | Execute JavaScript in the active tab |
207
+ | `browser_switch_tab` | Switch the active tab |
208
+ | `browser_navigate` | Navigate the active tab to a URL |
209
+ | `browser_screenshot` | Capture a page screenshot |
210
+ | `browser_cookies` | Read cookies |
211
+
212
+ ### Development
213
+
214
+ Clone the repository:
215
+
216
+ ```bash
217
+ git clone git@github.com:Unagi-cq/cdp-bridge-mcp.git
218
+ cd cdp-bridge-mcp
219
+ ```
220
+
221
+ Run from source:
222
+
223
+ ```bash
224
+ uv run cdp-bridge
225
+ ```
226
+
227
+ Build the package:
228
+
229
+ ```bash
230
+ uv build
231
+ ```
232
+
233
+ Check the distribution files:
234
+
235
+ ```bash
236
+ uvx twine check dist/*
237
+ ```
238
+
239
+ Publish to PyPI:
240
+
241
+ ```bash
242
+ uv publish
243
+ ```
244
+
245
+ ### Notes
246
+
247
+ - Python 3.12 or newer is required.
248
+ - The browser extension and MCP server must run at the same time.
249
+ - Browser automation runs in your real browser session, so only connect clients you trust.
250
+ - If extension files are changed, make sure `src/cdp_bridge/tmwd_cdp_bridge` is updated before building the package.
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cdp-bridge"
7
+ version = "0.1.0"
8
+ description = "MCP server that bridges clients to a real browser through CDP and a companion extension."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ keywords = ["mcp", "browser", "cdp", "automation"]
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ ]
17
+ dependencies = [
18
+ "beautifulsoup4>=4.14.3",
19
+ "bottle>=0.13.4",
20
+ "mcp>=1.27.0",
21
+ "requests>=2.33.1",
22
+ "simple-websocket-server>=0.4.4",
23
+ ]
24
+
25
+ [project.scripts]
26
+ cdp-bridge = "cdp_bridge:main"
27
+ cdp-bridge-extension-path = "cdp_bridge:extension_path"
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/Unagi-cq/cdp-bridge-mcp"
31
+ Repository = "https://github.com/Unagi-cq/cdp-bridge-mcp"
32
+ Issues = "https://github.com/Unagi-cq/cdp-bridge-mcp/issues"
33
+
34
+ [tool.setuptools.packages.find]
35
+ where = ["src"]
36
+
37
+ [tool.setuptools.package-data]
38
+ cdp_bridge = ["tmwd_cdp_bridge/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+