Skip to main content
Glama

mcp-server-requests

by coucya

中文


mcp 服务器请求

提供 HTTP 请求功能的 MCP 服务器,使 LLM 能够获取和处理 Web 内容。

特征

  • 支持将网页内容转换为Markdown格式
  • 支持过滤对法学硕士 (LLM) 无用的内容
  • 支持自定义 User-Agent 标头
  • 支持随机 User-Agent 标头
  • 支持HTTP请求中的自定义请求头
  • 支持完整的 HTTP 方法(GET、POST、PUT、DELETE、PATCH)
  • LLM 可以访问完整的 HTTP 响应头信息

安装

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.com

2. 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 方法相同


功能

可用工具

  1. **fetch——**获取网页内容
    • 参数:
      • url (必填):目标 URL
      • return_content (可选):返回内容类型('raw'、'basic_clean'、'strict_clean'、'markdown')
        • raw :返回原始 HTML 内容
        • basic_clean :返回已过滤的 HTML 内容,删除非显示标签,如脚本、样式
        • strict_clean :返回过滤后的 HTML 内容,删除非显示标签和大多数无用的 HTML 属性
        • markdown :返回转换为 Markdown 的 HTML
  2. **http_get——**执行 HTTP GET 请求
    • 参数:
      • url (必填):目标 URL
      • query (可选):查询参数键值对
      • 标头(可选):自定义请求标头
        • LLM 可以在标题中指定 User-Agent,是否使用它由--force-user-agent控制(同样适用于其他工具)
  3. **http_post——**执行 HTTP POST 请求
    • 参数:
      • url (必填):目标 URL
      • query (可选):查询参数键值对
      • 标头(可选):自定义请求标头
      • 数据(可选):请求正文数据(文本)
      • json (可选):请求正文数据(JSON)
      • datajson不能一起使用
  4. http_put - 执行 HTTP PUT 请求
    • 参数:同http_post
  5. http_patch - 执行 HTTP PATCH 请求
    • 参数:同http_post
  6. http_delete - 执行 HTTP DELETE 请求
    • 参数:同http_post

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Web 内容检索(完整网页、过滤内容或 Markdown 转换)、自定义用户代理、多 HTTP 方法支持(GET/POST/PUT/DELETE/PATCH)、LLM 控制的请求标头、LLM 可访问的响应标头等。

  1. 特征
    1. 安装
      1. 用法
        1. MCP 服务器配置
        2. 命令行
        3. 0.启动 MCP 服务器
        4. fetch - 获取网页内容
        5. get - 执行 HTTP GET 请求
        6. post - 执行 HTTP POST 请求
        7. put - 执行 HTTP PUT 请求
        8. delete - 执行 HTTP DELETE 请求
      2. 功能
        1. 可用工具
      3. 执照

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.
          Last updated -
          1
          54,491
          JavaScript
          MIT License
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          Extracts and transforms webpage content into clean, LLM-optimized Markdown. Returns article title, main content, excerpt, byline and site name. Uses Mozilla's Readability algorithm to remove ads, navigation, footers and non-essential elements while preserving the core content structure.
          Last updated -
          1
          4
          11
          MIT License
        • A
          security
          A
          license
          A
          quality
          Provides functionality to fetch web content in various formats, including HTML, JSON, plain text, and Markdown.
          Last updated -
          4
          125,855
          353
          TypeScript
          MIT License
        • -
          security
          A
          license
          -
          quality
          Enables retrieval and processing of web page content for LLMs by converting HTML to markdown, with support for content truncation and pagination.
          Last updated -
          1
          1
          Python
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/coucya/mcp-server-requests'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server