URL Fetch MCP server

Enables Claude to retrieve and display web content, JSON data, and images directly within conversations through specialized URL fetching tools.
Back to servers
Provider
Amir Elaguizy
Release date
Mar 19, 2025
Language
Python
Stats
1 star

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.

Installation

You can install the URL Fetch MCP server using pip:

# Install from source
pip install -e .

Running the Server

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

Installing in Claude Desktop

Method 1: Direct Installation

# Install the package
pip install -e .

# Install in Claude Desktop 
mcp install url_fetcher.py -n "URL Fetcher"

Method 2: Use the Installer Script

# Install the package
pip install -e .

# Run the installer script
python scripts/install_desktop.py

Method 3: Use CLI Command

# Install the package
pip install -e .

# Install using the built-in CLI command
python -m url_fetch_mcp install-desktop

Available Tools

fetch_url

Fetches content from a URL and returns it as text.

Parameters:

  • url (required): The URL to fetch
  • headers (optional): Additional headers to send with the request
  • timeout (optional): Request timeout in seconds (default: 10)

fetch_image

Fetches an image from a URL and returns it as an image.

Parameters:

  • url (required): The URL to fetch the image from
  • timeout (optional): Request timeout in seconds (default: 10)

fetch_json

Fetches JSON from a URL, parses it, and returns it formatted.

Parameters:

  • url (required): The URL to fetch JSON from
  • headers (optional): Additional headers to send with the request
  • timeout (optional): Request timeout in seconds (default: 10)

Usage Examples

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"
})

Testing

You can verify the functionality with the included test scripts:

# Run a simplified test with the MCP server
python examples/quick_test.py

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later