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 分