Fetch MCP is an MCP reference server for making web content available to a client. This example calls its Python fetch function against synthetic HTML on container loopback and checks the error for a missing page.
What the isolated test checked
The extracted result should retain NOTE-31 and 08:30, while HTTP 404 should enter an error path. This test neither contacts a public website nor connects an AI host over MCP. Destination permissions and site policies require separate checks.
The following is the recorded synthetic output, not a model benchmark.
{
"result": [
"# Dispatch\n\nNOTE-31 leaves at 08:30.",
""
],
"missing": "ToolError",
"default_loopback": "ToolError"
}
Reproduce the small task
The recorded runtime was Linux with Python 3.12. Installation requires public package downloads; execution was offline. Windows shell behavior was not tested. Use a disposable environment for the example.
python -m pip install mcp-server-fetch==2026.11.11
The default call refuses loopback. Only the controlled fixture call enables allow_private_ips and restricts allowed_hosts to 127.0.0.1; use_readability_js=False selects the Python conversion path. This setting is for the isolated fixture, not a recommendation to expose private destinations.
import sys,json,traceback,importlib.metadata as meta,pathlib,asyncio,subprocess,os
SLUG='mcp-fetch'
def emit(package,checks,observations,**kw):
print(json.dumps({'checks':checks,'observations':observations},ensure_ascii=False,default=str,indent=2))
def mcp_fetch():
import threading,http.server,socketserver
from mcp_server_fetch.server import fetch_url
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
if self.path=='/missing':self.send_response(404);self.end_headers();return
body=b'<html><body><article><h1>Dispatch</h1><p>NOTE-31 leaves at 08:30.</p></article></body></html>';self.send_response(200);self.send_header('Content-Type','text/html');self.end_headers();self.wfile.write(body)
def log_message(self,*args):pass
server=socketserver.TCPServer(('127.0.0.1',0),Handler);threading.Thread(target=server.serve_forever,daemon=True).start();url=f'http://127.0.0.1:{server.server_address[1]}'
async def task():
try:await fetch_url(url,'GwarketFixture',False);default='accepted'
except Exception as e:default=type(e).__name__
a=await fetch_url(url,'GwarketFixture',False,allow_private_ips=True,allowed_hosts=('127.0.0.1',),use_readability_js=False)
try:await fetch_url(url+'/missing','GwarketFixture',False,allow_private_ips=True,allowed_hosts=('127.0.0.1',),use_readability_js=False);bad='accepted'
except Exception as e:bad=type(e).__name__
return a,bad,default
a,b,default=asyncio.run(task());server.shutdown();emit('mcp-server-fetch',dict(text='NOTE-31' in str(a),time='08:30' in str(a),missing=b!='accepted',default_blocks_loopback=default!='accepted'),dict(result=a,missing=b,default_loopback=default),scope='Default loopback refusal, then explicit allow_private_ips=True and allowed_hosts=(127.0.0.1,) for isolated fixture. Python HTML conversion path only, use_readability_js=False. No public sites, robots handling or stdio host claim.')
mcp_fetch()
Limits and untested behavior
Public-site robots handling, JavaScript pages, MCP stdio, AI hosts and SSRF protections remain untested. This is a pinned-version function test, not a promise that any URL can be fetched.
Other capabilities described in the pinned official documentation below were not locally tested. Source availability alone does not establish free hosted execution or free model calls.
Sources and test record
Codex ran the synthetic task in a non-root, network-disabled container without publishing credentials or private inputs. This is not a claim that the site owner personally tested the tool.
Tested package: 2026.11.11. Documentation commit: e1dc4b18dbb9. The registry package and README snapshot are separately pinned, not assumed identical. Test date: 2026-11-15.