MCP Server Fetch
MCP Server Fetch is a Python library that provides a server implementation for the Model Context Protocol (MCP). It's designed to fetch, process, and convert web content into a format suitable for use by Large Language Models (LLMs). As of version `2025.4.7`, it offers a robust solution for web data ingestion within an LLM ecosystem. The project follows a rapid, approximately monthly, release cadence, often aligning with a YYYY.M.D versioning scheme.
Warnings
- gotcha It is crucial to understand that `mcp-server-fetch` provides the server application itself, while programmatic interaction with a running server (e.g., fetching URLs) requires the separate `mcp-client` library. Do not attempt to import client-side utilities like `MCPClient` from `mcp-server-fetch`.
- gotcha The server's behavior and accessibility (e.g., CORS, debug settings, API keys) are heavily reliant on environment variables. Failing to set these correctly can lead to unexpected errors or security vulnerabilities.
- breaking Due to its rapid development cycle (monthly releases) and its position within an evolving protocol ecosystem, API stability between major monthly versions (e.g., from `2025.3.x` to `2025.4.x`) may not be strictly guaranteed. Breaking changes, while not always explicitly detailed in changelogs, can occur.
- gotcha Running the server programmatically as shown in the quickstart requires `uvicorn` to be installed. While `mcp-server-fetch` lists `uvicorn` as an optional dependency (via `[all]` extra), it's a runtime necessity for most deployments.
Install
-
pip install mcp-server-fetch -
pip install 'mcp-server-fetch[all]'
Imports
- create_app
from mcp_server_fetch.server import create_app
Quickstart
import uvicorn
from mcp_server_fetch.server import create_app
import os
import asyncio
# Configure necessary environment variables, e.g., for CORS or debug mode
os.environ['CORS_ORIGINS'] = 'http://localhost:3000,http://127.0.0.1:3000'
os.environ['MCP_DEBUG'] = 'true'
# Create the FastAPI application instance
app = create_app()
async def run_server():
print("Starting MCP Server Fetch on http://127.0.0.1:8000")
print("Use Ctrl+C to stop the server.")
config = uvicorn.Config(app, host="127.0.0.1", port=8000, log_level="info")
server = uvicorn.Server(config)
await server.serve()
if __name__ == "__main__":
# This demonstrates programmatic startup. More commonly, you'd run from CLI:
# uvicorn mcp_server_fetch.server:app --host 127.0.0.1 --port 8000
try:
asyncio.run(run_server())
except KeyboardInterrupt:
print("\nServer stopped.")