Secure Fetch
Secure fetch to prevent access to local resources
Secure Fetch
This project implements a secure URL fetching tool using FastMCP.
Prerequisites
- Python 3.7+
- uv (Python package installer and environment manager)
Installation
- Install uv if you haven't already:
pip install uv
- Create a new virtual environment and install dependencies:
uv venv source .venv/bin/activate uv pip install fastmcp requests
Usage
- Set the allowlist environment variable (optional):
export SECURE_FETCH_ALLOWLIST="example.com,trusted-domain.org"
- Run the script:
uv run main.py
Features
- Fetches URLs securely
- Resolves domains to IPs
- Checks for private/internal IPs
- Handles redirects (up to 3)
- Supports custom HTTP methods and headers
- Uses an allowlist for trusted domains/IPs
Security Considerations
- The tool prevents access to private/internal IPs unless explicitly allowed
- Only HTTP and HTTPS schemes are permitted
- SNI is set to match the hostname for HTTPS connections
Example Usage
Once the script is running, you can use the fetch_url function to securely fetch URLs. The function will return a dictionary containing the status code, response body, and content length.
Note
This tool is designed for secure URL fetching. Always review and understand the code before using it in your environment.
相關伺服器
Bright Data
贊助Discover, extract, and interact with the web - one interface powering automated access across the public internet.
MCP Webscan Server
Fetch, analyze, and extract information from web pages.
Oxylabs
Scrape websites with Oxylabs Web API, supporting dynamic rendering and parsing for structured data extraction.
Query Table
A financial web table crawler using Playwright that queries data from multiple websites with fallback switching.
MCP LLMS.txt Explorer
Explore and analyze websites that have implemented the llms.txt standard.
URnetwork
High quality VPN and Proxy connections
MCP Deep Web Research Server
An advanced web research server with intelligent search queuing, enhanced content extraction, and deep research capabilities.
Google-DeepSearch-AI-Mode
https://github.com/mottysisam/deepsearch
Web Scout
A server for web scraping, searching, and analysis using multiple engines and APIs.
MCP Chrome Integration
Control the Chrome browser for web automation using an AI model. Requires the MCP Chrome extension.
Finance MCP Server
Stock prices, cryptocurrency data, exchange rates, and portfolio tracking