web-data-mcp
An MCP server that runs Apify scraping actors with quality-gated validation, scoring, and retries, returning embedding-ready chunks for AI agents.
README
web-data-mcp
Quality-gated web data for AI agents. An MCP server that runs Apify scraping actors and — unlike a raw passthrough — validates what came back, scores it, retries with stronger anti-blocking settings when it's bad, and hands your agent embedding-ready chunks instead of a JSON dump.

Scraped data fails silently: the run "succeeds" but the dataset is a wall of Access Denied pages, half-empty records, or duplicates — and an agent that can't see quality will happily reason over garbage. This server makes data quality a first-class, machine-readable part of every tool result.
flowchart LR
A[AI agent] -->|MCP| S[web-data-mcp]
S --> R[Run actor]
R --> Q{Quality gate<br/>schema · completeness<br/>dupes · bot-wall}
Q -->|score >= threshold| C[Chunked, token-bounded,<br/>hash-addressed documents]
Q -->|score < threshold| E[Escalate: residential proxies,<br/>browser crawler] --> R
C --> A
Why not the official Apify MCP server?
Use both — they solve different problems.
| apify/apify-mcp-server | web-data-mcp | |
|---|---|---|
| Scope | The whole Apify store (5,000+ actors), dynamic discovery | 7 curated tools around one workflow |
| Output | Raw dataset passthrough | Schema-validated, quality-scored, token-budgeted |
| Bad scrapes | Your agent finds out the hard way | Scored (quality.score), auto-retried with escalating anti-blocking settings |
| RAG | Bring your own chunking | dataset_to_rag_documents: token-bounded chunks, overlap, stable content-hash ids |
| Guardrails | Platform-level | Actor allowlist, SSRF guard (no private hosts), clamped memory/timeouts, hard response token caps |
Tools
| Tool | What it does |
|---|---|
scrape_url |
One call: crawl a URL → wait → score → auto-retry if blocked → return markdown + quality block |
run_actor |
Start an allowlisted actor with explicit input; returns run_id / dataset_id handles |
get_run_status |
Poll a run (read-only, free) |
fetch_dataset_items |
Paginated reads with field projection, summary/items modes, hard token budget |
validate_dataset |
Score a dataset against your JSON Schema: pass rate, completeness, dupes, bot-wall rate |
retry_low_quality_run |
Re-run with residential proxies → browser crawler until quality clears your threshold |
dataset_to_rag_documents |
Emit embedding-ready chunks (jsonl/markdown/text) with source attribution + content hashes |
Every tool ships inputSchema and outputSchema (structured output), behavior annotations (readOnlyHint, openWorldHint, …), and returns failures as model-readable isError results with a concrete next step — so the calling agent can self-correct instead of stalling.
Quickstart
git clone https://github.com/fctpe/web-data-mcp && cd web-data-mcp
pnpm install && pnpm build
# poke every tool in a UI
APIFY_TOKEN=your-token npx @modelcontextprotocol/inspector node dist/index.js
# Claude Code
claude mcp add web-data --env APIFY_TOKEN=your-token -- node /path/to/web-data-mcp/dist/index.js
# Claude Desktop / Cursor / any stdio client — add to your MCP config:
{
"mcpServers": {
"web-data": {
"command": "node",
"args": ["/path/to/web-data-mcp/dist/index.js"],
"env": { "APIFY_TOKEN": "your-token" }
}
}
}
(npx -y web-data-mcp will replace the node path once the first npm release is published — the bin entry is already wired.)
Free Apify accounts include $5/month of platform credit — enough for hundreds of scrape_url calls with the default cheerio crawler.
HTTP mode
WEB_DATA_MCP_HTTP_TOKEN=$(openssl rand -hex 24) node dist/index.js --transport http --port 3000
Binds to 127.0.0.1 with Host/Origin validation (DNS-rebinding protection) and constant-time bearer auth. Built on the MCP TypeScript SDK v2 (spec 2026-07-28); 2025-era clients are served through the SDK's built-in legacy fallback.
How the quality gate works
Each dataset sample is scored 0..1 from four signals:
- Schema pass rate — items validated against your JSON Schema (Ajv), weighted 0.4 when present
- Field completeness — non-empty cells across the union of fields
- Duplicate rate — hash-based duplicate detection
- Bot-wall rate — items containing block markers (
Access Denied,captcha,verify you are human, …)
Below threshold, retries escalate: original input → + residential proxies → + playwright:firefox with dynamic-content waits. Attempts and both scores are reported in the structured result, and exhausted retries return an isError result that tells the agent why and what to try next.
Example: LangGraph agent
examples/langgraph-agent wires the server into a LangGraph agent whose system prompt enforces the quality contract ("if score < 0.7, say so instead of trusting the content"):
cd examples/langgraph-agent
npm install
OPENAI_API_KEY=... APIFY_TOKEN=... npm start -- "https://apify.com/pricing"
Results: pressure-tested against production actors
Beyond the 60 offline tests, the full MCP flow (run → status → fetch → validate → RAG) was pressure-tested on 2026-07-12 against three production Apify actors with real workloads:
| Actor | Verdict | Quality score | Evidence |
|---|---|---|---|
| reddit-scraper-pro (keyword search) | ✅ pass | 0.989 (schema pass rate 1.0) | 54 live posts; 44 RAG docs auto-detected; token budget truncated at 6/10 items with correct continuation offset |
| event-scraper-pro (Berlin AI events) | ✅ pass | 0.903 (schema pass rate 1.0) | 28 live events; titles 100% filled; 37 RAG docs from description |
| facebook-ad-intelligence-pro (ad library) | ✅ pass after fix | 0.938 | 10 live ads, key fields (adCopy, headline, pageName) filled |
The live runs caught two bugs the mocked tests couldn't, both fixed with regression tests:
- Apify's dataset
itemCountis eventually consistent — it reads 0 for a few seconds after a run finishes. Pagination now floors the total at what was actually fetched. - A 245-token CDN image URL out-lengthed the ad copy in the RAG auto-detect fallback, producing well-formed garbage embeddings. Content detection now requires prose shape (whitespace ratio, non-URL) and skips items honestly instead.
Design notes
Architecture decisions are recorded in docs/adr/: curated tools vs. dynamic discovery, SDK v2 beta, the dependency-injected gateway that keeps the whole test suite offline and sub-second, and hard token budgets with explicit handles. Security posture (token handling, URL guard, transport auth) is in SECURITY.md.
Limitations
- Quality scoring is heuristic. The bot-wall regex catches common block pages, not all of them, and
field completenesstreats all fields as equally important. Schema pass rate is the signal to rely on when you can provide a schema. - Escalation strategies (
crawlerType,dynamicContentWaitSecs) targetapify/website-content-crawler-style inputs; other actors get proxy escalation only, and unknown input keys are passed through untouched. retry_low_quality_runre-runs the whole actor input — it does not retry only failed URLs within a run.- No streaming: long crawls block up to the wait budget (300s default). Fire-and-forget via
run_actor+ polling is the workaround for bigger jobs. - Tested against
apify-client2.x and MCP SDK2.0.0-beta.3(pinned); the pin will move to v2 stable when it ships.
Development
pnpm test # offline test suite incl. full client<->server integration
pnpm lint && pnpm typecheck
pnpm inspect # build + MCP Inspector
APIFY_TOKEN=... SMOKE_ACTOR=... node scripts/live-smoke.mjs # pre-release live smoke
Built with AI-assisted scaffolding; architecture, quality heuristics, tool contracts, and tests are hand-designed — see the ADRs for the reasoning.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。