Ctx

io.github.vanshulgoyal101由 GitHub 帳號 vanshulgoyal101 發布v1.0.0更新於 Oct 24, 2026

Turn a GitHub repo or docs site into agent-ready context: pack it or search it, over MCP.

已驗證Streamable HTTP可網頁執行網頁搜尋與抓取知識與記憶開發者工具

概覽

AI 產生的概覽

遠端 MCP 伺服器,可將 GitHub 儲存庫或文件網站轉成以 token 計量的上下文,供助理整份打包或檢索。

可以做什麼
  • 把 GitHub 儲存庫打包成一份帶檔案路徑標題與 token 估算的上下文,可用 include/exclude 萬用字元與 token 預算篩選
  • 檢索儲存庫,只回傳符合的片段,並附檔案路徑、行號與相關性分數
  • 列出儲存庫會納入的純文字檔案及其位元組大小,並依路徑讀取任一單一檔案
  • 從起始網址爬取文件網站,依深度與頁數上限整理成一份 Markdown 上下文
  • 檢索文件網站,只回傳符合的片段,並附頁面網址、行號與分數
適用情境
適合助理需要了解或回答關於公開 GitHub 儲存庫或文件網站的問題,而不必貼上整份檔案的情況。檢索類工具適合定位具體細節,打包類工具適合在 token 預算內快速掌握全貌。
執行需求
無需安裝:這是遠端 streamable HTTP 端點,在 MCP 用戶端設定中依網址加入即可。僅支援 stdio 的用戶端需以 npx mcp-remote 橋接。公開儲存庫不需帳號或金鑰;營運方可選擇設定 GITHUB_TOKEN Worker 密鑰,以提高 GitHub 速率限制並讀取私有儲存庫。
安裝前請注意
文件類工具會抓取呼叫端提供的網址,助理可讓伺服器爬取任意公開網頁,但每次重新導向都會重新經過 SSRF 防護檢查。儲存庫與網頁內容會作為上下文回傳給助理,其中的不可信文字會進入模型。請求依 IP 限流,下載有大小上限。不儲存程式碼,也不涉及 LLM。

安裝

在 SourceWeft 中

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

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

交給代理程式安裝

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

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

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

其他 MCP 客戶端

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

{
  "mcpServers": {
    "ctx": {
      "type": "http",
      "url": "https://ctx.vanshul.com/mcp"
    }
  }
}

README

ctx.vanshul.com

[MCP Registry] [Endpoint] [License: MIT]

A public Model Context Protocol (MCP) server, running as a Cloudflare Worker, that turns a GitHub repository or a documentation site into agent-ready context. Point an AI agent at it and it can pack a whole repo (or crawl a docs site) into one token-counted blob — or search it and get back only the relevant passages, each with its file/URL and line.

It's the agent-first companion to mcp/: where mcp reads a single web page, ctx reads whole repos and doc sites. The repo pipeline fetches, gunzips and parses the tarball in-process; docs extraction reuses Mozilla Readability + Turndown.

Endpoint

POST https://ctx.vanshul.com/mcp     # JSON-RPC 2.0 (MCP)GET  https://ctx.vanshul.com/health  # { ok: true, tools: [...] }

Tools

ToolInputReturns
pack_repo{ repo, ref?, include?, exclude?, max_tokens? }The repo as one context blob with ==== path ==== headers + token estimate
search_context{ repo, query, ref?, include?, exclude?, max_matches?, context_chars? }Only the passages matching query, each with file, line and score
list_files{ repo, ref?, include?, exclude? }JSON: the text files ctx would include, with byte sizes
get_file{ repo, path, ref? }The full text of a single file
pack_docs{ url, depth?, max_pages?, max_tokens? }A crawled docs site as one context blob (each page → Markdown)
search_docs{ url, query, depth?, max_pages?, max_matches?, context_chars? }Only the docs passages matching query, each with page URL, line and score

repo is owner/repo, owner/repo/ref, or a github.com URL. url (for the docs tools) is an absolute http(s) docs page to start crawling from.

Connect from an MCP client

json
{ "mcpServers": { "ctx": { "url": "https://ctx.vanshul.com/mcp" } } }

Stdio-only clients bridge with npx mcp-remote https://ctx.vanshul.com/mcp.

Add it to your client

  • Cursor — Settings → MCP → Add new server, or drop this into ~/.cursor/mcp.json:
    json
    { "mcpServers": { "ctx": { "url": "https://ctx.vanshul.com/mcp" } } }
  • Claude Desktop — add the same block to claude_desktop_config.json (Settings → Developer → Edit Config). If your version is stdio-only, use:
    json
    { "mcpServers": { "ctx": { "command": "npx", "args": ["mcp-remote", "https://ctx.vanshul.com/mcp"] } } }
  • Continue / VS Code — add ctx with URL https://ctx.vanshul.com/mcp to your MCP servers config.

