Refinery MCP

io.github.LareLabs由 GitHub 账号 LareLabs 发布v0.1.6更新于 Oct 27, 2026

Clean raw HTML into LLM-ready text before agents spend tokens.

概览

AI 生成的概览

本地 MCP 服务器,借助 Apify actor 把原始 HTML 或网址转成干净的、适合大模型的文本并给出词数。

可以做什么
  • 通过 Refinery Apify actor 抓取网址,返回干净文本与元数据
  • 清洗智能体、爬虫或浏览器会话已获取的原始 HTML
  • 在本地对比原始 HTML 与清洗后文本,估算可节省的 token
适用场景
适用于智能体已抓取页面或持有原始 HTML、希望在 RAG 入库、向量化或提示前做一次确定性清洗的场景。它不是爬虫或渲染器,需配合自己的抓取工具使用。
运行要求
以 stdio 在本地运行,通常用 npx 从 npm 包启动,需要 Node.js。需要 Apify API 令牌(环境变量 APIFY_TOKEN),可选 REFINERY_ACTOR_ID 指定 actor。网址与 HTML 清洗工具需要访问 Apify 的网络连接。
安装前请注意
Apify 令牌是可计费凭据:clean_url 与 clean_html 会把内容发送给 Apify actor 并消耗 Apify 额度,而 estimate_savings 在本地运行、不消耗额度。提交的页面内容与网址会离开本机发送至 Apify。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Refinery MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Refinery MCP

Clean HTML before your agent burns tokens.

Landing page · Apify Actor

Refinery MCP wraps the Refinery Apify Actor as an MCP server so Claude, Cursor, and other agents can turn raw HTML or URLs into clean LLM-ready text plus word_count.

[Agent pipeline: fetch, Refinery MCP, clean text, RAG]

mermaid
flowchart LR  A[Agent needs web context] --> B[Fetch URL or raw HTML]  B --> C[Refinery MCP]  C --> D[Refinery Apify Actor]  D --> E[Clean text + word_count]  E --> F[RAG / embeddings / LLM context]

The Problem

Agents are getting good at fetching web pages. The problem is what they fetch:

html
<html>  <head>    <script>gtag("event", "page_view")</script>    <style>.nav,.cookie,.footer{display:block}</style>  </head>  <body>    <nav>Home · Pricing · Login · Docs · Blog · Careers</nav>    <aside>Subscribe to our newsletter</aside>    <article>      <h1>How ACME cut support ticket routing time by 63%</h1>      <p>ACME routes 40,000 monthly support tickets through an AI triage system.</p>      <p>The team reduced retrieval noise by cleaning HTML before chunking.</p>    </article>    <footer>Legal · Privacy · Cookie settings · LinkedIn · X</footer>  </body></html>

The model does not need most of that. It needs this:

text
How ACME cut support ticket routing time by 63%
ACME routes 40,000 monthly support tickets through an AI triage system.The team reduced retrieval noise by cleaning HTML before chunking.

[Before and after: bloated HTML vs clean LLM-ready text and token savings]

Refinery MCP gives your agent a tool for that middle step:

text
fetch page -> refine HTML -> send clean text to RAG / embeddings / LLM

Why

Agents can fetch pages, but raw HTML is noisy and expensive:

  • scripts, styles, tracking tags
  • nav, footers, cookie banners
  • repeated links and layout markup
  • huge token burn before the model sees the real content

Refinery is the middle step your agent can call before it stuffs web context into a prompt:

text
fetch/render -> clean/refine -> chunk/embed/answer

It is not a crawler. Use Firecrawl, Crawl4AI, Playwright, browser automation, or your own fetcher when you need rendering. Use Refinery when you already have a URL or raw HTML and want a cheap cleanup pass before the LLM.

When To Use It

Use Refinery MCP when:

  • your agent already fetched a page but got bloated HTML
  • you want a deterministic cleanup step before RAG ingestion
  • you need word_count / token-ish savings before embedding
  • you want to separate crawling from content cleanup

Do not use it as your browser renderer, anti-bot layer, or site crawler.

Tools

clean_url

Fetches a URL through the Refinery Apify Actor and returns dataset rows with clean text and metadata.

Example input:

json
{  "url": "https://docs.stripe.com/payments",  "removeScripts": true,  "removeStyles": true}

clean_html

Cleans raw HTML your agent, crawler, or browser session already fetched.

Example input:

json
{  "html": "<html><body><nav>Home Pricing Login</nav><article><h1>Vendor security update</h1><p>We now support SOC 2 exports for enterprise accounts.</p></article><footer>Legal Privacy Careers</footer></body></html>",  "extractMentions": false,  "extractHashtags": false}

Example result:

json
{  "text": "Vendor security update\n\nWe now support SOC 2 exports for enterprise accounts.",  "word_count": 10,  "content_type": "web",  "language": "en",  "processing_time_ms": 44.96,  "success": true}

estimate_savings

Local helper that compares raw HTML vs cleaned text and estimates token savings. This does not call Apify.

Example output:

json
{  "raw_chars": 168,  "clean_chars": 41,  "estimated_raw_tokens": 42,  "estimated_clean_tokens": 11,  "estimated_token_savings": 31,  "reduction_pct": 76}

Install

bash
npx -y @larelabs/refinery-mcp

Set your Apify token:

bash
export APIFY_TOKEN=apify_api_xxxexport REFINERY_ACTOR_ID=larelabs/refinery-html-to-llm-cleaner

Cursor / Claude Desktop config

Use the published package:

json
{  "mcpServers": {    "refinery": {      "command": "npx",      "args": ["-y", "@larelabs/refinery-mcp"],      "env": {        "APIFY_TOKEN": "apify_api_xxx",        "REFINERY_ACTOR_ID": "larelabs/refinery-html-to-llm-cleaner"      }    }  }}

Or run from source during development:

bash
git clone https://github.com/LareLabs/refinery-mcpcd refinery-mcpnpm installnpm run build
json
{  "mcpServers": {    "refinery": {      "command": "npm",      "args": ["run", "dev", "--prefix", "/absolute/path/to/refinery-mcp"],      "env": {        "APIFY_TOKEN": "apify_api_xxx"      }    }  }}

Smoke Test

bash
npm run buildAPIFY_TOKEN=apify_api_xxx npm run smoke

The smoke test starts the MCP server over stdio, lists tools, and calls estimate_savings without spending Apify credits.

Example Agent Prompt

text
Use Refinery MCP to clean this docs page before summarizing it:https://docs.stripe.com/payments
Return the clean text, word_count, and a short summary. Do not summarize raw HTML.

Another useful prompt:

text
I fetched this page HTML with Playwright. Use Refinery MCP clean_html before adding it to my RAG ingestion queue. Return the cleaned text and estimated token savings.

Roadmap

  • Glama listing (glama.json added — submit at https://glama.ai/mcp/servers)
  • mcp.so directory PR (pending)
  • Hosted HTTP/SSE MCP transport
  • Batch URL cleanup tool
  • Glama / PulseMCP / FindMCP / mcp.so listings
  • Optional direct REST wrapper for RapidAPI
  • Token savings benchmark page

License

MIT

来源:README.md,提交 491e2c0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.6最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分