web2mcp

io.github.charleswei118由 GitHub 帳號 charleswei118 發布v0.2.0更新於 Nov 7, 2026

Zero-dependency Cloudflare Worker gateway turning websites and REST APIs into MCP tools.

已驗證Streamable HTTP可網頁執行網頁搜尋與抓取開發者工具資料與分析

概覽

AI 產生的概覽

一個 Cloudflare Worker 閘道,把維基百科、Hacker News、天氣、地理編碼、匯率和 GitHub 等公開網路資料來源包裝成 MCP 工具。

可以做什麼
  • 搜尋並閱讀維基百科條目(全文搜尋、導言摘要)
  • 瀏覽與搜尋 Hacker News 故事(首頁、關鍵字搜尋)
  • 查詢地點座標、國家、時區,以及目前天氣與每日預報
  • 取得以指定貨幣為基準的最新匯率
  • 依限定條件搜尋 GitHub 儲存庫並查看單一儲存庫詳情
  • 自架部署還可透過連接器接入任意 REST API 或網頁,支援 OpenAPI 匯入與目錄模式
適用情境
適合需要免金鑰快速取得通用公開資料的情境,例如百科查詢、科技新聞、天氣、地點座標、匯率或 GitHub 儲存庫檢索,不必為每個來源另外建立整合。
執行需求
遠端 Streamable HTTP 端點;公開示範未宣告帳號、API 金鑰或請求標頭。自架需要 Cloudflare 帳號與 Wrangler,或以本機 stdio 方式使用 Node.js 20+,也可用 Docker。選用設定包括 AUTH_TOKEN、GITHUB_TOKEN、ENABLED_CONNECTORS、CONNECTORS_JSON、MAX_OUTPUT_CHARS 與 TOOL_MODE。
安裝前請注意
公開示範受免費方案限流,且網頁讀取工具已停用,README 建議實際使用時自行部署。共用 IP 呼叫 GitHub 可能觸及匿名額度上限,除非設定 GITHUB_TOKEN。自架端點若未設定 AUTH_TOKEN 就沒有存取保護。請求會送往維基百科、Hacker News、Open-Meteo、Frankfurter、GitHub 等第三方服務,自行加入的 API 金鑰應存放在伺服器端密鑰中。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 web2mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.charleswei118%2Fweb2mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "web2mcp": {
      "type": "http",
      "url": "https://web2mcp.cwei59969.workers.dev/mcp"
    }
  }
}

README

web2mcp

Turn any website or REST API into MCP tools — one tiny Cloudflare Worker, zero dependencies.

English · 简体中文

[CI] [License: MIT] [Runtime deps: 0] [MCP]

[Deploy to Cloudflare]

GitHub's 665 REST endpoints → 2 MCP tools, ~147,000 tokens of tool definitions → ~300 (catalog mode)

