mcp-server-requests
An MCP server that fetches web content, saves it to files, and makes generic HTTP requests.
Fetch any HTTP/HTTPS URL and return content as raw HTML, basic-cleaned HTML, strict-cleaned HTML, or Markdown.
Save fetched content to an absolute file path via
fetch_to_file, auto-creating parent directories and using UTF-8.Send GET, POST, PUT, PATCH, or DELETE requests with custom headers, query parameters, and either text data or a JSON body; returns the complete HTTP response.
Configure writable roots and security restrictions for file saves, and customize or randomize User-Agent per README.
Enables conversion of web pages to Markdown format, allowing for cleaner and more readable text representation of online content.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-requests fetch the latest tech news from Hacker News homepage and convert it to markdown"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-requests
An MCP server that provides HTTP request capabilities, enabling LLMs to fetch and process web content.
Features
fetch: Generic HTTP request tool
Fetches web content with GET by default, and sends POST/PUT/PATCH/DELETE requests
Supports custom request headers, text and JSON request bodies
Returns complete HTTP response information (status, headers, body) for LLMs
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
Disabled by default; enable it with
--enable-fetch-to-fileSupports the same request capabilities as fetch (method, headers, body, json_body)
File writes are limited to the configured writable directories, controlled by
--workspaceand--writable-dirWeb content is not fed into LLM context, avoiding excessive token consumption
Supports custom User-Agent
Supports random User-Agent generation
Related MCP server: cURL MCP Server
Installation
git clone https://github.com/coucya/mcp-server-requests.git
cd mcp-server-requests
pip install .Requires Python 3.11 or newer.
Usage
MCP Server Configuration
Basic usage:
{
"mcpServers": {
"mcp-server-requests": {
"command": "python",
"args": [
"-m",
"mcp_server_requests"
]
}
}
}Advanced usage (enable fetch_to_file; add writable directories with --workspace or --writable-dir):
{
"mcpServers": {
"mcp-server-requests": {
"command": "python",
"args": [
"-m",
"mcp_server_requests",
"--enable-fetch-to-file",
"--workspace",
"/home/user/project",
"--writable-dir",
"/home/user/downloads",
"--writable-dir",
"/home/user/notes"
]
}
}
}Command Line
0. Start MCP Server
Start the MCP server directly:
python -m mcp_server_requestsOptions
--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--enable-fetch-to-file: Enable thefetch_to_filetool (disabled by default)--workspace PATH: Writable directory that also serves as the base for relative paths. Only absolute paths are used; relative paths are ignored.--writable-dir PATH: Additional writable directory forfetch_to_file(repeatable). Only absolute paths are used; relative paths are ignored.
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); existing User-Agent keys inheaders(case-insensitive) are replacedWhen
--force-user-agentis disabled:If LLM provides User-Agent in
headers(key matching is case-insensitive), 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})
--force-user-agentonly affects thefetchtool;fetch_to_filealways uses the server User-Agentfetch_to_fileis disabled by default and is not registered as an MCP tool, so the model cannot see it. Enable it with--enable-fetch-to-file.Writable roots define the scope
fetch_to_filecan write to: the--workspacedirectory plus every--writable-dirdirectory:--workspaceis the base for relative paths. Relative paths are rejected when no workspace is configured.--writable-diradds extra writable directories on top of--workspace.file_pathmay be absolute or relative, but the resolved file must be inside one of the writable roots.Writable roots must be directories. Missing directories are created when the tool is first used.
Only absolute
--workspaceand--writable-dirpaths are used. Relative paths are ignored.
Existing files are never overwritten. If the target already exists, the tool returns an error and writes nothing.
Symlinks are resolved before the containment check. The final target must be inside a writable root.
HTTP 4xx/5xx response bodies are saved like any other response body.
System directories such as
/etcandC:\Windowsare always denied. User-level sensitive paths are denied as well:~/.ssh,~/.aws,~/.gnupg,~/.config/autostart, shell startup files such as~/.bashrcand~/.zshrc, and the Windows Startup folder.The
.gitand.huskydirectories inside every writable root are denied, so fetched content cannot install git hooks.fetch_to_fileonly writes text content. Non-text responses return an error and no file is created.
1. fetch - Generic HTTP Request
The fetch subcommand is equivalent to the MCP fetch tool functionality, used to demonstrate request capabilities in the terminal.
python -m mcp_server_requests fetch <URL> \
[-X {GET,POST,PUT,PATCH,DELETE}] \
[-H "Name: value"]... \
[-d TEXT] \
[--json-body JSON] \
[--return-format {raw,basic_clean,strict_clean,markdown}] \
[--timeout SECONDS]Options:
-X, --method: HTTP method (default: GET)-H, --header: Custom request header in"Name: value"format (repeatable)-d, --body: Text request body; cannot be used with--json-body--json-body: JSON request body; cannot be used with--body--return-format: Return content format (default: markdown)raw: Return raw unprocessed HTML content
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
--timeout: Request timeout in seconds (default: 30)
Examples:
# Fetch a web page as markdown
python -m mcp_server_requests fetch https://example.com
# Query parameters directly in the URL
python -m mcp_server_requests fetch "https://api.example.com/search?q=test&limit=10"
# POST JSON
python -m mcp_server_requests fetch https://api.example.com/users \
-X POST -H "Authorization: Bearer token" --json-body '{"name": "John"}'
# Custom User-Agent
python -m mcp_server_requests fetch https://example.com -H "user-agent: My-Agent"Functionality
MCP Tool Details
1. fetch - Generic HTTP Request
Fetch web content, or send a request with any HTTP method and get the complete response.
Parameters:
url (required, string): Target URL, supports HTTP/HTTPS protocols
method (optional, enum): HTTP method, defaults to "GET"
"GET","POST","PUT","PATCH","DELETE"
headers (optional, object): Custom HTTP request headers
body (optional, string): Text format request body data, mutually exclusive with json_body parameter
json_body (optional, any type): JSON format request body data, mutually exclusive with body parameter
return_format (optional, enum): HTML content processing format, defaults to "markdown"
"raw": Return raw HTML content"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
timeout (optional, number): Request timeout in seconds, defaults to 30. Use
nullfor no timeout.
Parameter Constraints:
bodyandjson_bodyparameters cannot be used togetherWhen using
json_bodyparameter,Content-Type: application/jsonis automatically setWhen using
bodyparameter, it's recommended to manually set appropriateContent-Typereturn_formatonly affectstext/htmlresponses; JSON and other text responses are returned as-isWrite query parameters directly in the URL, for example
https://api.example.com/search?q=test&limit=10. Do not pre-encode; Chinese characters and spaces are encoded by the server
Returns: Complete HTTP response (status line, response headers, and response body)
2. fetch_to_file - Fetch Web Content or Send a Request and Save to a File
Fetch content from the specified URL, or send any HTTP request, and save the response body to a file.
Parameters:
url (required, string): Target URL
file_path (required, string): File save path
Absolute paths must be inside one of the writable roots
Relative paths are resolved against
--workspaceand must stay inside a writable root
method (optional, enum): HTTP method, defaults to "GET"
"GET","POST","PUT","PATCH","DELETE"
headers (optional, object): Custom HTTP request headers
body (optional, string): Text format request body data, mutually exclusive with json_body parameter
json_body (optional, any type): JSON format request body data, mutually exclusive with body parameter
return_format (optional, enum): HTML content processing format, defaults to "markdown", same options as fetch tool
timeout (optional, number): Request timeout in seconds, defaults to 30. Use
nullfor no timeout.
Parameter Constraints:
bodyandjson_bodyparameters cannot be used togetherWhen using
json_bodyparameter,Content-Type: application/jsonis automatically setWhen using
bodyparameter, it's recommended to manually set appropriateContent-Typereturn_formatonly affectstext/htmlresponses; JSON and other text responses are saved as-isWrite query parameters directly in the URL; do not pre-encode values
Request behavior is the same as the
fetchtool, including User-Agent rules
Features:
Disabled by default; enable with
--enable-fetch-to-fileWrites outside the configured writable roots are rejected
Path validation happens before the request; invalid paths never trigger a request
Existing files are never overwritten
Automatically creates parent directories for nested paths
All files saved with UTF-8 encoding
HTTP 4xx/5xx response bodies are written to the file like normal responses
Symlinks are resolved before the containment check
Only the response body is written; status line and headers are omitted
Returns: Operation result or error message
Note: The http_request tool and the individual HTTP method tools (http_get, http_post, http_put, http_patch, http_delete) from earlier versions have been merged into the fetch tool.
License
MIT
Available Tools
3 toolsfetchA
Fetch web page content
Function/Features:
Retrieves web page content from any HTTP/HTTPS URL
Args: url (str): The URL to fetch content from. return_content ('raw' | 'basic_clean' | 'strict_clean' | 'markdown', optional): Processing format for HTML content. Defaults to "markdown". - "raw": Returns unmodified HTML content with full response headers - "basic_clean": Removes non-displaying tags (script, style, meta, etc.) while preserving structure - "strict_clean": Removes non-displaying tags and most HTML attributes, keeping only essential structure - "markdown": Converts HTML content to clean, readable Markdown format
Examples: // Returns content as markdown fetch({url: "https://example.com"})
// Returns raw HTML content
fetch({url: "https://api.example.com/data", return_content: "raw"}) Inputs: url (required), return_content. Returns: result
fetch_to_fileA
Fetch web content and save it to a file in the workspace
Function/Features:
Retrieves web content from any HTTP/HTTPS URL and saves it to a file
Automatic directory creation for nested file paths
Notes:
Automatically creates parent directories if they don't exist
Uses UTF-8 encoding for all saved files
parameter
file_pathmust be a absolute path
Args: url (str): The URL to fetch content from. file_path (str): File path where the content will be saved. return_content ('raw' | 'basic_clean' | 'strict_clean' | 'markdown'], optional): Processing format for HTML content. Defaults to "markdown". - "raw": Saves unmodified HTML content - "basic_clean": Saves HTML with non-displaying tags removed (script, style, etc.) while preserving structure - "strict_clean": Saves HTML with non-displaying tags and most HTML attributes removed, keeping only essential structure - "markdown": Converts HTML content to clean, readable Markdown format before saving
Examples: // Save web page as markdown fetch_to_file({url: "https://example.com", file_path: "/home/user/content/example.md"})
// Save raw HTML content
fetch_to_file({url: "https://api.example.com/data", file_path: "C:\data\response.html", return_content: "raw"})
// Save cleaned content
fetch_to_file({url: "https://example.com/docs", file_path: "/tmp/docs/cleaned.html", return_content: "strict_clean"})Inputs: url (required), file_path (required), return_content. Returns: result
http_requestA
Execute an HTTP request with the specified method
Function/Features:
Sends HTTP requests using any standard method (GET, POST, PUT, PATCH, DELETE)
Allows custom HTTP headers
Returns complete HTTP response including status, headers, and body
Notes:
'data' and 'json' parameters are mutually exclusive - use only one
When using 'json', the Content-Type header is automatically set to 'application/json'
When using 'data', you may need to set appropriate Content-Type header manually
Query parameters are URL-encoded automatically and appended to the URL
The response includes the full HTTP response with status line, all headers, and body
Args: url (str): Target URL for the HTTP request. method ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'], optional): HTTP method to use. Defaults to "GET". query ({ [string]: string | number }, optional): Query parameters to append to the URL. Values are automatically converted to strings. Example: {'key1': 'value1', 'key2': 2}, becomes "key1=value1&key2=2" appended to the URL. headers ({ [string]: string }, optional): Custom HTTP request headers. data (str, optional): Text data to send in the request body. Cannot be used with 'json'. json (Any JSON, optional): Data to serialize as JSON and send in the request body. Cannot be used with 'data'.
Examples: // GET request (default method) http_request({url: "https://api.example.com/data"})
// GET request with query parameters
http_request({url: "https://api.example.com/search", query: {"q": "test", "limit": 10}})
// POST request with JSON data
http_request({url: "https://api.example.com/users", method: "POST", json: {"name": "John", "age": 30}})
// POST request with raw text data
http_request({url: "https://api.example.com/log", method: "POST", data: "This is a log message"})
// PUT request
http_request({url: "https://api.example.com/users/123", method: "PUT", json: {"name": "John Updated", "age": 31}})
// PATCH request
http_request({url: "https://api.example.com/users/123", method: "PATCH", json: {"age": 31, "email": "new@example.com"}})
// DELETE request
http_request({url: "https://api.example.com/users/123", method: "DELETE"})
// Request with custom headers
http_request({url: "https://api.example.com/secure", method: "POST", headers: {"Authorization": "Bearer token"}, json: {"key": "value"}})Inputs: url (required), method (required), query (required), headers (required), +2 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have clearly distinct purposes with no overlap. 'fetch' retrieves web content for immediate use, 'fetch_to_file' saves web content to a file, and 'http_request' handles general HTTP requests with full control over methods and parameters. Each tool serves a unique function in the web request workflow.
All tools follow a consistent snake_case naming pattern with clear verb-action structure. 'fetch', 'fetch_to_file', and 'http_request' all use descriptive verbs that accurately reflect their functionality, maintaining excellent naming consistency throughout the toolset.
Three tools is reasonable for a web requests server, though slightly minimal. The tools cover the core use cases well, but the count feels slightly lean for a server that could potentially benefit from additional specialized tools like websocket handling or streaming responses.
The toolset provides comprehensive coverage for web request operations. It includes content fetching with processing options, file-based fetching, and a full-featured HTTP client supporting all major methods, headers, and data formats. No obvious gaps exist for a general-purpose web requests server.
Maintenance
Related MCP Connectors
Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.
Web tools for AI agents: URL to clean Markdown, site crawl, screenshots, PDF/Office to text, OCR.
Web data for agents. Extract web pages, crawl websites, discover URLs, and search the web.
13 free utility tools for AI agents: web text, markdown, hashing, IDs, dates, units, JSON.
Related MCP Servers
- AlicenseCqualityFmaintenanceEnables LLMs to retrieve and process web content by fetching URLs and converting HTML to markdown, with support for chunked reading and customizable user-agents.1MIT
- AlicenseAqualityBmaintenanceEnables LLMs to make HTTP requests using structured cURL commands with support for multiple authentication methods, custom headers, and comprehensive request/response control.24MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to fetch and extract web content using browser automation, OCR, and multiple extraction methods, handling JavaScript rendering and anti-scraping techniques.17MIT
- AlicenseAqualityCmaintenanceEnables LLMs to make HTTP requests with OAuth2, session cookies, retry logic, and cURL command generation, while providing security features like SSRF protection and TLS enforcement.1MIT