mcp-server-requests
mcp 服务器请求
提供 HTTP 请求功能的 MCP 服务器,使 LLM 能够获取和处理 Web 内容。
特征
支持将网页内容转换为Markdown格式
支持过滤对法学硕士 (LLM) 无用的内容
支持自定义 User-Agent 标头
支持随机 User-Agent 标头
支持HTTP请求中的自定义请求头
支持完整的 HTTP 方法(GET、POST、PUT、DELETE、PATCH)
LLM 可以访问完整的 HTTP 响应头信息
Related MCP server: cURL MCP Server
安装
git clone https://github.com/coucya/mcp-server-requests.git
cd mcp-server-requests
pip install .用法
MCP 服务器配置
{
"mcpServers": {
"mcp-server-requests": {
"command": "python",
"args": [
"-m",
"mcp_server_requests"
]
}
}
}命令行
0.启动 MCP 服务器
直接启动 MCP 服务器:
python -m mcp_server_requests选项
--user-agent TEXT:指定自定义 User-Agent 字符串--random-user-agent [browser=xxx;os=xxx]: 使用随机生成的User-Agent--force-user-agent:强制使用命令行指定的用户代理,忽略 LLM 提供的 UA--list-os-and-browser:列出可用于随机 User-Agent 生成的浏览器和操作系统
选项详细信息
--user-agent和--random-user-agent是互斥的,不能一起使用User-Agent设置方法:
自定义字符串:
--user-agent "Mozilla/5.0 (...)"完全随机:
--random-user-agent条件随机生成:
指定浏览器类型:
--random-user-agent browser=chrome指定操作系统:
--random-user-agent os=windows浏览器和操作系统:
--random-user-agent browser=chrome;os=windows注意:浏览器和操作系统参数不区分大小写
使用
--list-os-and-browser查看--random-user-agent可用的浏览器和操作系统。--force-user-agent控制 User-Agent 优先级:启用后:优先考虑命令行指定的 User-Agent(通过
--user-agent或--random-user-agent),忽略 LLM 提供的 UA禁用时:
如果 LLM 提供了 User-Agent,请使用该
否则使用命令行指定的 User-Agent
1. fetch - 获取网页内容
fetch 子命令相当于 fetch 工具功能,演示了 fetch 功能。
python -m mcp_server_requests fetch <URL> [--return-content {raw,basic_clean,strict_clean,markdown}]选项:
--return-content:返回内容类型(默认值:markdown)raw :返回未处理的原始 HTML 内容
basic_clean :基本清理,删除非显示标签,如脚本、样式
strict_clean :严格清理,删除非显示标签和大多数 HTML 属性
markdown :将 HTML 转换为干净的 Markdown 格式
例子:
python -m mcp_server_requests fetch https://example.com2. get - 执行 HTTP GET 请求
get子命令相当于http_get工具功能,演示了http_get的功能。
python -m mcp_server_requests get <URL> [--headers HEADERS]选项:
--headers:自定义请求标头(格式:“key1=value1;key2=value2”)
3. post - 执行 HTTP POST 请求
post 子命令相当于 http_post 工具功能,演示 http_post 功能。
python -m mcp_server_requests post <URL> [--headers HEADERS] [--data TEXT]选项:
--headers:自定义请求标头--data:请求主体数据
4. put - 执行 HTTP PUT 请求
put 子命令相当于 http_put 工具功能,演示 http_put 功能。
python -m mcp_server_requests put <URL> [--headers HEADERS] [--data TEXT]选项:与 POST 方法相同
5. delete - 执行 HTTP DELETE 请求
delete 子命令相当于 http_delete 工具功能,演示了 http_delete 的功能。
python -m mcp_server_requests delete <URL> [--headers HEADERS] [--data TEXT]选项:与 POST 方法相同
功能
可用工具
**fetch——**获取网页内容
参数:
url (必填):目标 URL
return_content (可选):返回内容类型('raw'、'basic_clean'、'strict_clean'、'markdown')
raw :返回原始 HTML 内容
basic_clean :返回已过滤的 HTML 内容,删除非显示标签,如脚本、样式
strict_clean :返回过滤后的 HTML 内容,删除非显示标签和大多数无用的 HTML 属性
markdown :返回转换为 Markdown 的 HTML
**http_get——**执行 HTTP GET 请求
参数:
url (必填):目标 URL
query (可选):查询参数键值对
标头(可选):自定义请求标头
LLM 可以在标题中指定 User-Agent,是否使用它由
--force-user-agent控制(同样适用于其他工具)
**http_post——**执行 HTTP POST 请求
参数:
url (必填):目标 URL
query (可选):查询参数键值对
标头(可选):自定义请求标头
数据(可选):请求正文数据(文本)
json (可选):请求正文数据(JSON)
data和json不能一起使用
http_put - 执行 HTTP PUT 请求
参数:同http_post
http_patch - 执行 HTTP PATCH 请求
参数:同http_post
http_delete - 执行 HTTP DELETE 请求
参数:同http_post
执照
麻省理工学院
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: YouTube transcripts, screenshots, Google News, WHOIS, jobs, tech stack, more.
Web data for agents. Extract web pages, crawl websites, discover URLs, and search the web.
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.28 npm4MIT
- 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