Skip to main content

A Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs (robots.txt checking removed)

Project description

MCP Fetch

A Model Context Protocol server that provides web content fetching capabilities with robots.txt checking removed. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.

This is a modified version of the original mcp-server-fetch that removes all robots.txt checking, allowing unrestricted access to web content.

[!CAUTION] This server can access local/internal IP addresses and may represent a security risk. Exercise caution when using this MCP server to ensure this does not expose any sensitive data. Additionally, this version ignores robots.txt restrictions which may violate some websites' access policies.

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.

Available Tools

  • fetch - Fetches a URL from the internet and extracts its contents as markdown.
    • url (string, required): URL to fetch
    • max_length (integer, optional): Maximum number of characters to return (default: 5000)
    • start_index (integer, optional): Start content from this character index (default: 0)
    • raw (boolean, optional): Get raw content without markdown conversion (default: false)

Available Prompts

  • fetch
    • Fetch a URL and extract its contents as markdown
    • Arguments:
      • url (string, required): URL to fetch

Installation and Usage

Local Development Setup

  1. Clone or download the source code:

    git clone <repository-url>
    cd mcp-web-fetch
    
  2. Install dependencies using uv:

    uv sync
    
  3. Test the server:

    uv run python -m mcp_server_fetch --help
    

Using with Claude Desktop (Local Source)

  1. Create Claude Desktop configuration:

    {
      "mcpServers": {
        "mcp-fetch": {
          "command": "uv",
          "args": [
            "run",
            "--directory",
            "/path/to/your/mcp-web-fetch",
            "python",
            "-m",
            "mcp_server_fetch"
          ]
        }
      }
    }
    
  2. Add configuration to Claude Desktop:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  3. Restart Claude Desktop to load the new server.

Using with VS Code (Local Source)

Add to your VS Code settings or .vscode/mcp.json:

{
  "mcp": {
    "servers": {
      "mcp-fetch": {
        "command": "uv",
        "args": [
          "run",
          "--directory",
          "/path/to/your/mcp-web-fetch",
          "python",
          "-m",
          "mcp_server_fetch"
        ]
      }
    }
  }
}

Installation via Package Manager

Using uv (recommended)

When using uv no specific installation is needed. We will use uvx to directly run mcp-fetch:

uvx mcp-fetch

Using pip

pip install mcp-fetch

After installation, run it as:

python -m mcp_server_fetch

Package Manager Configuration

Claude Desktop with uvx

{
  "mcpServers": {
    "mcp-fetch": {
      "command": "uvx",
      "args": ["mcp-web-fetch"]
    }
  }
}

VS Code with uvx

{
  "mcp": {
    "servers": {
      "mcp-fetch": {
        "command": "uvx",
        "args": ["mcp-fetch"]
      }
    }
  }
}

Development

Setting up Development Environment

  1. Install development dependencies:

    uv sync --dev
    
  2. Run linting and type checking:

    uv run ruff check
    uv run pyright
    
  3. Build the package:

    uv build
    

Testing

Test the server locally:

uv run python -m mcp_server_fetch

Use the MCP inspector for debugging:

npx @modelcontextprotocol/inspector uv run python -m mcp_server_fetch

Making Changes

  1. Edit the source code in src/mcp_server_fetch/
  2. Test your changes with uv run python -m mcp_server_fetch
  3. Update version in pyproject.toml if needed
  4. Run tests and linting

Publishing

Publishing to PyPI

  1. Build the package:

    uv build
    
  2. Publish to PyPI:

    uv publish
    

    Or using twine:

    pip install twine
    twine upload dist/*
    

Publishing to GitHub

  1. Initialize git repository (if not already done):

    git init
    git branch -m main
    
  2. Add and commit files:

    git add .
    git commit -m "Initial commit: MCP Web Fetch server without robots.txt checking"
    
  3. Create GitHub repository and push:

    # Create repository on GitHub first, then:
    git remote add origin https://github.com/langgpt/mcp-web-fetch.git
    git push -u origin main
    
  4. Create a release on GitHub:

    • Go to your repository on GitHub
    • Click "Releases" → "Create a new release"
    • Tag version: v0.6.3
    • Release title: v0.6.3 - MCP Web Fetch
    • Describe your changes
    • Publish release

Building Docker Image

docker build -t mcp-web-fetch .
docker tag mcp-web-fetch langgpt/mcp-web-fetch:latest
docker push langgpt/mcp-web-fetch:latest

Customization

robots.txt

This version has robots.txt checking completely removed. All web requests will proceed regardless of robots.txt restrictions.

User-agent

By default, depending on if the request came from the model (via a tool), or was user initiated (via a prompt), the server will use either the user-agent:

ModelContextProtocol/1.0 (Autonomous; +https://github.com/modelcontextprotocol/servers)

or:

ModelContextProtocol/1.0 (User-Specified; +https://github.com/modelcontextprotocol/servers)

This can be customized by adding the argument --user-agent=YourUserAgent to the args list in the configuration.

Proxy

The server can be configured to use a proxy by using the --proxy-url argument.

Debugging

You can use the MCP inspector to debug the server:

For local development:

npx @modelcontextprotocol/inspector uv run python -m mcp_server_fetch

For uvx installations:

npx @modelcontextprotocol/inspector uvx mcp-fetch

Contributing

This is a modified version of the original mcp-server-fetch. For contributing to the original project, see: https://github.com/modelcontextprotocol/servers

For this modified version, please submit issues and pull requests to this repository.

License

mcp-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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_fetch-0.6.3.tar.gz (41.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_fetch-0.6.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file mcp_fetch-0.6.3.tar.gz.

File metadata

  • Download URL: mcp_fetch-0.6.3.tar.gz
  • Upload date:
  • Size: 41.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for mcp_fetch-0.6.3.tar.gz
Algorithm Hash digest
SHA256 932a56240dd2a9fba32953ed3eafaf48047fcf228c1ce6880e11998286b150c6
MD5 fa7695673925a2af724ca3fe06e7b987
BLAKE2b-256 809980dbd33f248dc71015596b2379d80169a250961ad4d137256fe76eb84a7a

See more details on using hashes here.

File details

Details for the file mcp_fetch-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: mcp_fetch-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for mcp_fetch-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e77bcedfd01198ff732fd60706a8cfe3546f2947ce4c6afd7caac53e3d9696d0
MD5 11f8422d70bea057ba6c72c45ba6f7ea
BLAKE2b-256 794aa85cabc1ab488526ec3b9d82db222d7d4087bab5675f1352e26b3b3d309f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page