mcp-query-table 0.3.10__tar.gz → 0.3.11__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.
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/PKG-INFO +15 -3
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/README.md +14 -2
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/__main__.py +2 -2
- mcp_query_table-0.3.11/mcp_query_table/_version.py +1 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/server.py +2 -2
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/tool.py +7 -3
- mcp_query_table-0.3.10/mcp_query_table/_version.py +0 -1
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/.gitignore +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/LICENSE +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/__init__.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/enums.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/providers/__init__.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/providers/baidu.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/providers/n.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/providers/yuanbao.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/sites/__init__.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/sites/eastmoney.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/sites/iwencai.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/sites/tdx.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/mcp_query_table/utils.py +0 -0
- {mcp_query_table-0.3.10 → mcp_query_table-0.3.11}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp_query_table
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.11
|
|
4
4
|
Summary: query table from website, support MCP
|
|
5
5
|
Author-email: wukan <wu-kan@163.com>
|
|
6
6
|
License: MIT License
|
|
@@ -137,6 +137,8 @@ if __name__ == '__main__':
|
|
|
137
137
|
- `endpoint`以`ws://`开头,连接远程`Playwright Server`。也是无头模式,但无法指定`user_data_dir`,所以使用受限
|
|
138
138
|
- 参考:https://playwright.dev/python/docs/docker#running-the-playwright-server
|
|
139
139
|
|
|
140
|
+
`Chrome`新版的安全策略使用默认`user_data_dir`时将无法创建`CDP`服务,建议重新复制配置目录到其他地方
|
|
141
|
+
|
|
140
142
|
## MCP支持
|
|
141
143
|
|
|
142
144
|
确保可以在控制台中执行`python -m mcp_query_table -h`。如果不能,可能要先`pip install mcp_query_table`
|
|
@@ -172,7 +174,7 @@ if __name__ == '__main__':
|
|
|
172
174
|
先在控制台中执行如下命令,启动`MCP`服务
|
|
173
175
|
|
|
174
176
|
```commandline
|
|
175
|
-
python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoint http://127.0.0.1:9222
|
|
177
|
+
python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoint http://127.0.0.1:9222 --user_data_dir "D:\user-data-dir"
|
|
176
178
|
```
|
|
177
179
|
|
|
178
180
|
然后就可以连接到`MCP`服务了
|
|
@@ -188,6 +190,14 @@ python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoi
|
|
|
188
190
|
}
|
|
189
191
|
```
|
|
190
192
|
|
|
193
|
+
### Streamable HTTP方式
|
|
194
|
+
|
|
195
|
+
```commandline
|
|
196
|
+
python -m mcp_query_table --format markdown --transport streamable-http --port 8000 --endpoint http://127.0.0.1:9222 --user_data_dir "D:\user-data-dir"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
连接的地址是`http://127.0.0.1:8000/mcp`
|
|
200
|
+
|
|
191
201
|
## 使用`MCP Inspector`进行调试
|
|
192
202
|
|
|
193
203
|
```commandline
|
|
@@ -221,5 +231,7 @@ npx @modelcontextprotocol/inspector python -m mcp_query_table --format markdown
|
|
|
221
231
|

|
|
222
232
|
|
|
223
233
|
## 参考
|
|
234
|
+
|
|
224
235
|
- [Selenium webdriver无法附加到edge实例,edge的--remote-debugging-port选项无效](https://blog.csdn.net/qq_30576521/article/details/142370538)
|
|
225
|
-
- https://github.com/AtuboDad/playwright_stealth/issues/31
|
|
236
|
+
- https://github.com/AtuboDad/playwright_stealth/issues/31
|
|
237
|
+
- https://github.com/browser-use/browser-use/issues/1520
|
|
@@ -98,6 +98,8 @@ if __name__ == '__main__':
|
|
|
98
98
|
- `endpoint`以`ws://`开头,连接远程`Playwright Server`。也是无头模式,但无法指定`user_data_dir`,所以使用受限
|
|
99
99
|
- 参考:https://playwright.dev/python/docs/docker#running-the-playwright-server
|
|
100
100
|
|
|
101
|
+
`Chrome`新版的安全策略使用默认`user_data_dir`时将无法创建`CDP`服务,建议重新复制配置目录到其他地方
|
|
102
|
+
|
|
101
103
|
## MCP支持
|
|
102
104
|
|
|
103
105
|
确保可以在控制台中执行`python -m mcp_query_table -h`。如果不能,可能要先`pip install mcp_query_table`
|
|
@@ -133,7 +135,7 @@ if __name__ == '__main__':
|
|
|
133
135
|
先在控制台中执行如下命令,启动`MCP`服务
|
|
134
136
|
|
|
135
137
|
```commandline
|
|
136
|
-
python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoint http://127.0.0.1:9222
|
|
138
|
+
python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoint http://127.0.0.1:9222 --user_data_dir "D:\user-data-dir"
|
|
137
139
|
```
|
|
138
140
|
|
|
139
141
|
然后就可以连接到`MCP`服务了
|
|
@@ -149,6 +151,14 @@ python -m mcp_query_table --format markdown --transport sse --port 8000 --endpoi
|
|
|
149
151
|
}
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
### Streamable HTTP方式
|
|
155
|
+
|
|
156
|
+
```commandline
|
|
157
|
+
python -m mcp_query_table --format markdown --transport streamable-http --port 8000 --endpoint http://127.0.0.1:9222 --user_data_dir "D:\user-data-dir"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
连接的地址是`http://127.0.0.1:8000/mcp`
|
|
161
|
+
|
|
152
162
|
## 使用`MCP Inspector`进行调试
|
|
153
163
|
|
|
154
164
|
```commandline
|
|
@@ -182,5 +192,7 @@ npx @modelcontextprotocol/inspector python -m mcp_query_table --format markdown
|
|
|
182
192
|

|
|
183
193
|
|
|
184
194
|
## 参考
|
|
195
|
+
|
|
185
196
|
- [Selenium webdriver无法附加到edge实例,edge的--remote-debugging-port选项无效](https://blog.csdn.net/qq_30576521/article/details/142370538)
|
|
186
|
-
- https://github.com/AtuboDad/playwright_stealth/issues/31
|
|
197
|
+
- https://github.com/AtuboDad/playwright_stealth/issues/31
|
|
198
|
+
- https://github.com/browser-use/browser-use/issues/1520
|
|
@@ -17,9 +17,9 @@ def main():
|
|
|
17
17
|
parser.add_argument("--executable_path", type=str, help="浏览器路径",
|
|
18
18
|
nargs="?", default=r'C:\Program Files\Google\Chrome\Application\chrome.exe')
|
|
19
19
|
parser.add_argument("--user_data_dir", type=str, help="浏览器用户数据目录",
|
|
20
|
-
nargs="?", default=rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data
|
|
20
|
+
nargs="?", default=rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data')
|
|
21
21
|
parser.add_argument("--transport", type=str, help="传输类型",
|
|
22
|
-
default='stdio', choices=['stdio', 'sse'])
|
|
22
|
+
default='stdio', choices=['stdio', 'sse', 'streamable-http'])
|
|
23
23
|
parser.add_argument("--host", type=str, help="MCP服务端绑定地址",
|
|
24
24
|
default='0.0.0.0')
|
|
25
25
|
parser.add_argument("--port", type=int, help="MCP服务端绑定端口",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.11"
|
|
@@ -22,9 +22,9 @@ class QueryServer:
|
|
|
22
22
|
devtools=False,
|
|
23
23
|
headless=True)
|
|
24
24
|
|
|
25
|
-
async def query(self, query_input: str, query_type: QueryType, max_page: int, site: Site):
|
|
25
|
+
async def query(self, query_input: str, query_type: QueryType, max_page: int, rename: bool, site: Site):
|
|
26
26
|
page = await self.browser.get_page()
|
|
27
|
-
df = await qt_query(page, query_input, query_type, max_page, site)
|
|
27
|
+
df = await qt_query(page, query_input, query_type, max_page, rename, site)
|
|
28
28
|
self.browser.release_page(page)
|
|
29
29
|
|
|
30
30
|
if self.format == 'csv':
|
|
@@ -66,8 +66,8 @@ def get_user_data_dir(user_data_dir) -> Optional[str]:
|
|
|
66
66
|
"""获取浏览器可用户目录"""
|
|
67
67
|
browsers = {
|
|
68
68
|
"default": user_data_dir,
|
|
69
|
-
"chrome.exe": rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data
|
|
70
|
-
"msedge.exe": rf"C:\Users\{getpass.getuser()}\AppData\Local\Microsoft\Edge\User Data
|
|
69
|
+
"chrome.exe": rf'C:\Users\{getpass.getuser()}\AppData\Local\Google\Chrome\User Data', # 使用默认配置文件时无法创建CDP
|
|
70
|
+
"msedge.exe": rf"C:\Users\{getpass.getuser()}\AppData\Local\Microsoft\Edge\User Data",
|
|
71
71
|
}
|
|
72
72
|
for k, v in browsers.items():
|
|
73
73
|
if v is None:
|
|
@@ -136,6 +136,10 @@ class BrowserManager:
|
|
|
136
136
|
command = [executable_path, f'--remote-debugging-port={port}', '--start-maximized']
|
|
137
137
|
if self.devtools:
|
|
138
138
|
command.append('--auto-open-devtools-for-tabs')
|
|
139
|
+
if self.user_data_dir:
|
|
140
|
+
command.append(f'--user-data-dir={self.user_data_dir}')
|
|
141
|
+
else:
|
|
142
|
+
logger.warning('Chrome必须另行指定`--user-data-dir`才能创建CDP连接')
|
|
139
143
|
|
|
140
144
|
for i in range(2):
|
|
141
145
|
try:
|
|
@@ -251,7 +255,7 @@ async def query(
|
|
|
251
255
|
max_page: int = 5,
|
|
252
256
|
rename: bool = False,
|
|
253
257
|
site: Site = Site.THS,
|
|
254
|
-
|
|
258
|
+
) -> pd.DataFrame:
|
|
255
259
|
"""查询表格
|
|
256
260
|
|
|
257
261
|
Parameters
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.10"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|