Try it with curl

sh
# Pack a repo, capped to 8000 tokenscurl -s https://ctx.vanshul.com/mcp -H 'content-type: application/json' \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",       "params":{"name":"pack_repo","arguments":{"repo":"sindresorhus/slugify","max_tokens":8000}}}'
# Search a repo for just the relevant passagescurl -s https://ctx.vanshul.com/mcp -H 'content-type: application/json' \  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",       "params":{"name":"search_context","arguments":{"repo":"sindresorhus/slugify","query":"replace separator"}}}'

Layout

ctx/├── src/│   ├── worker.ts     # entry: routes /mcp, /health, rate limit, CORS│   ├── mcp.ts        # JSON-RPC dispatch + the six tool definitions│   ├── github.ts     # fetch tarball, gunzip, parse tar, filter files (no deps)│   ├── pack.ts       # assemble the context blob + token estimate│   ├── search.ts     # ranked passage search over files (file + line)│   ├── docs.ts       # crawl a docs site into pages (BFS, same-section)│   ├── extract.ts    # HTML -> Markdown / links (Readability + Turndown)│   ├── fetcher.ts    # bounded fetch with re-validated redirects (SSRF)│   └── security.ts   # SSRF guard (block private/internal addresses)├── public/│   ├── index.html    # landing page (served for non-API paths)│   ├── og.png / og.svg│   ├── robots.txt│   └── sitemap.xml├── tests/            # vitest: github (tar parsing), pack, search, mcp, worker├── docs/             # architecture, tools/API reference, deployment├── wrangler.toml├── package.json└── tsconfig.json

Develop & deploy

sh
cd ctxnpm installnpm run typechecknpm test           # vitest — full suitenpm run dev        # local worker at http://localhost:8787  (POST /mcp)npm run deploy     # wrangler deploy

How it works

owner/repo → github.com tarball → DecompressionStream('gzip')           → in-process tar parse → drop binaries/lockfiles/build dirs           → pack (concat + token estimate) OR search (ranked passages)

The GitHub URL is always constructed from a fixed owner/repo slug, so the repo tools have no SSRF surface. The docs tools fetch caller-supplied URLs, so every URL and redirect hop is re-validated against the SSRF guard. Downloads are bounded (timeout, size caps, page/file-count caps) and results are cached per-isolate for a few minutes.

Security & limits

  • No SSRF: input is a repo slug, not an arbitrary URL; only github.com is fetched.
  • Bounded: 20s download timeout, ~60 MB uncompressed cap, 512 KB/file, ≤3000 files, per-IP rate limit.
  • Stateless & private: no code stored, no LLM in the loop; public repos by default (private with a token).

Authentication (optional)

Set a GITHUB_TOKEN Worker secret to lift GitHub's rate limit (60 → 5,000/hour) and read private repos:

sh
wrangler secret put GITHUB_TOKEN

The token is a Worker secret only — never a tool argument — so it can't leak to an agent.

Documentation

License

MIT © Vanshul Goyal

來源:README.md,提交 5860b7c

工具

6

pack_repo

Fetch a GitHub repository and return it as one agent-ready context blob: text files concatenated with clear "==== path ====" headers, binaries/lockfiles/build dirs stripped, with a token estimate. Use include/exclude globs to focus, and max_tokens to fit a budget.

輸入參數refrepo必填excludeincludemax_tokens

search_context

Search a GitHub repository and return only the passages that match a query — each with its file path, line number and a relevance score. Far more token-efficient than pack_repo when you need a specific detail (e.g. "where is auth handled?").

輸入參數refrepo必填query必填excludeincludemax_matchescontext_chars

list_files

List the text files ctx would include for a repository (after stripping binaries, lockfiles and build dirs), with their byte sizes. Cheap way for an agent to see the layout before packing.

輸入參數refrepo必填excludeinclude

get_file

Return the full text of a single file in a repository, by path. Use after list_files or search_context to drill in.

輸入參數refpath必填repo必填

pack_docs

Crawl a documentation site from a start URL and return it as one agent-ready context blob: each page extracted to clean Markdown, concatenated with its URL. Stays within the same site section; bounded by depth and page count. Use max_tokens to fit a budget.

輸入參數url必填depthmax_pagesmax_tokens

search_docs

Crawl a documentation site and return only the passages that match a query — each with its page URL, line and a relevance score. Token-efficient way to answer a question from docs without packing the whole site.

輸入參數url必填depthquery必填max_pagesmax_matchescontext_chars

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

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

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