mcp-local-fetch

mcp-local-fetch

MCP server for fetching web pages without robots.txt restrictions, supporting all standard HTTP methods, custom headers, body, redirect control, and timeout settings.

Category
Visit Server

README

MCP Local Fetch

一个功能强大的 MCP (Model Context Protocol) 服务器,提供不受 robots.txt 限制的网页抓取功能。

功能特性

  • 支持所有标准 HTTP 方法(GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
  • 自定义请求头
  • 请求体支持
  • 重定向控制
  • 超时设置
  • 不遵循 robots.txt 限制
  • 返回完整的响应信息(状态码、响应头、响应体)

快速开始

方式一:使用 npx(推荐)

无需安装,直接在 Claude Desktop 配置文件中使用:

Windows - 编辑 %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "local-fetch": {
      "command": "npx",
      "args": ["-y", "mcp-local-fetch"]
    }
  }
}

macOS - 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "local-fetch": {
      "command": "npx",
      "args": ["-y", "mcp-local-fetch"]
    }
  }
}

Linux - 编辑 ~/.config/claude/claude_desktop_config.json:

{
  "mcpServers": {
    "local-fetch": {
      "command": "npx",
      "args": ["-y", "mcp-local-fetch"]
    }
  }
}

方式二:本地开发

如果你想修改源码或本地开发:

git clone https://github.com/yuandeshoulian/mcp-local-fetch.git
cd mcp-local-fetch
npm install
npm run build

然后在配置文件中指向本地路径:

{
  "mcpServers": {
    "local-fetch": {
      "command": "node",
      "args": ["path/to/mcp-local-fetch/dist/index.js"]
    }
  }
}

使用方法

服务器提供一个 fetch 工具,支持以下参数:

参数

  • url (必需): 要抓取的 URL
  • method (可选): HTTP 方法,默认 "GET"
    • 可选值: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • headers (可选): 自定义请求头对象
  • body (可选): 请求体(字符串格式)
  • follow_redirects (可选): 是否跟随重定向,默认 true
  • max_redirects (可选): 最大重定向次数,默认 20
  • timeout (可选): 请求超时时间(毫秒),默认 30000

示例

简单 GET 请求

{
  "url": "https://example.com"
}

POST 请求带自定义头和请求体

{
  "url": "https://api.example.com/data",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer token123"
  },
  "body": "{\"key\": \"value\"}"
}

禁用重定向

{
  "url": "https://example.com",
  "follow_redirects": false
}

设置超时

{
  "url": "https://example.com",
  "timeout": 5000
}

响应格式

工具返回 JSON 格式的响应:

{
  "status": 200,
  "statusText": "OK",
  "headers": {
    "content-type": "text/html",
    "content-length": "1234"
  },
  "body": "响应内容...",
  "url": "https://example.com"
}

开发

构建

npm run build

开发模式(自动重新编译)

npm run dev

安全说明

此工具不遵循 robots.txt 限制,请负责任地使用:

  • 遵守目标网站的服务条款
  • 避免过于频繁的请求
  • 尊重网站的隐私政策
  • 仅用于合法目的

许可证

MIT

配合其他 MCP 使用

处理需要 JavaScript 渲染的网站

此 MCP 专注于简单快速的 HTTP 请求。对于需要 JavaScript 渲染的网站(如客户端渲染的 SPA),建议配合使用 Playwright MCP

{
  "mcpServers": {
    "local-fetch": {
      "command": "node",
      "args": ["E:\\workspace\\jasion\\jq-mcp\\mcp-local-fetch\\dist\\index.js"]
    },
    "playwright": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-playwright"]
    }
  }
}

使用场景:

  • mcp-local-fetch: 快速抓取静态 HTML、API 接口、简单网页
  • Playwright MCP: 抓取需要 JavaScript 渲染的网站(如魔搭社区、现代 SPA 应用)

注意事项

  • 默认使用浏览器 User-Agent 以提高兼容性
  • 自动处理超时和错误
  • 支持 HTTPS
  • 响应体始终以文本形式返回
  • 轻量级设计,启动快速,资源占用少

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured