Skip to main content

This is an MCP server that provides comprehensive tools for extracting and transforming web content into various formats, including support for JavaScript-rendered content and media files

Project description

mcp-server-fetch-python

An MCP server for fetching and transforming web content into various formats. This server provides comprehensive tools for extracting content from web pages, including support for JavaScript-rendered content and media files.

Server Fetch Python MCP server

Features

Tools

The server provides four specialized tools:

  • get-raw-text: Extracts raw text content directly from URLs without browser rendering

    • Arguments:
      • url: URL of the target web page (text, JSON, XML, csv, tsv, etc.) (required)
    • Best used for structured data formats or when fast, direct access is needed
  • get-rendered-html: Fetches fully rendered HTML content using a headless browser

    • Arguments:
      • url: URL of the target web page (required)
    • Essential for modern web applications and SPAs that require JavaScript rendering
  • get-markdown: Converts web page content to well-formatted Markdown

    • Arguments:
      • url: URL of the target web page (required)
    • Preserves structural elements while providing clean, readable text output
  • get-markdown-from-media: Performs AI-powered content extraction from media files

    • Arguments:
      • url: URL of the target media file (images, videos) (required)
    • Utilizes computer vision and OCR for visual content analysis
    • Requires a valid OPENAI_API_KEY to be set in environment variables
    • Will return an error message if the API key is not set or if there are issues processing the media file

Usage

Claude Desktop

To use with Claude Desktop, add the server configuration:

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json

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

Environment Variables

The following environment variables can be configured:

  • OPENAI_API_KEY: Required for using the get-markdown-from-media tool. This key is needed for AI-powered image analysis and content extraction.
  • PYTHONIOENCODING: Set to "utf-8" if you encounter character encoding issues in the output.
  • MODEL_NAME: Specifies the model name to use. Defaults to "gpt-4o".
"mcpServers": {
  "mcp-server-fetch-python": {
    "command": "uvx",
    "args": [
      "mcp-server-fetch-python"
    ],
    "env": {
        "OPENAI_API_KEY": "sk-****",
        "PYTHONIOENCODING": "utf-8",
        "MODEL_NAME": "gpt-4o",        
    }
  }
}

Local Installation

Alternatively, you can install and run the server locally:

git clone https://github.com/tatn/mcp-server-fetch-python.git
cd mcp-server-fetch-python
uv sync
uv build

Then add the following configuration to Claude Desktop config file:

"mcpServers": {
  "mcp-server-fetch-python": {
    "command": "uv",
    "args": [
      "--directory",
      "path\\to\\mcp-server-fetch-python",  # Replace with actual path to the cloned repository
      "run",
      "mcp-server-fetch-python"
    ]
  }
}

Development

Debugging

You can start the MCP Inspector using npxwith the following commands:

npx @modelcontextprotocol/inspector uvx mcp-server-fetch-python
npx @modelcontextprotocol/inspector uv --directory path\\to\\mcp-server-fetch-python run mcp-server-fetch-python

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

iflow_mcp_mcp_server_fetch_python-0.1.1.tar.gz (72.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file iflow_mcp_mcp_server_fetch_python-0.1.1.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_mcp_server_fetch_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8f1acc20b6d7ca7b8c5de630532277e413b52df59cc7461b9f277292a979afdc
MD5 ad3301dbebb8896b22c5f703f8bf4907
BLAKE2b-256 97defd8bf334b99dc53aa1d989ca7c2367bf8f303fb5a496adda662a9bf009cb

See more details on using hashes here.

File details

Details for the file iflow_mcp_mcp_server_fetch_python-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_mcp_server_fetch_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80c123ff7b65004d5009d972008a824235b67a91416f0b26083b4e92c4518fb9
MD5 e900a9cb371ea7974a30df1fe68b5186
BLAKE2b-256 42374734131231fd5ba2d0157a02f223578ae504bfacdcda406e17a40dea8c5e

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