Better Fetch

Better Fetch

A Model Context Protocol server that intelligently fetches and processes web content, transforming websites and documentation into clean, structured markdown with nested URL crawling capabilities.

Category
访问服务器

README

Better Fetch Banner

Better Fetch - Advanced Web Content MCP Server

License: MIT TypeScript Node.js smithery badge

A powerful Model Context Protocol (MCP) server that intelligently fetches and processes web content with nested URL crawling capabilities. Transform any documentation site or web resource into clean, structured markdown files perfect for AI consumption and analysis.

🚀 Key Features

🕸️ Smart Web Crawling

  • Nested URL Fetching: Automatically discovers and crawls linked pages up to configurable depth
  • Single Page Mode: Option for simple single-page content extraction
  • Domain Filtering: Stay within the same domain or allow cross-domain crawling
  • Pattern Matching: Include/exclude URLs based on regex patterns

🧠 Intelligent Content Processing

  • Content Cleaning: Removes ads, navigation, scripts, and other noise automatically
  • Smart Section Detection: Identifies main content areas (<main>, <article>, .content)
  • Automatic Titles: Generates meaningful section headers based on page titles and URL structure
  • Table of Contents: Creates organized TOC with proper nesting

📝 Advanced Markdown Generation

  • Clean Formatting: Converts HTML to well-structured markdown
  • Code Block Preservation: Maintains formatting for code snippets and technical content
  • Link Preservation: Keeps all important links with proper markdown syntax
  • Metadata Integration: Includes source URLs, generation timestamps, and site information

⚙️ Highly Configurable

  • Crawl Depth Control: Set maximum levels to crawl (default: 2)
  • Page Limits: Control maximum pages to process (default: 50)
  • Timeout Settings: Configurable request timeouts
  • Respectful Crawling: Built-in delays between requests
  • Error Handling: Graceful handling of failed requests and invalid URLs

📋 Available Tools

1. fetch_website_nested

Comprehensive web crawling with nested URL processing.

Parameters:

  • url (required): Starting URL to crawl
  • maxDepth (optional, default: 2): Maximum crawl depth
  • maxPages (optional, default: 50): Maximum pages to process
  • sameDomainOnly (optional, default: true): Restrict to same domain
  • excludePatterns (optional): Array of regex patterns to exclude
  • includePatterns (optional): Array of regex patterns to include
  • timeout (optional, default: 10000): Request timeout in milliseconds

2. fetch_website_single

Simple single-page content extraction.

Parameters:

  • url (required): URL to fetch
  • timeout (optional, default: 10000): Request timeout in milliseconds

💡 Use Cases

📚 Documentation Processing

  • API Documentation: Convert REST API docs, SDK guides, and technical references
  • Framework Docs: Process React, Vue, Angular, or any framework documentation
  • Library Guides: Extract comprehensive guides from library documentation sites
  • Tutorial Series: Gather multi-part tutorials into single organized documents

🔍 Content Analysis & Research

  • Competitive Analysis: Gather competitor documentation and feature descriptions
  • Market Research: Extract product information from multiple related pages
  • Academic Research: Collect and organize web-based research materials
  • Knowledge Base Creation: Transform scattered web content into structured knowledge bases

🤖 AI Training & Context

  • LLM Context Preparation: Create clean, structured content for AI model training
  • RAG System Input: Generate high-quality documents for Retrieval-Augmented Generation
  • Chatbot Knowledge: Build comprehensive knowledge bases for customer service bots
  • Content Summarization: Prepare web content for automated summarization tasks

🛠️ Installation & Setup

Installing via Smithery

To install Better Fetch for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @flutterninja9/better-fetch --client claude

Prerequisites

  • Node.js 18+
  • npm or yarn
  • MCP-compatible client (Claude Desktop, VS Code with MCP extension, etc.)

Step 1: Clone and Install

git clone https://github.com/yourusername/better-fetch.git
cd better-fetch
npm install

Step 2: Build the Project

npm run build

Step 3: Test the Server (Optional)

# Quick test
npm run dev

# Or run comprehensive tests
node test-mcp.js

Step 4: Configure Your MCP Client

For Claude Desktop:

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "better-fetch": {
      "command": "node",
      "args": ["/absolute/path/to/better-fetch/dist/server.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

For VS Code MCP Extension:

{
  "better-fetch": {
    "command": "node",
    "args": ["/Users/yourusername/better-fetch/dist/server.js"]
  }
}

For Custom MCP Client:

{
  "name": "better-fetch",
  "command": "node",
  "args": ["/path/to/better-fetch/dist/server.js"],
  "stdio": true
}

📖 Usage Examples

Basic Documentation Crawling

Fetch all the web contents from this Flutter Shadcn UI documentation site:
https://flutter-shadcn-ui.mariuti.com/

Use nested fetching with a maximum depth of 3 levels and process up to 100 pages.

Advanced Configuration

Fetch content from the React documentation but exclude any URLs containing 'api' or 'reference' and only process pages containing 'tutorial' or 'guide':

URL: https://react.dev
Max Depth: 2
Exclude Patterns: ["/api/", "/reference/"]
Include Patterns: ["/tutorial/", "/guide/"]
Max Pages: 30

Single Page Extraction

Extract the content from this specific page only:
https://nextjs.org/docs/getting-started/installation

Use single page mode to avoid crawling related links.

📄 Sample Output

The server generates comprehensive markdown files with the following structure:

# Site Name Documentation

*Scraped from: https://example.com*
*Generated on: 2024-01-15T10:30:00.000Z*

## Table of Contents

- [Getting Started](#getting-started)
  - [Installation](#installation)
  - [Quick Start](#quick-start)
- [API Reference](#api-reference)
  - [Core Functions](#core-functions)

---

## Getting Started

*Source: [https://example.com/getting-started](https://example.com/getting-started)*

[Clean markdown content here...]

---

## Installation

*Source: [https://example.com/installation](https://example.com/installation)*

[Installation instructions in markdown...]

For a complete example, refer to output.md which demonstrates the server's output when processing a real documentation site.

🔧 Development

Project Structure

better-fetch/
├── src/
│   └── server.ts          # Main server implementation
├── dist/                 # Compiled JavaScript
├── test-mcp.js          # Testing utilities
├── output.md            # Sample output file
├── package.json
├── tsconfig.json
└── README.md

Available Scripts

npm run dev          # Run in development mode with hot reload
npm run build        # Compile TypeScript to JavaScript
npm run start        # Run the compiled server
npm run clean        # Clean dist directory
npm test             # Run test suite

Testing Your Changes

# Interactive testing
node interactive-test.js

# Automated test suite
node test-mcp.js

# Manual JSON-RPC testing
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js

🚦 Performance & Limits

Default Limits

  • Max Depth: 2 levels (configurable)
  • Max Pages: 50 pages (configurable)
  • Request Timeout: 10 seconds (configurable)
  • Crawl Delay: 500ms between requests (respectful crawling)

Performance Tips

  • Set appropriate maxPages limits for large sites
  • Use includePatterns to focus on relevant content
  • Enable sameDomainOnly to avoid external link crawling
  • Adjust timeout based on target site response times

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Commit your changes: git commit -m 'Add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support & Issues

🙏 Acknowledgments


Made with ❤️ for the AI and developer community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选