This MCP server provides HTTP request and web content fetching capabilities with content processing options to optimize token usage.
Core Tools:
fetch- Retrieve web content with multiple processing formats: raw HTML, basic cleaned HTML (removes scripts/styles), strict cleaned HTML (removes non-visual elements and attributes), or Markdown conversionfetch_to_file- Download and save web content locally with the same processing options, automatic directory creation, and UTF-8 encodinghttp_request- Execute full HTTP requests supporting all major methods (GET, POST, PUT, PATCH, DELETE) with custom headers, query parameters, and request bodies in text or JSON format
Key Features:
Content filtering - Automatically removes non-visual elements to reduce token consumption
User-Agent customization - Configure custom, randomly generated, or browser/OS-filtered User-Agent strings with priority control
Workspace integration - Optional MCP Root capability for relative path operations within workspace and configurable external file access control
Complete responses - Returns full HTTP response information including status, headers, and body content
Enables conversion of web pages to Markdown format, allowing for cleaner and more readable text representation of online content.
mcp-server-requests
An MCP server that provides HTTP request capabilities, enabling LLMs to fetch and process web content.
Features
fetch: Web content fetching tool
Supports converting web content to Markdown format
Supports filtering web content (non-visual elements like script, style, meta)
Feeds into LLM context, reducing token consumption through Markdown conversion or filtering non-visual elements
fetch_to_file: Web content saving tool
Web content is not fed into LLM context, avoiding excessive token consumption
http_request: Generic HTTP request tool
Full HTTP method support (GET, POST, PUT, PATCH, DELETE)
Supports custom request headers
Supports text and JSON request bodies
Returns complete HTTP response information (status, headers, body) for LLMs
Supports custom User-Agent
Supports random User-Agent generation
Supports using MCP Root capability, controlled by
--use-root, usable with MCP Clients that haverootcapability
Related MCP server: Fetch MCP Server
Installation
Usage
MCP Server Configuration
Command Line
0. Start MCP Server
Start the MCP server directly:
Options
--user-agent TEXT: Specify custom User-Agent string--random-user-agent [browser=xxx;os=xxx]: Use randomly generated User-Agent--force-user-agent: Force using command line specified User-Agent, ignoring LLM provided UA--list-os-and-browser: List available browsers and OS for random User-Agent generation--use-root: Enable workspace root support for file operations (requires MCP Client withrootcapability support)--allow-external-file-access: Allow file operations outside workspace (only with --use-root)
Option Details
--user-agentand--random-user-agentare mutually exclusive and cannot be used togetherUser-Agent setup methods:
Custom string:
--user-agent "Mozilla/5.0 (...)"Fully random:
--random-user-agentConditional random generation:
Specify browser type:
--random-user-agent browser=chromeSpecify OS:
--random-user-agent os=windowsBoth browser and OS:
--random-user-agent browser=chrome;os=windowsNote: Browser and OS parameters are case insensitive
Use
--list-os-and-browserto view available browsers and OS for--random-user-agent.--force-user-agentoption controls User-Agent priority:When
--force-user-agentis enabled: Force using command-line specified User-Agent (via--user-agentor--random-user-agent)When
--force-user-agentis disabled:If LLM provides User-Agent in
headers, use the LLM-provided oneOtherwise use command-line specified User-Agent
If none specified, use default User-Agent:
Mozilla/5.0 (compatible; mcp-server-requests/{version})
--use-rootenables file operations relative to workspace root:Prerequisite: Requires MCP Client with
rootcapability supportWhen enabled:
fetch_to_fileallows absolute paths or relative paths, relative paths are relative to workspace rootWhen disabled:
fetch_to_filemust use absolute paths, files are saved to specified absolute path locations
--allow-external-file-access: Controls whether file operations outside workspace are allowed (only usable with --use-root)Prerequisite: Requires
--use-rootto be enabled, this option has no effect if--use-rootis not enabledWhen enabled:
fetch_to_filecan operate on files outside the workspace directoryWhen disabled:
fetch_to_filecan only operate on files within the workspace directory, even if absolute paths are provided, files outside the workspace cannot be operated on
1. fetch - Fetch Web Content
The fetch subcommand is equivalent to the MCP fetch tool functionality, used to demonstrate fetch capabilities.
Options:
--return-content: Return content type (default: markdown)raw: Return raw unprocessed HTML content (includes response headers)
basic_clean: Basic cleanup, removing non-display tags (script, style, meta, etc.) while preserving structure
strict_clean: Strict cleanup, removing non-display tags and most HTML attributes, keeping only essential structure
markdown: Convert HTML to clean Markdown format
Functionality
MCP Tool Details
1. fetch - Fetch Web Content
Fetch content from the specified URL and return it in the specified format.
Parameters:
url (required, string): Target URL, supports HTTP/HTTPS protocols
return_content (optional, enum): Content processing format, defaults to "markdown"
"raw": Return raw HTML content with complete HTTP response headers"basic_clean": Basic cleanup, removing non-display tags (script, style, meta, etc.) while preserving HTML structure"strict_clean": Strict cleanup, removing non-display tags and most HTML attributes, keeping only essential structure"markdown": Convert HTML content to clean Markdown format
Returns: Content processed according to the specified format
2. fetch_to_file - Fetch Web Content and Save to File
Fetch content from the specified URL and save it to a file.
Parameters:
url (required, string): Target URL
file_path (required, string): File save path
When
--use-rootis enabled: Must be a relative path (relative to workspace root)When
--use-rootis disabled: Must be an absolute path
return_content (optional, enum): Content processing format, defaults to "markdown", same options as fetch tool
Features:
Automatically creates parent directories for nested paths
All files saved with UTF-8 encoding
When
--use-rootis enabled, can work with--allow-external-file-accessto control file access scope
Returns: Operation result or error message
3. http_request - Generic HTTP Request Tool
Send HTTP requests using any method and get complete responses.
Parameters:
url (required, string): Target URL
method (optional, enum): HTTP method, defaults to "GET"
"GET","POST","PUT","PATCH","DELETE"
query (optional, object): URL query parameters as key-value pairs, automatically URL-encoded
headers (optional, object): Custom HTTP request headers
data (optional, string): Text format request body data, mutually exclusive with json parameter
json (optional, any type): JSON format request body data, mutually exclusive with data parameter
Parameter Constraints:
dataandjsonparameters cannot be used togetherWhen using
jsonparameter,Content-Type: application/jsonis automatically setWhen using
dataparameter, it's recommended to manually set appropriateContent-Type
Returns: Complete HTTP response (status line, response headers, and response body)
Note: Individual HTTP method tools (http_get, http_post, http_put, http_patch, http_delete) have been removed and replaced by the unified http_request tool.
License
MIT