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 分