smart-webfetch-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@smart-webfetch-mcp check page size for https://example.com/docs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Smart WebFetch MCP Server
Context-aware web fetching for LLMs. Prevents context window flooding by checking page size before fetching and providing surgical extraction tools.
The Problem
Standard web fetch tools dump entire pages into the context window, often:
Exceeding token limits
Wasting context on navigation, footers, ads
Flooding the model with irrelevant content
Related MCP server: Web Eyes
The Solution
Smart WebFetch provides 7 tools for intelligent web fetching:
Tool | Purpose |
| Check page size before fetching |
| Fetch with automatic truncation |
| Extract only code blocks |
| Fetch specific heading/section |
| Paginated fetching for large docs |
| Extract all links from a page |
| Extract tables as markdown |
Installation
# Install from PyPI
pip install smart-webfetch-mcp
# Or with uvx (recommended for MCP)
uvx smart-webfetch-mcpConfiguration
Claude Code
claude mcp add --transport stdio smart-webfetch -- uvx smart-webfetch-mcpOpenCode
Add to your opencode.json:
{
"mcp": {
"smart-webfetch": {
"type": "local",
"command": ["uvx", "smart-webfetch-mcp"],
"enabled": true
}
}
}Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"smart-webfetch": {
"command": "uvx",
"args": ["smart-webfetch-mcp"]
}
}
}Usage Examples
Check before fetching
Use web_preflight to check https://docs.python.org/3/library/asyncio.htmlResponse:
{
"url": "https://docs.python.org/3/library/asyncio.html",
"estimated_tokens": 45000,
"safe_for_context": false,
"recommendation": "Very large page (~45,000 tokens). Use web_fetch_section or web_fetch_chunked."
}Fetch with automatic truncation
Use web_smart_fetch on https://example.com/docs with max_tokens=4000Extract only code examples
Use web_fetch_code on https://docs.python.org/3/library/asyncio-task.htmlGet specific section
Use web_fetch_section on https://docs.python.org/3/library/asyncio.html
with heading="Running an asyncio Program"Paginated reading
Use web_fetch_chunked on https://large-docs.com/api with chunk=0, chunk_size=4000Then continue with chunk=1, chunk=2, etc.
Tool Reference
web_preflight
Check page metadata before fetching.
Parameters:
url(required): URL to check
Returns:
estimated_tokens: Approximate token countcontent_type: MIME typeis_html: Whether content is HTMLtitle: Page title (if HTML)safe_for_context: Boolean (true if < 8000 tokens)recommendation: Human-readable advice
web_smart_fetch
Fetch with automatic truncation for large pages.
Parameters:
url(required): URL to fetchmax_tokens(optional, default 8000): Maximum tokens to returnstrategy(optional, default "auto"): "auto" finds natural break points, "truncate" hard cuts
Returns: Markdown content with metadata header
web_fetch_code
Extract only code blocks from a page.
Parameters:
url(required): URL to extract code from
Returns: Code blocks with language annotations and context
web_fetch_section
Fetch content under a specific heading.
Parameters:
url(required): URL to fetch fromheading(required): Heading text to find (case-insensitive)
Returns: Section content or list of available sections if not found
web_fetch_chunked
Fetch large documents in chunks.
Parameters:
url(required): URL to fetchchunk(optional, default 0): Chunk index (0-based)chunk_size(optional, default 4000): Tokens per chunk
Returns: Chunk content with navigation metadata
web_fetch_links
Extract all links from a page.
Parameters:
url(required): URL to extract links fromfilter_pattern(optional): Regex to filter link URLsexternal_only(optional, default false): Only return external links
Returns: Markdown list of links with text and URL
web_fetch_tables
Extract tables from a page as markdown.
Parameters:
url(required): URL to extract tables fromtable_index(optional): Specific table index (0-based), returns all if not specified
Returns: Markdown formatted tables
Development
# Clone and install dev dependencies
git clone https://github.com/mathisto/smart-webfetch-mcp
cd smart-webfetch-mcp
pip install -e ".[dev]"
# Run tests
pytest
# Format code
ruff format .
ruff check --fix .License
MIT
Available Tools
7 toolsweb_fetch_chunkedA
Fetch large documents in chunks. Use for paginated reading of large docs. Returns chunk content plus metadata about total chunks available.
Inputs: url (required), chunk, chunk_size, timeout.
web_fetch_codeA
Extract only code blocks from a page. Ideal for documentation pages with code examples. Returns code blocks with language annotations.
Inputs: url (required), timeout.
web_fetch_linksA
Extract all links from a page. Returns a markdown list of links with text and URL. Optionally filter by pattern or external links only.
Inputs: url (required), filter_pattern, external_only, timeout.
web_fetch_sectionA
Fetch only content under a specific heading. Case-insensitive heading match. Use when you only need a specific part of a large document.
Inputs: url (required), heading (required), timeout.
web_fetch_tablesA
Extract tables from a page and return as markdown tables. Handles thead/tbody, th/td cells, colspan, and captions.
Inputs: url (required), table_index, timeout.
web_preflightA
Check page size and metadata before fetching. Returns estimated tokens, content type, and whether fetch is safe for context window. Always call this first to avoid context flooding.
Inputs: url (required), timeout.
web_smart_fetchA
Fetch URL with automatic truncation if content exceeds token limit. Use web_preflight first to check size. Returns markdown content.
Inputs: url (required), max_tokens, strategy, timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a specific aspect of web fetching (chunks, code, links, sections, tables, preflight checks, and general fetch) with no overlap in functionality.
Most tools follow 'web_fetch_*' pattern (chunked, code, links, section, tables), but 'web_preflight' and 'web_smart_fetch' deviate slightly. Still readable.
7 tools cover essential web fetching operations without redundancy. The count is well-scoped for a focused utility server.
Common use cases (full page, paginated, sections, tables, links, code) are covered. Missing advanced selectors (CSS, XPath) but core needs are met.
Maintenance
Related MCP Connectors
Web tools for AI agents: URL to clean Markdown, site crawl, screenshots, PDF/Office to text, OCR.
Structured web research tool for AI agents: search, fetch and shape web data into the JSON schema…
Public web tools for agents: product extraction, claim checks, webpage QA and ranked audits.
Web data for agents. Extract web pages, crawl websites, discover URLs, and search the web.
Related MCP Servers
- 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
- FlicenseNot gradedqualityDmaintenanceEnables LLM agents to search, crawl, summarize, and analyze web pages and images via a pipeline of web intelligence tools.-
- AlicenseAqualityDmaintenanceEnables LLMs to fetch and process web page contents by providing tools to retrieve raw HTML, extract clean text, and convert web pages to markdown format.3MIT
- AlicenseAqualityCmaintenanceWeb tools for AI agents. Search the web for full page content, fetch URLs as clean markdown including PDFs, extract structured data from a page with a prompt, and run multi-source deep research that returns a cited report.42MIT