webresearcher-mcp-server 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.
- webresearcher_mcp_server-0.1.0/LICENSE +201 -0
- webresearcher_mcp_server-0.1.0/NOTICE +16 -0
- webresearcher_mcp_server-0.1.0/PKG-INFO +202 -0
- webresearcher_mcp_server-0.1.0/README.md +167 -0
- webresearcher_mcp_server-0.1.0/pyproject.toml +82 -0
- webresearcher_mcp_server-0.1.0/setup.cfg +4 -0
- webresearcher_mcp_server-0.1.0/tests/test_consent.py +194 -0
- webresearcher_mcp_server-0.1.0/tests/test_crawl.py +187 -0
- webresearcher_mcp_server-0.1.0/tests/test_ddg_search.py +118 -0
- webresearcher_mcp_server-0.1.0/tests/test_docker.py +117 -0
- webresearcher_mcp_server-0.1.0/tests/test_integration_live.py +59 -0
- webresearcher_mcp_server-0.1.0/tests/test_primitives.py +185 -0
- webresearcher_mcp_server-0.1.0/tests/test_protocol_http.py +70 -0
- webresearcher_mcp_server-0.1.0/tests/test_protocol_stdio.py +94 -0
- webresearcher_mcp_server-0.1.0/tests/test_server_handlers.py +193 -0
- webresearcher_mcp_server-0.1.0/tests/test_wiring.py +54 -0
- webresearcher_mcp_server-0.1.0/webresearch/__init__.py +10 -0
- webresearcher_mcp_server-0.1.0/webresearch/camoufox_scrape.py +259 -0
- webresearcher_mcp_server-0.1.0/webresearch/crawl.py +228 -0
- webresearcher_mcp_server-0.1.0/webresearch/ddg_search.py +136 -0
- webresearcher_mcp_server-0.1.0/webresearch/primitives.py +241 -0
- webresearcher_mcp_server-0.1.0/webresearch_mcp/__init__.py +9 -0
- webresearcher_mcp_server-0.1.0/webresearch_mcp/__main__.py +54 -0
- webresearcher_mcp_server-0.1.0/webresearch_mcp/server.py +251 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/PKG-INFO +202 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/SOURCES.txt +28 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/dependency_links.txt +1 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/entry_points.txt +2 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/requires.txt +16 -0
- webresearcher_mcp_server-0.1.0/webresearcher_mcp_server.egg-info/top_level.txt +2 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
webresearch-mcp
|
|
2
|
+
|
|
3
|
+
Portions of this software are derived from TradingAgents
|
|
4
|
+
(https://github.com/TauricResearch/TradingAgents), Copyright (c) its
|
|
5
|
+
contributors, and are licensed under the Apache License, Version 2.0:
|
|
6
|
+
|
|
7
|
+
- webresearch/camoufox_scrape.py is a copy of TradingAgents'
|
|
8
|
+
tradingagents/agents/utils/camoufox_scrape.py (anti-bot marker list
|
|
9
|
+
extended in webresearch/primitives.py).
|
|
10
|
+
- webresearch/primitives.py ports, verbatim or near-verbatim, the pure
|
|
11
|
+
helpers from TradingAgents' tradingagents/agents/utils/web_search.py:
|
|
12
|
+
query normalization, MCP content-block unwrapping, search-result item
|
|
13
|
+
extraction/formatting, call pacing, and the TTL+LRU result cache.
|
|
14
|
+
|
|
15
|
+
The remainder of this software is original work, licensed under
|
|
16
|
+
Apache-2.0 (see LICENSE).
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: webresearcher-mcp-server
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Standalone web-research MCP server: DuckDuckGo search + Camoufox stealth scrape/crawl (zero Firecrawl)
|
|
5
|
+
Author: Lukasz Kielbus
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/webresearcher-mcp-server/
|
|
8
|
+
Keywords: mcp,web-scraping,search,camoufox,duckduckgo
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: NOTICE
|
|
22
|
+
Requires-Dist: ddgs>=9.0
|
|
23
|
+
Requires-Dist: camoufox>=0.5.5
|
|
24
|
+
Provides-Extra: mcp
|
|
25
|
+
Requires-Dist: mcp<2.0.0,>=1.12.0; extra == "mcp"
|
|
26
|
+
Provides-Extra: test
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
28
|
+
Requires-Dist: pytest-timeout>=2.3; extra == "test"
|
|
29
|
+
Requires-Dist: httpx>=0.27; extra == "test"
|
|
30
|
+
Provides-Extra: lint
|
|
31
|
+
Requires-Dist: ruff>=0.15; extra == "lint"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: webresearcher-mcp-server[lint,mcp,test]; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# webresearcher-mcp-server
|
|
37
|
+
|
|
38
|
+
A light, standalone **web-research MCP server**: DuckDuckGo search, Camoufox
|
|
39
|
+
stealth scraping, and same-domain crawling — zero Firecrawl, no API keys, no
|
|
40
|
+
per-client browser download (in Docker mode).
|
|
41
|
+
|
|
42
|
+
It exposes four LLM-facing tools over MCP; the host LLM does the synthesis:
|
|
43
|
+
|
|
44
|
+
| Tool | What it does |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `web_search(query, limit=5)` | DuckDuckGo via [`ddgs`](https://github.com/hardkoded/ddgs) (browser-grade TLS). Numbered results: title, URL, snippet. |
|
|
47
|
+
| `web_scrape(url, max_chars=20000)` | [Camoufox](https://camoufox.com) stealth Firefox. Passes anti-bot walls that block ordinary fetchers; renders JS; auto-clicks cookie-consent banners (Yahoo/OneTrust/Cookiebot). `max_chars=0` = full text. |
|
|
48
|
+
| `web_crawl(url, limit=10)` | Starts a background same-domain BFS crawl (one browser, wall-detected per page). Returns a crawl id immediately — never blocks. |
|
|
49
|
+
| `web_crawl_status(crawl_id, max_chars=20000)` | Crawl progress; on completion, per-page URLs + content (0 = full text). |
|
|
50
|
+
|
|
51
|
+
Failures are graceful by design: a bot wall or outage returns a short
|
|
52
|
+
`SCRAPE UNAVAILABLE` / `SEARCH UNAVAILABLE` note (never an exception), and the
|
|
53
|
+
note tells the LLM not to retry the same URL/query.
|
|
54
|
+
|
|
55
|
+
## Why not just WebFetch / WebSearch?
|
|
56
|
+
|
|
57
|
+
This is **not** a replacement for your IDE's built-in fetch/search — it is the
|
|
58
|
+
tool for walled, JS-heavy, and multi-page research:
|
|
59
|
+
|
|
60
|
+
- **`web_scrape` beats built-in fetch on walled sites.** Verified live:
|
|
61
|
+
SeekingAlpha serves stock Playwright/HTTP clients a 130-char
|
|
62
|
+
*"Press & Hold to confirm you are a human"* wall (HTTP 200 — silent junk);
|
|
63
|
+
Camoufox passes the same wall with full article text. Runs on *your* IP with
|
|
64
|
+
a browser-grade fingerprint.
|
|
65
|
+
- **`web_crawl` has no built-in equivalent** (multi-page BFS + per-page wall
|
|
66
|
+
detection).
|
|
67
|
+
- **`web_search`** is free and independent of the harness's search
|
|
68
|
+
availability; built-in search has the better generic index — use both.
|
|
69
|
+
- Plain public static pages: the built-in fetch is fine, no need to route
|
|
70
|
+
everything through this server.
|
|
71
|
+
|
|
72
|
+
A typical session: `web_search("BOX stock news")` → `web_scrape` the 2–4 best
|
|
73
|
+
results → optional `web_crawl` of the newsroom → synthesize with citations.
|
|
74
|
+
|
|
75
|
+
## Quick start (uvx — no Docker)
|
|
76
|
+
|
|
77
|
+
Run it straight from PyPI. `uvx` auto-installs the package (and its `mcp`
|
|
78
|
+
extra) into an isolated env and runs the stdio server as an ordinary child
|
|
79
|
+
process — no Docker, no install step, and it's cleaned up when your session
|
|
80
|
+
ends:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uvx "webresearcher-mcp-server[mcp]" --help # sanity check
|
|
84
|
+
uvx "webresearcher-mcp-server[mcp]" # stdio server (default transport)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The Camoufox browser (used by `web_scrape`/`web_crawl`) is downloaded on
|
|
88
|
+
first use (~5 min one-time) or pre-fetched with `python -m camoufox fetch`.
|
|
89
|
+
|
|
90
|
+
**Shared HTTP server** (optional — one detached process shared by every
|
|
91
|
+
IDE/session so pacing + cache are global; the only Docker path we still use):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
docker build -t webresearch-mcp . # or: docker compose up -d
|
|
95
|
+
docker run -d --name webresearch-mcp -p 8001:8001 webresearch-mcp \
|
|
96
|
+
--transport streamable-http --host 0.0.0.0 --port 8001
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
(healthcheck: `curl -fs -X POST http://localhost:8001/mcp -H
|
|
100
|
+
'Content-Type: application/json' -H 'Accept: application/json,
|
|
101
|
+
text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` →
|
|
102
|
+
lists the four tools)
|
|
103
|
+
|
|
104
|
+
## Integrating with Claude Code / Cursor
|
|
105
|
+
|
|
106
|
+
### Claude Code
|
|
107
|
+
|
|
108
|
+
**uvx (recommended — no Docker):** add to your project `.mcp.json`
|
|
109
|
+
(or `claude mcp add`). First use auto-installs the package into an isolated
|
|
110
|
+
env (cached afterward); the server runs as an ordinary child process and is
|
|
111
|
+
cleaned up when the session ends:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{ "mcpServers": {
|
|
115
|
+
"webresearch": {
|
|
116
|
+
"command": "uvx",
|
|
117
|
+
"args": ["webresearcher-mcp-server[mcp]", "--transport", "stdio"]
|
|
118
|
+
} } }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
> **Avoid the `docker run -i --rm` per-session shape.** It leaks orphaned
|
|
122
|
+
> containers: Claude Code closes the child's stdin pipe on exit, the container
|
|
123
|
+
> (owned by the Docker daemon) never receives a stop signal, so `--rm` never
|
|
124
|
+
> fires and stray containers pile up. Known issue:
|
|
125
|
+
> [anthropics/claude-code#29058](https://github.com/anthropics/claude-code/issues/29058).
|
|
126
|
+
|
|
127
|
+
**Docker-HTTP (one detached container shared by all sessions):** run the
|
|
128
|
+
shared container above, then:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{ "mcpServers": { "webresearch": { "type": "http",
|
|
132
|
+
"url": "http://localhost:8001/mcp" } } }
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Plain venv (no `uv`/`uvx` on the box):** install the package in a venv, then:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{ "mcpServers": { "webresearch": {
|
|
139
|
+
"command": "/path/to/.venv/bin/python",
|
|
140
|
+
"args": ["-m", "webresearch_mcp"] } } }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Cursor
|
|
144
|
+
|
|
145
|
+
Same shapes in `~/.cursor/mcp.json` (user) or `.cursor/mcp.json` (project).
|
|
146
|
+
uvx (no Docker):
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{ "mcpServers": { "webresearch": {
|
|
150
|
+
"type": "stdio",
|
|
151
|
+
"command": "uvx",
|
|
152
|
+
"args": ["webresearcher-mcp-server[mcp]", "--transport", "stdio"] } } }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
or the `{"url": "http://localhost:8001/mcp"}` form for the shared HTTP
|
|
156
|
+
container. See [docs/integration.md](docs/integration.md) for the full
|
|
157
|
+
walkthrough, including the optional **cross-IDE plugin** (`plugin/`): one
|
|
158
|
+
directory, two manifests (Claude Code + Cursor), bundling the stdio server +
|
|
159
|
+
an always-on research rule + a `/research` command + a `web-researcher`
|
|
160
|
+
subagent — no Docker needed.
|
|
161
|
+
|
|
162
|
+
## Plain Python (no `uv`/`uvx`)
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
166
|
+
pip install "webresearcher-mcp-server[mcp]" # or: pip install -e ".[mcp]" from a clone
|
|
167
|
+
python -m camoufox fetch # one-time browser download
|
|
168
|
+
webresearcher-mcp-server # stdio server
|
|
169
|
+
webresearcher-mcp-server --transport streamable-http --port 8001
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Configuration (env vars)
|
|
173
|
+
|
|
174
|
+
| Variable | Default | Effect |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `WEBRESEARCH_MIN_CALL_INTERVAL_S` | `10` | Paces the *start* of search/scrape calls (rate-limit + anti-bot safety). |
|
|
177
|
+
| `WEBRESEARCH_SUCCESS_TTL_S` | `3600` | Cache TTL for successful search/scrape results. |
|
|
178
|
+
| `WEBRESEARCH_CACHE_SIZE` | `512` | LRU cache size (failures cached 60 s regardless). |
|
|
179
|
+
| `WEBRESEARCH_CRAWL_PAGE_DELAY_S` | `3` | Inter-page delay inside crawls (kept small so multi-page crawls stay fast). |
|
|
180
|
+
| `WEBRESEARCH_CONSENT_AUTOACCEPT` | `true` | Auto-click cookie-consent "accept" banners (Yahoo guce, OneTrust, Cookiebot). Set `false` to never click. |
|
|
181
|
+
| `TRADINGAGENTS_CAMOUFOX_HEADLESS` | `true` | Headless browser (set `false` to watch it work). |
|
|
182
|
+
| `TRADINGAGENTS_WEB_SCRAPE_TIMEOUT_S` | `120` | Per-page load timeout (s). |
|
|
183
|
+
|
|
184
|
+
Notes: crawl state is in-memory (a restart loses in-flight crawls); crawls
|
|
185
|
+
hold the single browser, so standalone scrapes queue behind an active crawl.
|
|
186
|
+
|
|
187
|
+
## Development
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pip install -e ".[mcp,test,lint]"
|
|
191
|
+
ruff check .
|
|
192
|
+
pytest -m "unit or smoke" # hermetic (CI runs exactly this)
|
|
193
|
+
pytest -m integration # live network + Docker (auto-skip if missing)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Layered markers: `unit` (pure helpers, patched seams), `smoke` (real MCP
|
|
197
|
+
protocol over stdio/HTTP against a hermetic fake upstream), `integration`
|
|
198
|
+
(live web + real browser + Docker image).
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
Apache-2.0. Portions derived from TradingAgents (Apache-2.0) — see `NOTICE`.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# webresearcher-mcp-server
|
|
2
|
+
|
|
3
|
+
A light, standalone **web-research MCP server**: DuckDuckGo search, Camoufox
|
|
4
|
+
stealth scraping, and same-domain crawling — zero Firecrawl, no API keys, no
|
|
5
|
+
per-client browser download (in Docker mode).
|
|
6
|
+
|
|
7
|
+
It exposes four LLM-facing tools over MCP; the host LLM does the synthesis:
|
|
8
|
+
|
|
9
|
+
| Tool | What it does |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `web_search(query, limit=5)` | DuckDuckGo via [`ddgs`](https://github.com/hardkoded/ddgs) (browser-grade TLS). Numbered results: title, URL, snippet. |
|
|
12
|
+
| `web_scrape(url, max_chars=20000)` | [Camoufox](https://camoufox.com) stealth Firefox. Passes anti-bot walls that block ordinary fetchers; renders JS; auto-clicks cookie-consent banners (Yahoo/OneTrust/Cookiebot). `max_chars=0` = full text. |
|
|
13
|
+
| `web_crawl(url, limit=10)` | Starts a background same-domain BFS crawl (one browser, wall-detected per page). Returns a crawl id immediately — never blocks. |
|
|
14
|
+
| `web_crawl_status(crawl_id, max_chars=20000)` | Crawl progress; on completion, per-page URLs + content (0 = full text). |
|
|
15
|
+
|
|
16
|
+
Failures are graceful by design: a bot wall or outage returns a short
|
|
17
|
+
`SCRAPE UNAVAILABLE` / `SEARCH UNAVAILABLE` note (never an exception), and the
|
|
18
|
+
note tells the LLM not to retry the same URL/query.
|
|
19
|
+
|
|
20
|
+
## Why not just WebFetch / WebSearch?
|
|
21
|
+
|
|
22
|
+
This is **not** a replacement for your IDE's built-in fetch/search — it is the
|
|
23
|
+
tool for walled, JS-heavy, and multi-page research:
|
|
24
|
+
|
|
25
|
+
- **`web_scrape` beats built-in fetch on walled sites.** Verified live:
|
|
26
|
+
SeekingAlpha serves stock Playwright/HTTP clients a 130-char
|
|
27
|
+
*"Press & Hold to confirm you are a human"* wall (HTTP 200 — silent junk);
|
|
28
|
+
Camoufox passes the same wall with full article text. Runs on *your* IP with
|
|
29
|
+
a browser-grade fingerprint.
|
|
30
|
+
- **`web_crawl` has no built-in equivalent** (multi-page BFS + per-page wall
|
|
31
|
+
detection).
|
|
32
|
+
- **`web_search`** is free and independent of the harness's search
|
|
33
|
+
availability; built-in search has the better generic index — use both.
|
|
34
|
+
- Plain public static pages: the built-in fetch is fine, no need to route
|
|
35
|
+
everything through this server.
|
|
36
|
+
|
|
37
|
+
A typical session: `web_search("BOX stock news")` → `web_scrape` the 2–4 best
|
|
38
|
+
results → optional `web_crawl` of the newsroom → synthesize with citations.
|
|
39
|
+
|
|
40
|
+
## Quick start (uvx — no Docker)
|
|
41
|
+
|
|
42
|
+
Run it straight from PyPI. `uvx` auto-installs the package (and its `mcp`
|
|
43
|
+
extra) into an isolated env and runs the stdio server as an ordinary child
|
|
44
|
+
process — no Docker, no install step, and it's cleaned up when your session
|
|
45
|
+
ends:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uvx "webresearcher-mcp-server[mcp]" --help # sanity check
|
|
49
|
+
uvx "webresearcher-mcp-server[mcp]" # stdio server (default transport)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The Camoufox browser (used by `web_scrape`/`web_crawl`) is downloaded on
|
|
53
|
+
first use (~5 min one-time) or pre-fetched with `python -m camoufox fetch`.
|
|
54
|
+
|
|
55
|
+
**Shared HTTP server** (optional — one detached process shared by every
|
|
56
|
+
IDE/session so pacing + cache are global; the only Docker path we still use):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
docker build -t webresearch-mcp . # or: docker compose up -d
|
|
60
|
+
docker run -d --name webresearch-mcp -p 8001:8001 webresearch-mcp \
|
|
61
|
+
--transport streamable-http --host 0.0.0.0 --port 8001
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(healthcheck: `curl -fs -X POST http://localhost:8001/mcp -H
|
|
65
|
+
'Content-Type: application/json' -H 'Accept: application/json,
|
|
66
|
+
text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` →
|
|
67
|
+
lists the four tools)
|
|
68
|
+
|
|
69
|
+
## Integrating with Claude Code / Cursor
|
|
70
|
+
|
|
71
|
+
### Claude Code
|
|
72
|
+
|
|
73
|
+
**uvx (recommended — no Docker):** add to your project `.mcp.json`
|
|
74
|
+
(or `claude mcp add`). First use auto-installs the package into an isolated
|
|
75
|
+
env (cached afterward); the server runs as an ordinary child process and is
|
|
76
|
+
cleaned up when the session ends:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "mcpServers": {
|
|
80
|
+
"webresearch": {
|
|
81
|
+
"command": "uvx",
|
|
82
|
+
"args": ["webresearcher-mcp-server[mcp]", "--transport", "stdio"]
|
|
83
|
+
} } }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
> **Avoid the `docker run -i --rm` per-session shape.** It leaks orphaned
|
|
87
|
+
> containers: Claude Code closes the child's stdin pipe on exit, the container
|
|
88
|
+
> (owned by the Docker daemon) never receives a stop signal, so `--rm` never
|
|
89
|
+
> fires and stray containers pile up. Known issue:
|
|
90
|
+
> [anthropics/claude-code#29058](https://github.com/anthropics/claude-code/issues/29058).
|
|
91
|
+
|
|
92
|
+
**Docker-HTTP (one detached container shared by all sessions):** run the
|
|
93
|
+
shared container above, then:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{ "mcpServers": { "webresearch": { "type": "http",
|
|
97
|
+
"url": "http://localhost:8001/mcp" } } }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Plain venv (no `uv`/`uvx` on the box):** install the package in a venv, then:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{ "mcpServers": { "webresearch": {
|
|
104
|
+
"command": "/path/to/.venv/bin/python",
|
|
105
|
+
"args": ["-m", "webresearch_mcp"] } } }
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Cursor
|
|
109
|
+
|
|
110
|
+
Same shapes in `~/.cursor/mcp.json` (user) or `.cursor/mcp.json` (project).
|
|
111
|
+
uvx (no Docker):
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{ "mcpServers": { "webresearch": {
|
|
115
|
+
"type": "stdio",
|
|
116
|
+
"command": "uvx",
|
|
117
|
+
"args": ["webresearcher-mcp-server[mcp]", "--transport", "stdio"] } } }
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
or the `{"url": "http://localhost:8001/mcp"}` form for the shared HTTP
|
|
121
|
+
container. See [docs/integration.md](docs/integration.md) for the full
|
|
122
|
+
walkthrough, including the optional **cross-IDE plugin** (`plugin/`): one
|
|
123
|
+
directory, two manifests (Claude Code + Cursor), bundling the stdio server +
|
|
124
|
+
an always-on research rule + a `/research` command + a `web-researcher`
|
|
125
|
+
subagent — no Docker needed.
|
|
126
|
+
|
|
127
|
+
## Plain Python (no `uv`/`uvx`)
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
131
|
+
pip install "webresearcher-mcp-server[mcp]" # or: pip install -e ".[mcp]" from a clone
|
|
132
|
+
python -m camoufox fetch # one-time browser download
|
|
133
|
+
webresearcher-mcp-server # stdio server
|
|
134
|
+
webresearcher-mcp-server --transport streamable-http --port 8001
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Configuration (env vars)
|
|
138
|
+
|
|
139
|
+
| Variable | Default | Effect |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| `WEBRESEARCH_MIN_CALL_INTERVAL_S` | `10` | Paces the *start* of search/scrape calls (rate-limit + anti-bot safety). |
|
|
142
|
+
| `WEBRESEARCH_SUCCESS_TTL_S` | `3600` | Cache TTL for successful search/scrape results. |
|
|
143
|
+
| `WEBRESEARCH_CACHE_SIZE` | `512` | LRU cache size (failures cached 60 s regardless). |
|
|
144
|
+
| `WEBRESEARCH_CRAWL_PAGE_DELAY_S` | `3` | Inter-page delay inside crawls (kept small so multi-page crawls stay fast). |
|
|
145
|
+
| `WEBRESEARCH_CONSENT_AUTOACCEPT` | `true` | Auto-click cookie-consent "accept" banners (Yahoo guce, OneTrust, Cookiebot). Set `false` to never click. |
|
|
146
|
+
| `TRADINGAGENTS_CAMOUFOX_HEADLESS` | `true` | Headless browser (set `false` to watch it work). |
|
|
147
|
+
| `TRADINGAGENTS_WEB_SCRAPE_TIMEOUT_S` | `120` | Per-page load timeout (s). |
|
|
148
|
+
|
|
149
|
+
Notes: crawl state is in-memory (a restart loses in-flight crawls); crawls
|
|
150
|
+
hold the single browser, so standalone scrapes queue behind an active crawl.
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
pip install -e ".[mcp,test,lint]"
|
|
156
|
+
ruff check .
|
|
157
|
+
pytest -m "unit or smoke" # hermetic (CI runs exactly this)
|
|
158
|
+
pytest -m integration # live network + Docker (auto-skip if missing)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Layered markers: `unit` (pure helpers, patched seams), `smoke` (real MCP
|
|
162
|
+
protocol over stdio/HTTP against a hermetic fake upstream), `integration`
|
|
163
|
+
(live web + real browser + Docker image).
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
Apache-2.0. Portions derived from TradingAgents (Apache-2.0) — see `NOTICE`.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "webresearcher-mcp-server"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Standalone web-research MCP server: DuckDuckGo search + Camoufox stealth scrape/crawl (zero Firecrawl)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "Lukasz Kielbus" }]
|
|
13
|
+
keywords = ["mcp", "web-scraping", "search", "camoufox", "duckduckgo"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"ddgs>=9.0",
|
|
27
|
+
"camoufox>=0.5.5",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://pypi.org/project/webresearcher-mcp-server/"
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
# mcp 2.x renamed FastMCP -> MCPServer and changed the API; we target the stable 1.x line.
|
|
35
|
+
mcp = ["mcp>=1.12.0,<2.0.0"]
|
|
36
|
+
test = ["pytest>=8.0", "pytest-timeout>=2.3", "httpx>=0.27"]
|
|
37
|
+
lint = ["ruff>=0.15"]
|
|
38
|
+
dev = ["webresearcher-mcp-server[mcp,test,lint]"]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
webresearcher-mcp-server = "webresearch_mcp.__main__:main"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
include = ["webresearch*", "webresearch_mcp*"]
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
addopts = "-ra --strict-markers --timeout=60"
|
|
49
|
+
markers = [
|
|
50
|
+
"unit: fast isolated unit tests (no network, no browser)",
|
|
51
|
+
"smoke: quick end-to-end checks over the real MCP transport (hermetic, fake upstream)",
|
|
52
|
+
"integration: live-network / Docker tests (auto-skip when the dependency is missing)",
|
|
53
|
+
]
|
|
54
|
+
filterwarnings = [
|
|
55
|
+
"ignore::DeprecationWarning",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[tool.coverage.run]
|
|
59
|
+
source = ["webresearch", "webresearch_mcp"]
|
|
60
|
+
branch = true
|
|
61
|
+
omit = ["*/tests/*"]
|
|
62
|
+
|
|
63
|
+
[tool.coverage.report]
|
|
64
|
+
fail_under = 85
|
|
65
|
+
skip_empty = true
|
|
66
|
+
show_missing = true
|
|
67
|
+
exclude_lines = [
|
|
68
|
+
"if TYPE_CHECKING:",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 100
|
|
73
|
+
target-version = "py310"
|
|
74
|
+
extend-exclude = ["results", "worklog"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
# Same rule set as TradingAgents for consistent style.
|
|
78
|
+
select = ["E", "W", "F", "I", "B", "UP", "C4", "SIM"]
|
|
79
|
+
ignore = ["E501"]
|
|
80
|
+
|
|
81
|
+
[tool.ruff.lint.per-file-ignores]
|
|
82
|
+
"**/__init__.py" = ["F401"] # intentional re-exports
|