Every AI agent (Claude, ChatGPT, Cursor, your own bots…) now speaks the Model Context Protocol. But most websites and apps don't. web2mcp is the glue: describe an HTTP API in a few lines of config and it instantly becomes an MCP tool that any agent can call — hosted for free on Cloudflare's edge.

 Claude / Cursor / any MCP client              │  MCP (Streamable HTTP, JSON-RPC)              ▼   ┌──────────────────────────┐   │  web2mcp  (CF Worker)    │  connectors/*.js  or  CONNECTORS_JSON   └──────────────────────────┘      │        │        │   Wikipedia  GitHub  any REST API / web page …

Try it now

A public demo is running at https://web2mcp.cwei59969.workers.dev (tool list) with the MCP endpoint at:

https://web2mcp.cwei59969.workers.dev/mcp

Paste it into any client that supports remote MCP servers, or:

bash
curl -s https://web2mcp.cwei59969.workers.dev/mcp -H 'content-type: application/json' \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"weather_forecast","arguments":{"latitude":35.68,"longitude":139.69}}}'

The demo is rate-limited by the free plan and has reader_read disabled. Deploy your own for real use.

Why

  • Config, not code. A connector is a plain object: base URL, path, query, params. No SDK to learn.
  • Zero runtime dependencies. ~500 lines of readable JavaScript. Audit it in 10 minutes.
  • Token-friendly output. pick and fields trim giant JSON responses down to what the model needs.
  • Free hosting. Runs on the Cloudflare Workers free plan. Deploy in one click.
  • Safe by default. Requests are locked to each connector's host, arguments are type-checked, secrets stay server-side, optional bearer auth.
  • OpenAPI import. Convert any OpenAPI 3 spec into a connector with one command.

Built-in connectors (no API keys)

ToolWhat it does
wikipedia_search, wikipedia_summarySearch Wikipedia, read article summaries
hackernews_front_page, hackernews_searchHacker News stories
geocode_searchPlace name → coordinates (Open-Meteo)
weather_forecastCurrent weather + daily forecast (Open-Meteo)
currency_latestECB exchange rates (Frankfurter)
github_search_repos, github_repoPublic GitHub repositories (set GITHUB_TOKEN on Workers: shared IPs hit GitHub's anonymous limit)
reader_readAny web page → clean Markdown (Jina Reader)
npm_package, npmstats_downloadsnpm package info and weekly downloads
arxiv_searchSearch arXiv research papers
holidays_listPublic holidays by country and year (Nager.Date)
holidaycn_yearMainland China holidays and make-up workdays (调休) for a year
baiduhot_realtimeBaidu real-time hot search (百度热搜)
shici_randomA random line of classical Chinese poetry (今日诗词)
bilibili_popular, bilibili_rankingBilibili trending / ranking videos (stdio & self-hosted only: Bilibili blocks Cloudflare IPs)

Deploy your own in one click

Click Deploy to Cloudflare above. Cloudflare copies this repo into your GitHub account, asks for an AUTH_TOKEN (any long random string, e.g. openssl rand -hex 32), then builds and deploys it. A minute later your server is live at https://web2mcp.<your-subdomain>.workers.dev/mcp, and every push to your copy redeploys it. The free Workers plan is enough.

Quick start

bash
git clone https://github.com/charleswei118/web2mcp && cd web2mcpnpm test                 # unit tests, no install needed (Node 20+)npm run smoke            # calls every built-in tool against the real APIsnpx wrangler dev         # local server at http://localhost:8787/mcpnpx wrangler deploy      # your own https://web2mcp.<you>.workers.dev/mcp

Optional: protect your endpoint

bash
npx wrangler secret put AUTH_TOKEN

Connect an AI client

Claude Desktop / Cursor / Windsurf (via mcp-remote):

json
{  "mcpServers": {    "web2mcp": {      "command": "npx",      "args": ["-y", "mcp-remote", "https://web2mcp.<you>.workers.dev/mcp",               "--header", "Authorization: Bearer ${WEB2MCP_TOKEN}"],      "env": { "WEB2MCP_TOKEN": "your-token" }    }  }}

Run locally over stdio (no Cloudflare account needed; same connectors):

json
{  "mcpServers": {    "web2mcp": {      "command": "npx",      "args": ["-y", "github:charleswei118/web2mcp"],      "env": { "ENABLED_CONNECTORS": "wikipedia,hackernews,weather" }    }  }}

Or with Docker: docker build -t web2mcp . && docker run -i --rm web2mcp. Environment variables work the same as Worker bindings (ENABLED_CONNECTORS, CONNECTORS_JSON, MAX_OUTPUT_CHARS, TOOL_MODE=catalog).

Clients that support remote MCP servers natively (Claude.ai custom connectors, ChatGPT connectors, the OpenAI Responses API, Cloudflare AI Playground…) can use the URL directly. Test with the official inspector:

bash
npx @modelcontextprotocol/inspector   # transport: Streamable HTTP, URL: .../mcp

Write a connector

Create connectors/myapi.js and add it to connectors/index.js:

js
export default {  name: "openlibrary",                       // tool names become openlibrary_<tool>  description: "Search books on Open Library.",  baseUrl: "https://openlibrary.org",  headers: { /* "authorization": "Bearer ${MY_API_KEY}" */ },  tools: [    {      name: "search",      description: "Search books by title or author.",      method: "GET",                          // GET | POST | PUT | PATCH | DELETE      path: "/search.json",                   // "{arg}" in the path is URL-encoded      query: { q: "{query}", limit: "{limit}" },      params: {        query: { type: "string", required: true, description: "Title or author" },        limit: { type: "integer", minimum: 1, maximum: 20, default: 5 },      },      pick: "docs",                           // dotted path into the JSON response      fields: ["title", "author=author_name", "year=first_publish_year"],    },  ],};

Template rules:

SyntaxMeaning
"{arg}"Tool argument. As a whole value it keeps its type; missing optional args are dropped.
"${SECRET}"Read from a Worker secret / var — never exposed to the model.
"${?SECRET}"Optional secret: the value is dropped when it is not set.
pick: "a.b.*.c"Select part of the response (* maps over arrays; a single value counts as a one-item list).
fields: ["x", "alias=deep.path"]Keep only these fields.
limit: 10Truncate arrays.
format: "public-url" (on a param)Reject localhost, private/intranet IPs, cloud metadata, embedded credentials and odd ports before any request is made (SSRF guard). Used by reader_read.
response: "xml"Parse an XML/Atom/RSS response into JSON first, so pick / fields work on it (attributes become @name, namespace prefixes are dropped, repeated elements become arrays). Also "json", "text" (raw body) or "auto" (default).

No-code option: put connectors in the CONNECTORS_JSON secret (a JSON array of the same objects) and they appear without touching the code. Use ENABLED_CONNECTORS="wikipedia,weather" to expose only some.

From an OpenAPI spec

bash
node scripts/openapi2connector.js https://petstore3.swagger.io/api/v3/openapi.json petstore --only GET > connectors/petstore.js

Catalog mode: 665 endpoints, 2 tools

Exposing every endpoint as its own tool floods the model's context. In catalog mode web2mcp exposes just two tools:

  • search_api — find operations by keywords; returns their names and argument schemas
  • call_api — run one operation by name with an arguments object

Measured with GitHub's full REST OpenAPI spec (GET operations only, converted with scripts/openapi2connector.js):

ModeTools in tools/listApprox. context
Default (one tool per endpoint)665~147,000 tokens
Catalog2~300 tokens

Turn it on per request with /mcp?mode=catalog, or for the whole deployment with the variable TOOL_MODE = "catalog" (?mode=tools switches back). Try it on the demo: https://web2mcp.cwei59969.workers.dev/mcp?mode=catalog.

Endpoints

Path
POST /mcpMCP Streamable HTTP endpoint (JSON responses, batch supported)
POST /mcp?mode=catalogSame, in catalog mode (search_api + call_api)
GET /Human-readable list of tools
GET /toolsTool list as JSON
GET /healthHealth check

Supported MCP methods: initialize, ping, tools/list, tools/call, plus empty resources/list and prompts/list. Protocol versions 2025-06-18, 2025-03-26, 2024-11-05.

Roadmap

  • Catalog mode (search_api + call_api) — v0.2
  • Load OpenAPI specs at runtime from a URL
  • One-click “Deploy to Cloudflare” — v0.2
  • HTML scraping connectors (CSS selectors via HTMLRewriter)
  • Per-tool rate limits and KV caching
  • OAuth for connectors that need user accounts
  • Connector registry: share connectors as JSON files
  • Agent-to-agent (A2A) chat rooms on Durable Objects

PRs with new connectors are very welcome — see CONTRIBUTING.md.

Responsible use

Only connect APIs and sites you are allowed to use. Respect each service's terms, robots rules and rate limits, and keep credentials in Worker secrets.

License

MIT

If web2mcp saves you time, please ⭐ the repo — it helps others find it.

來源:README.md,提交 76cbc3b

工具

9

wikipedia_summary

Wikipedia: summary

[wikipedia] Get the lead summary of a Wikipedia article by exact title.

輸入參數title必填

hackernews_front_page

Hacker News: front_page

[hackernews] Stories currently on the Hacker News front page.

輸入參數limit

weather_forecast

Open-Meteo Weather: forecast

[weather] Current conditions plus a daily forecast (max/min temperature, precipitation, weather code).

輸入參數dayslatitude必填longitude必填

currency_latest

Frankfurter exchange rates: latest

[currency] Latest exchange rates from a base currency.

輸入參數basesymbols

github_search_repos

GitHub: search_repos

[github] Search repositories. Supports GitHub qualifiers like 'mcp language:rust stars:>100'.

輸入參數sortlimitquery必填

github_repo

GitHub: repo

[github] Get details of one repository.

輸入參數repo必填owner必填

版本歷史

1
  1. v0.2.0最新Oct 31, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分