page-fetcher-mcp
An MCP server for fetching and scraping web pages, providing fetch_url and scrape_url tools.
README
Page Fetcher MCP Server
一个用于替代 Claude Code 内置 fetch 功能的 MCP (Model Context Protocol) 服务器,提供网页抓取和 API 数据获取能力。
功能特性
- fetch_url: 从 URL 获取数据(API 端点、JSON 或任何网页内容)
- scrape_url: 抓取并提取网页的可读文本内容
安装
npm install
开发
构建项目
npm run build
开发模式运行
npm run dev
生产模式运行
npm start
使用方法
在 Claude Code 中配置
将此服务器添加到 Claude Code 的 MCP 配置中:
{
"mcpServers": {
"page-fetcher-mcp": {
"command": "node",
"args": ["/path/to/page-fetcher-mcp/dist/index.js"],
"env": {}
}
}
}
可用工具
fetch_url
获取任意 URL 的数据(API、JSON、网页内容等)
参数:
url(必需): 要获取的 URLheaders(可选): 要包含在请求中的 HTTP 头
示例:
// 获取 API 数据
await mcp_fetch_call_tool('fetch_url', {
url: 'https://api.github.com/users/octocat'
});
// 获取 JSON 数据
await mcp_fetch_call_tool('fetch_url', {
url: 'https://jsonplaceholder.typicode.com/posts/1'
});
// 带自定义头获取
await mcp_fetch_call_tool('fetch_url', {
url: 'https://api.example.com/data',
headers: {
'Authorization': 'Bearer YOUR_TOKEN'
}
});
scrape_url
抓取网页并提取可读文本内容
参数:
url(必需): 要抓取的 URLselector(可选): CSS 选择器,用于提取特定元素
示例:
// 获取整个页面的文本内容
await mcp_fetch_call_tool('scrape_url', {
url: 'https://example.com'
});
// 使用 CSS 选择器提取特定内容
await mcp_fetch_call_tool('scrape_url', {
url: 'https://example.com',
selector: 'h1' // 只提取所有 h1 标题
});
// 提取文章内容
await mcp_fetch_call_tool('scrape_url', {
url: 'https://example.com/article',
selector: '.article-content'
});
项目结构
page-fetcher-mcp/
├── src/
│ └── index.ts # 主服务器实现
├── dist/ # 编译输出目录
├── package.json # 项目配置
├── tsconfig.json # TypeScript 配置
└── README.md # 项目文档
技术栈
- Node.js
- TypeScript
- @modelcontextprotocol/sdk - MCP 协议 SDK
- axios - HTTP 客户端
- cheerio - HTML 解析和爬虫
许可证
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.