The URL Fetch MCP server is a Model Context Protocol (MCP) implementation that allows Claude or any other LLM to retrieve content from URLs. It provides a clean interface for fetching various content types including HTML, JSON, text, and images with customizable request parameters.
You can install the URL Fetch MCP server using pip:
# Install from source
pip install -e .
The MCP server can be run in different modes depending on your needs:
# Run with stdio transport (for Claude Code)
python -m url_fetch_mcp run
# Run with HTTP+SSE transport (for remote connections)
python -m url_fetch_mcp run --transport sse --port 8000
# Install the package
pip install -e .
# Install in Claude Desktop
mcp install url_fetcher.py -n "URL Fetcher"
# Install the package
pip install -e .
# Run the installer script
python scripts/install_desktop.py
# Install the package
pip install -e .
# Install using the built-in CLI command
python -m url_fetch_mcp install-desktop
Fetches content from a URL and returns it as text.
Parameters:
url
(required): The URL to fetchheaders
(optional): Additional headers to send with the requesttimeout
(optional): Request timeout in seconds (default: 10)Fetches an image from a URL and returns it as an image.
Parameters:
url
(required): The URL to fetch the image fromtimeout
(optional): Request timeout in seconds (default: 10)Fetches JSON from a URL, parses it, and returns it formatted.
Parameters:
url
(required): The URL to fetch JSON fromheaders
(optional): Additional headers to send with the requesttimeout
(optional): Request timeout in seconds (default: 10)Here are some examples of how to use the URL Fetch MCP tools:
# Example of fetching a URL
result = await session.call_tool("fetch_url", {
"url": "https://example.com"
})
# Example of fetching JSON data
result = await session.call_tool("fetch_json", {
"url": "https://api.example.com/data",
"headers": {"Authorization": "Bearer token"}
})
# Example of fetching an image
result = await session.call_tool("fetch_image", {
"url": "https://example.com/image.jpg"
})
You can verify the functionality with the included test scripts:
# Run a simplified test with the MCP server
python examples/quick_test.py
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.