mcp-server-fetch 2025.1.14__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- mcp_server_fetch-2025.1.14/.gitignore +300 -0
- mcp_server_fetch-2025.1.14/.python-version +1 -0
- mcp_server_fetch-2025.1.14/Dockerfile +36 -0
- mcp_server_fetch-2025.1.14/LICENSE +7 -0
- mcp_server_fetch-2025.1.14/PKG-INFO +159 -0
- mcp_server_fetch-2025.1.14/README.md +136 -0
- mcp_server_fetch-2025.1.14/pyproject.toml +35 -0
- mcp_server_fetch-2025.1.14/src/mcp_server_fetch/__init__.py +24 -0
- mcp_server_fetch-2025.1.14/src/mcp_server_fetch/__main__.py +5 -0
- mcp_server_fetch-2025.1.14/src/mcp_server_fetch/server.py +284 -0
- mcp_server_fetch-2025.1.14/uv.lock +699 -0
@@ -0,0 +1,300 @@
|
|
1
|
+
# Logs
|
2
|
+
logs
|
3
|
+
*.log
|
4
|
+
npm-debug.log*
|
5
|
+
yarn-debug.log*
|
6
|
+
yarn-error.log*
|
7
|
+
lerna-debug.log*
|
8
|
+
.pnpm-debug.log*
|
9
|
+
|
10
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
11
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
12
|
+
|
13
|
+
# Runtime data
|
14
|
+
pids
|
15
|
+
*.pid
|
16
|
+
*.seed
|
17
|
+
*.pid.lock
|
18
|
+
|
19
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
20
|
+
lib-cov
|
21
|
+
|
22
|
+
# Coverage directory used by tools like istanbul
|
23
|
+
coverage
|
24
|
+
*.lcov
|
25
|
+
|
26
|
+
# nyc test coverage
|
27
|
+
.nyc_output
|
28
|
+
|
29
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
30
|
+
.grunt
|
31
|
+
|
32
|
+
# Bower dependency directory (https://bower.io/)
|
33
|
+
bower_components
|
34
|
+
|
35
|
+
# node-waf configuration
|
36
|
+
.lock-wscript
|
37
|
+
|
38
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
39
|
+
build/Release
|
40
|
+
|
41
|
+
# Dependency directories
|
42
|
+
node_modules/
|
43
|
+
jspm_packages/
|
44
|
+
|
45
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
46
|
+
web_modules/
|
47
|
+
|
48
|
+
# TypeScript cache
|
49
|
+
*.tsbuildinfo
|
50
|
+
|
51
|
+
# Optional npm cache directory
|
52
|
+
.npm
|
53
|
+
|
54
|
+
# Optional eslint cache
|
55
|
+
.eslintcache
|
56
|
+
|
57
|
+
# Optional stylelint cache
|
58
|
+
.stylelintcache
|
59
|
+
|
60
|
+
# Microbundle cache
|
61
|
+
.rpt2_cache/
|
62
|
+
.rts2_cache_cjs/
|
63
|
+
.rts2_cache_es/
|
64
|
+
.rts2_cache_umd/
|
65
|
+
|
66
|
+
# Optional REPL history
|
67
|
+
.node_repl_history
|
68
|
+
|
69
|
+
# Output of 'npm pack'
|
70
|
+
*.tgz
|
71
|
+
|
72
|
+
# Yarn Integrity file
|
73
|
+
.yarn-integrity
|
74
|
+
|
75
|
+
# dotenv environment variable files
|
76
|
+
.env
|
77
|
+
.env.development.local
|
78
|
+
.env.test.local
|
79
|
+
.env.production.local
|
80
|
+
.env.local
|
81
|
+
|
82
|
+
# parcel-bundler cache (https://parceljs.org/)
|
83
|
+
.cache
|
84
|
+
.parcel-cache
|
85
|
+
|
86
|
+
# Next.js build output
|
87
|
+
.next
|
88
|
+
out
|
89
|
+
|
90
|
+
# Nuxt.js build / generate output
|
91
|
+
.nuxt
|
92
|
+
dist
|
93
|
+
|
94
|
+
# Gatsby files
|
95
|
+
.cache/
|
96
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
97
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
98
|
+
# public
|
99
|
+
|
100
|
+
# vuepress build output
|
101
|
+
.vuepress/dist
|
102
|
+
|
103
|
+
# vuepress v2.x temp and cache directory
|
104
|
+
.temp
|
105
|
+
.cache
|
106
|
+
|
107
|
+
# Docusaurus cache and generated files
|
108
|
+
.docusaurus
|
109
|
+
|
110
|
+
# Serverless directories
|
111
|
+
.serverless/
|
112
|
+
|
113
|
+
# FuseBox cache
|
114
|
+
.fusebox/
|
115
|
+
|
116
|
+
# DynamoDB Local files
|
117
|
+
.dynamodb/
|
118
|
+
|
119
|
+
# TernJS port file
|
120
|
+
.tern-port
|
121
|
+
|
122
|
+
# Stores VSCode versions used for testing VSCode extensions
|
123
|
+
.vscode-test
|
124
|
+
|
125
|
+
# yarn v2
|
126
|
+
.yarn/cache
|
127
|
+
.yarn/unplugged
|
128
|
+
.yarn/build-state.yml
|
129
|
+
.yarn/install-state.gz
|
130
|
+
.pnp.*
|
131
|
+
|
132
|
+
build/
|
133
|
+
|
134
|
+
gcp-oauth.keys.json
|
135
|
+
.*-server-credentials.json
|
136
|
+
|
137
|
+
# Byte-compiled / optimized / DLL files
|
138
|
+
__pycache__/
|
139
|
+
*.py[cod]
|
140
|
+
*$py.class
|
141
|
+
|
142
|
+
# C extensions
|
143
|
+
*.so
|
144
|
+
|
145
|
+
# Distribution / packaging
|
146
|
+
.Python
|
147
|
+
build/
|
148
|
+
develop-eggs/
|
149
|
+
dist/
|
150
|
+
downloads/
|
151
|
+
eggs/
|
152
|
+
.eggs/
|
153
|
+
lib/
|
154
|
+
lib64/
|
155
|
+
parts/
|
156
|
+
sdist/
|
157
|
+
var/
|
158
|
+
wheels/
|
159
|
+
share/python-wheels/
|
160
|
+
*.egg-info/
|
161
|
+
.installed.cfg
|
162
|
+
*.egg
|
163
|
+
MANIFEST
|
164
|
+
|
165
|
+
# PyInstaller
|
166
|
+
# Usually these files are written by a python script from a template
|
167
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
168
|
+
*.manifest
|
169
|
+
*.spec
|
170
|
+
|
171
|
+
# Installer logs
|
172
|
+
pip-log.txt
|
173
|
+
pip-delete-this-directory.txt
|
174
|
+
|
175
|
+
# Unit test / coverage reports
|
176
|
+
htmlcov/
|
177
|
+
.tox/
|
178
|
+
.nox/
|
179
|
+
.coverage
|
180
|
+
.coverage.*
|
181
|
+
.cache
|
182
|
+
nosetests.xml
|
183
|
+
coverage.xml
|
184
|
+
*.cover
|
185
|
+
*.py,cover
|
186
|
+
.hypothesis/
|
187
|
+
.pytest_cache/
|
188
|
+
cover/
|
189
|
+
|
190
|
+
# Translations
|
191
|
+
*.mo
|
192
|
+
*.pot
|
193
|
+
|
194
|
+
# Django stuff:
|
195
|
+
*.log
|
196
|
+
local_settings.py
|
197
|
+
db.sqlite3
|
198
|
+
db.sqlite3-journal
|
199
|
+
|
200
|
+
# Flask stuff:
|
201
|
+
instance/
|
202
|
+
.webassets-cache
|
203
|
+
|
204
|
+
# Scrapy stuff:
|
205
|
+
.scrapy
|
206
|
+
|
207
|
+
# Sphinx documentation
|
208
|
+
docs/_build/
|
209
|
+
|
210
|
+
# PyBuilder
|
211
|
+
.pybuilder/
|
212
|
+
target/
|
213
|
+
|
214
|
+
# Jupyter Notebook
|
215
|
+
.ipynb_checkpoints
|
216
|
+
|
217
|
+
# IPython
|
218
|
+
profile_default/
|
219
|
+
ipython_config.py
|
220
|
+
|
221
|
+
# pyenv
|
222
|
+
# For a library or package, you might want to ignore these files since the code is
|
223
|
+
# intended to run in multiple environments; otherwise, check them in:
|
224
|
+
# .python-version
|
225
|
+
|
226
|
+
# pipenv
|
227
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
228
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
229
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
230
|
+
# install all needed dependencies.
|
231
|
+
#Pipfile.lock
|
232
|
+
|
233
|
+
# poetry
|
234
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
235
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
236
|
+
# commonly ignored for libraries.
|
237
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
238
|
+
#poetry.lock
|
239
|
+
|
240
|
+
# pdm
|
241
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
242
|
+
#pdm.lock
|
243
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
244
|
+
# in version control.
|
245
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
246
|
+
.pdm.toml
|
247
|
+
.pdm-python
|
248
|
+
.pdm-build/
|
249
|
+
|
250
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
251
|
+
__pypackages__/
|
252
|
+
|
253
|
+
# Celery stuff
|
254
|
+
celerybeat-schedule
|
255
|
+
celerybeat.pid
|
256
|
+
|
257
|
+
# SageMath parsed files
|
258
|
+
*.sage.py
|
259
|
+
|
260
|
+
# Environments
|
261
|
+
.env
|
262
|
+
.venv
|
263
|
+
env/
|
264
|
+
venv/
|
265
|
+
ENV/
|
266
|
+
env.bak/
|
267
|
+
venv.bak/
|
268
|
+
|
269
|
+
# Spyder project settings
|
270
|
+
.spyderproject
|
271
|
+
.spyproject
|
272
|
+
|
273
|
+
# Rope project settings
|
274
|
+
.ropeproject
|
275
|
+
|
276
|
+
# mkdocs documentation
|
277
|
+
/site
|
278
|
+
|
279
|
+
# mypy
|
280
|
+
.mypy_cache/
|
281
|
+
.dmypy.json
|
282
|
+
dmypy.json
|
283
|
+
|
284
|
+
# Pyre type checker
|
285
|
+
.pyre/
|
286
|
+
|
287
|
+
# pytype static type analyzer
|
288
|
+
.pytype/
|
289
|
+
|
290
|
+
# Cython debug symbols
|
291
|
+
cython_debug/
|
292
|
+
|
293
|
+
.DS_Store
|
294
|
+
|
295
|
+
# PyCharm
|
296
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
297
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
298
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
299
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
300
|
+
#.idea/
|
@@ -0,0 +1 @@
|
|
1
|
+
3.11
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Use a Python image with uv pre-installed
|
2
|
+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
|
3
|
+
|
4
|
+
# Install the project into `/app`
|
5
|
+
WORKDIR /app
|
6
|
+
|
7
|
+
# Enable bytecode compilation
|
8
|
+
ENV UV_COMPILE_BYTECODE=1
|
9
|
+
|
10
|
+
# Copy from the cache instead of linking since it's a mounted volume
|
11
|
+
ENV UV_LINK_MODE=copy
|
12
|
+
|
13
|
+
# Install the project's dependencies using the lockfile and settings
|
14
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
15
|
+
--mount=type=bind,source=uv.lock,target=uv.lock \
|
16
|
+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
17
|
+
uv sync --frozen --no-install-project --no-dev --no-editable
|
18
|
+
|
19
|
+
# Then, add the rest of the project source code and install it
|
20
|
+
# Installing separately from its dependencies allows optimal layer caching
|
21
|
+
ADD . /app
|
22
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
23
|
+
uv sync --frozen --no-dev --no-editable
|
24
|
+
|
25
|
+
FROM python:3.12-slim-bookworm
|
26
|
+
|
27
|
+
WORKDIR /app
|
28
|
+
|
29
|
+
COPY --from=uv /root/.local /root/.local
|
30
|
+
COPY --from=uv --chown=app:app /app/.venv /app/.venv
|
31
|
+
|
32
|
+
# Place executables in the environment at the front of the path
|
33
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
34
|
+
|
35
|
+
# when running the container, add --db-path and a bind mount to the host's db file
|
36
|
+
ENTRYPOINT ["mcp-server-fetch"]
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2024 Anthropic, PBC.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,159 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: mcp-server-fetch
|
3
|
+
Version: 2025.1.14
|
4
|
+
Summary: A Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs
|
5
|
+
Author: Anthropic, PBC.
|
6
|
+
Maintainer-email: Jack Adamson <jadamson@anthropic.com>
|
7
|
+
License: MIT
|
8
|
+
License-File: LICENSE
|
9
|
+
Keywords: automation,http,llm,mcp
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Requires-Python: >=3.10
|
16
|
+
Requires-Dist: markdownify>=0.13.1
|
17
|
+
Requires-Dist: mcp>=1.0.0
|
18
|
+
Requires-Dist: protego>=0.3.1
|
19
|
+
Requires-Dist: pydantic>=2.0.0
|
20
|
+
Requires-Dist: readabilipy>=0.2.0
|
21
|
+
Requires-Dist: requests>=2.32.3
|
22
|
+
Description-Content-Type: text/markdown
|
23
|
+
|
24
|
+
# Fetch MCP Server
|
25
|
+
|
26
|
+
A Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.
|
27
|
+
|
28
|
+
The fetch tool will truncate the response, but by using the `start_index` argument, you can specify where to start the content extraction. This lets models read a webpage in chunks, until they find the information they need.
|
29
|
+
|
30
|
+
### Available Tools
|
31
|
+
|
32
|
+
- `fetch` - Fetches a URL from the internet and extracts its contents as markdown.
|
33
|
+
- `url` (string, required): URL to fetch
|
34
|
+
- `max_length` (integer, optional): Maximum number of characters to return (default: 5000)
|
35
|
+
- `start_index` (integer, optional): Start content from this character index (default: 0)
|
36
|
+
- `raw` (boolean, optional): Get raw content without markdown conversion (default: false)
|
37
|
+
|
38
|
+
### Prompts
|
39
|
+
|
40
|
+
- **fetch**
|
41
|
+
- Fetch a URL and extract its contents as markdown
|
42
|
+
- Arguments:
|
43
|
+
- `url` (string, required): URL to fetch
|
44
|
+
|
45
|
+
## Installation
|
46
|
+
|
47
|
+
Optionally: Install node.js, this will cause the fetch server to use a different HTML simplifier that is more robust.
|
48
|
+
|
49
|
+
### Using uv (recommended)
|
50
|
+
|
51
|
+
When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
|
52
|
+
use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-fetch*.
|
53
|
+
|
54
|
+
### Using PIP
|
55
|
+
|
56
|
+
Alternatively you can install `mcp-server-fetch` via pip:
|
57
|
+
|
58
|
+
```
|
59
|
+
pip install mcp-server-fetch
|
60
|
+
```
|
61
|
+
|
62
|
+
After installation, you can run it as a script using:
|
63
|
+
|
64
|
+
```
|
65
|
+
python -m mcp_server_fetch
|
66
|
+
```
|
67
|
+
|
68
|
+
## Configuration
|
69
|
+
|
70
|
+
### Configure for Claude.app
|
71
|
+
|
72
|
+
Add to your Claude settings:
|
73
|
+
|
74
|
+
<details>
|
75
|
+
<summary>Using uvx</summary>
|
76
|
+
|
77
|
+
```json
|
78
|
+
"mcpServers": {
|
79
|
+
"fetch": {
|
80
|
+
"command": "uvx",
|
81
|
+
"args": ["mcp-server-fetch"]
|
82
|
+
}
|
83
|
+
}
|
84
|
+
```
|
85
|
+
</details>
|
86
|
+
|
87
|
+
<details>
|
88
|
+
<summary>Using docker</summary>
|
89
|
+
|
90
|
+
```json
|
91
|
+
"mcpServers": {
|
92
|
+
"fetch": {
|
93
|
+
"command": "docker",
|
94
|
+
"args": ["run", "-i", "--rm", "mcp/fetch"]
|
95
|
+
}
|
96
|
+
}
|
97
|
+
```
|
98
|
+
</details>
|
99
|
+
|
100
|
+
<details>
|
101
|
+
<summary>Using pip installation</summary>
|
102
|
+
|
103
|
+
```json
|
104
|
+
"mcpServers": {
|
105
|
+
"fetch": {
|
106
|
+
"command": "python",
|
107
|
+
"args": ["-m", "mcp_server_fetch"]
|
108
|
+
}
|
109
|
+
}
|
110
|
+
```
|
111
|
+
</details>
|
112
|
+
|
113
|
+
### Customization - robots.txt
|
114
|
+
|
115
|
+
By default, the server will obey a websites robots.txt file if the request came from the model (via a tool), but not if
|
116
|
+
the request was user initiated (via a prompt). This can be disabled by adding the argument `--ignore-robots-txt` to the
|
117
|
+
`args` list in the configuration.
|
118
|
+
|
119
|
+
### Customization - User-agent
|
120
|
+
|
121
|
+
By default, depending on if the request came from the model (via a tool), or was user initiated (via a prompt), the
|
122
|
+
server will use either the user-agent
|
123
|
+
```
|
124
|
+
ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)
|
125
|
+
```
|
126
|
+
or
|
127
|
+
```
|
128
|
+
ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)
|
129
|
+
```
|
130
|
+
|
131
|
+
This can be customized by adding the argument `--user-agent=YourUserAgent` to the `args` list in the configuration.
|
132
|
+
|
133
|
+
## Debugging
|
134
|
+
|
135
|
+
You can use the MCP inspector to debug the server. For uvx installations:
|
136
|
+
|
137
|
+
```
|
138
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-fetch
|
139
|
+
```
|
140
|
+
|
141
|
+
Or if you've installed the package in a specific directory or are developing on it:
|
142
|
+
|
143
|
+
```
|
144
|
+
cd path/to/servers/src/fetch
|
145
|
+
npx @modelcontextprotocol/inspector uv run mcp-server-fetch
|
146
|
+
```
|
147
|
+
|
148
|
+
## Contributing
|
149
|
+
|
150
|
+
We encourage contributions to help expand and improve mcp-server-fetch. Whether you want to add new tools, enhance existing functionality, or improve documentation, your input is valuable.
|
151
|
+
|
152
|
+
For examples of other MCP servers and implementation patterns, see:
|
153
|
+
https://github.com/modelcontextprotocol/servers
|
154
|
+
|
155
|
+
Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-fetch even more powerful and useful.
|
156
|
+
|
157
|
+
## License
|
158
|
+
|
159
|
+
mcp-server-fetch is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# Fetch MCP Server
|
2
|
+
|
3
|
+
A Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.
|
4
|
+
|
5
|
+
The fetch tool will truncate the response, but by using the `start_index` argument, you can specify where to start the content extraction. This lets models read a webpage in chunks, until they find the information they need.
|
6
|
+
|
7
|
+
### Available Tools
|
8
|
+
|
9
|
+
- `fetch` - Fetches a URL from the internet and extracts its contents as markdown.
|
10
|
+
- `url` (string, required): URL to fetch
|
11
|
+
- `max_length` (integer, optional): Maximum number of characters to return (default: 5000)
|
12
|
+
- `start_index` (integer, optional): Start content from this character index (default: 0)
|
13
|
+
- `raw` (boolean, optional): Get raw content without markdown conversion (default: false)
|
14
|
+
|
15
|
+
### Prompts
|
16
|
+
|
17
|
+
- **fetch**
|
18
|
+
- Fetch a URL and extract its contents as markdown
|
19
|
+
- Arguments:
|
20
|
+
- `url` (string, required): URL to fetch
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
Optionally: Install node.js, this will cause the fetch server to use a different HTML simplifier that is more robust.
|
25
|
+
|
26
|
+
### Using uv (recommended)
|
27
|
+
|
28
|
+
When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
|
29
|
+
use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-fetch*.
|
30
|
+
|
31
|
+
### Using PIP
|
32
|
+
|
33
|
+
Alternatively you can install `mcp-server-fetch` via pip:
|
34
|
+
|
35
|
+
```
|
36
|
+
pip install mcp-server-fetch
|
37
|
+
```
|
38
|
+
|
39
|
+
After installation, you can run it as a script using:
|
40
|
+
|
41
|
+
```
|
42
|
+
python -m mcp_server_fetch
|
43
|
+
```
|
44
|
+
|
45
|
+
## Configuration
|
46
|
+
|
47
|
+
### Configure for Claude.app
|
48
|
+
|
49
|
+
Add to your Claude settings:
|
50
|
+
|
51
|
+
<details>
|
52
|
+
<summary>Using uvx</summary>
|
53
|
+
|
54
|
+
```json
|
55
|
+
"mcpServers": {
|
56
|
+
"fetch": {
|
57
|
+
"command": "uvx",
|
58
|
+
"args": ["mcp-server-fetch"]
|
59
|
+
}
|
60
|
+
}
|
61
|
+
```
|
62
|
+
</details>
|
63
|
+
|
64
|
+
<details>
|
65
|
+
<summary>Using docker</summary>
|
66
|
+
|
67
|
+
```json
|
68
|
+
"mcpServers": {
|
69
|
+
"fetch": {
|
70
|
+
"command": "docker",
|
71
|
+
"args": ["run", "-i", "--rm", "mcp/fetch"]
|
72
|
+
}
|
73
|
+
}
|
74
|
+
```
|
75
|
+
</details>
|
76
|
+
|
77
|
+
<details>
|
78
|
+
<summary>Using pip installation</summary>
|
79
|
+
|
80
|
+
```json
|
81
|
+
"mcpServers": {
|
82
|
+
"fetch": {
|
83
|
+
"command": "python",
|
84
|
+
"args": ["-m", "mcp_server_fetch"]
|
85
|
+
}
|
86
|
+
}
|
87
|
+
```
|
88
|
+
</details>
|
89
|
+
|
90
|
+
### Customization - robots.txt
|
91
|
+
|
92
|
+
By default, the server will obey a websites robots.txt file if the request came from the model (via a tool), but not if
|
93
|
+
the request was user initiated (via a prompt). This can be disabled by adding the argument `--ignore-robots-txt` to the
|
94
|
+
`args` list in the configuration.
|
95
|
+
|
96
|
+
### Customization - User-agent
|
97
|
+
|
98
|
+
By default, depending on if the request came from the model (via a tool), or was user initiated (via a prompt), the
|
99
|
+
server will use either the user-agent
|
100
|
+
```
|
101
|
+
ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)
|
102
|
+
```
|
103
|
+
or
|
104
|
+
```
|
105
|
+
ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)
|
106
|
+
```
|
107
|
+
|
108
|
+
This can be customized by adding the argument `--user-agent=YourUserAgent` to the `args` list in the configuration.
|
109
|
+
|
110
|
+
## Debugging
|
111
|
+
|
112
|
+
You can use the MCP inspector to debug the server. For uvx installations:
|
113
|
+
|
114
|
+
```
|
115
|
+
npx @modelcontextprotocol/inspector uvx mcp-server-fetch
|
116
|
+
```
|
117
|
+
|
118
|
+
Or if you've installed the package in a specific directory or are developing on it:
|
119
|
+
|
120
|
+
```
|
121
|
+
cd path/to/servers/src/fetch
|
122
|
+
npx @modelcontextprotocol/inspector uv run mcp-server-fetch
|
123
|
+
```
|
124
|
+
|
125
|
+
## Contributing
|
126
|
+
|
127
|
+
We encourage contributions to help expand and improve mcp-server-fetch. Whether you want to add new tools, enhance existing functionality, or improve documentation, your input is valuable.
|
128
|
+
|
129
|
+
For examples of other MCP servers and implementation patterns, see:
|
130
|
+
https://github.com/modelcontextprotocol/servers
|
131
|
+
|
132
|
+
Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-fetch even more powerful and useful.
|
133
|
+
|
134
|
+
## License
|
135
|
+
|
136
|
+
mcp-server-fetch is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
[project]
|
2
|
+
name = "mcp-server-fetch"
|
3
|
+
version = "2025.1.14"
|
4
|
+
description = "A Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs"
|
5
|
+
readme = "README.md"
|
6
|
+
requires-python = ">=3.10"
|
7
|
+
authors = [{ name = "Anthropic, PBC." }]
|
8
|
+
maintainers = [{ name = "Jack Adamson", email = "jadamson@anthropic.com" }]
|
9
|
+
keywords = ["http", "mcp", "llm", "automation"]
|
10
|
+
license = { text = "MIT" }
|
11
|
+
classifiers = [
|
12
|
+
"Development Status :: 4 - Beta",
|
13
|
+
"Intended Audience :: Developers",
|
14
|
+
"License :: OSI Approved :: MIT License",
|
15
|
+
"Programming Language :: Python :: 3",
|
16
|
+
"Programming Language :: Python :: 3.10",
|
17
|
+
]
|
18
|
+
dependencies = [
|
19
|
+
"markdownify>=0.13.1",
|
20
|
+
"mcp>=1.0.0",
|
21
|
+
"protego>=0.3.1",
|
22
|
+
"pydantic>=2.0.0",
|
23
|
+
"readabilipy>=0.2.0",
|
24
|
+
"requests>=2.32.3",
|
25
|
+
]
|
26
|
+
|
27
|
+
[project.scripts]
|
28
|
+
mcp-server-fetch = "mcp_server_fetch:main"
|
29
|
+
|
30
|
+
[build-system]
|
31
|
+
requires = ["hatchling"]
|
32
|
+
build-backend = "hatchling.build"
|
33
|
+
|
34
|
+
[tool.uv]
|
35
|
+
dev-dependencies = ["pyright>=1.1.389", "ruff>=0.7.3"]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from .server import serve
|
2
|
+
|
3
|
+
|
4
|
+
def main():
|
5
|
+
"""MCP Fetch Server - HTTP fetching functionality for MCP"""
|
6
|
+
import argparse
|
7
|
+
import asyncio
|
8
|
+
|
9
|
+
parser = argparse.ArgumentParser(
|
10
|
+
description="give a model the ability to make web requests"
|
11
|
+
)
|
12
|
+
parser.add_argument("--user-agent", type=str, help="Custom User-Agent string")
|
13
|
+
parser.add_argument(
|
14
|
+
"--ignore-robots-txt",
|
15
|
+
action="store_true",
|
16
|
+
help="Ignore robots.txt restrictions",
|
17
|
+
)
|
18
|
+
|
19
|
+
args = parser.parse_args()
|
20
|
+
asyncio.run(serve(args.user_agent, args.ignore_robots_txt))
|
21
|
+
|
22
|
+
|
23
|
+
if __name__ == "__main__":
|
24
|
+
main()
|