tiny-context — efficient file tools by AVRG3

io.github.Warddamn由 GitHub 账号 Warddamn 发布v0.3.0更新于 Oct 24, 2026

Local document queries, saved extraction profiles, spreadsheet SQL, logs and keyed JSON changes.

概览

AI 生成的概览

一个本地 MCP 服务器,让助手在不整份读取的情况下概览、搜索、切片、查询、比对、校验和提取本地文件,包括 PDF、DOCX、PPTX 和 XLSX。

可以做什么
概览文件与目录而不读取内容:标题结构、代码签名、工作表、幻灯片标题、页码和体积树。跨多个文件检索排序后的段落,再只读取指定的标题、页、行、段落、工作表或幻灯片范围。对 CSV、TSV、Parquet 或 XLSX 执行一条只读 SQL 查询,返回聚合结果而非原始行。把日志归纳为带计数和时间范围的聚类错误。比对文档、表格或带键的 JSON/JSONL 记录,校验 JSON、YAML、XML、CSV 和链接,并按正则、内置类型或 jq 提取值。
适用场景
适合助手处理较大的本地文档、表格、日志或 JSON 导出,并希望得到有界答案而不是整份读取的场景。适合反复出现的阅读与审查任务,例如在 PDF 中找条款、汇总表格某列或比较两份导出。小文本文件和精确字符串搜索用内置工具往往更省。
运行要求
以 stdio 在本地运行,需要 Node.js 20+,部分客户端自带。可通过按操作系统区分的 MCPB 包(未签名,约 34 至 96 MiB)安装,或用指向 GitHub 发布压缩包的 npx 命令。首次启动会下载发布包和依赖,包括表格查询可选的 DuckDB,因此不是离线安装包。无需账号、API 密钥或令牌。
安装前请注意
工具会读取本地文件并把选中的文本返回给 MCP 客户端,客户端可能将其发送给模型提供商。导出必须指定 out 路径且不会覆盖已有文件;SQL 仅限一条只读查询,外部文件和网络访问被禁用,但这并非操作系统级安全沙箱。可选的 Read 守卫钩子会拦截内置读取并启动单独进程。安装包未签名,请核对哈希。服务器不发送遥测数据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 tiny-context — efficient file tools by AVRG3,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

tiny-context — MCP tools for document search, SQL and JSON export changes

Know things about files without reading them. Eight local, deterministic MCP tools that let an AI agent outline, search, slice, query, cluster, diff, validate and extract from files — including PDF, DOCX, PPTX and XLSX — and get back only what it needs, with a savings line on every response.

Find a tool by task, with example inputs · Actual tool schemas · Installation. Built by AVRG3.

[GitHub release] [CI] [License: MIT] [Install in Cursor] [Install in VS Code]

Designed for agents seeking fewer steps on file tasks:

  • Explain a large error log: summarize_log returns repeated errors, counts and time ranges without sending every log line into context.
  • Answer a spreadsheet question: query_table runs SQL over CSV/XLSX/Parquet and returns the result instead of the source rows.
  • Find a PDF or Office passage: query_file returns ranked matches; read_section reads a known location. Use file_map only when an outline is useful.
  • Compare JSON/JSONL exports: diff_files records mode matches orders, issues or inventory by explicit IDs and reports actual changes despite shuffled rows. Choose fields such as status/quantity; receive exact scoped counts and bounded before/after previews. Contract and example.

Measure the whole task: the tool response can be much smaller than the source file, but startup, validation and extra agent turns still cost time. Results depend on the task and client. Agent comparison, including regressions · Historical first comparison.

The whole-file-read benchmark below measures a different baseline; its savings are not a prediction for a capable agent.

Find tiny-context

Listed in the official MCP Registry as io.github.Warddamn/tiny-context, with a Glama profile. Directory indexing is controlled externally; your client must still connect the server before an agent can call it.

New in 0.2.0: compare records by ID

diff_files now accepts mode: "records" for JSON/JSONL/NDJSON snapshots, explicit key pointers and optional fields/records_path. It rejects ambiguous IDs and precision loss; out saves every change as JSONL without replacing existing files. Eight tools remain; no new dependency or model call. Worked example and limits · Benchmark against an existing correct script · Real-agent checks.

This avoids sending unchanged records to the model, but still reads both files locally. Small files and existing correct scripts can be cheaper and faster.

Safety controls (introduced in 0.1.1)

Upgrade older installs using the current install button/config below, then reconnect the server. Existing version-pinned installations do not update automatically.

SQL accepts one read-only query against the supplied table. External file/network access and SQL write commands are disabled; exports require out and never replace existing files. Input/export limits are 64 MB; the query worker defaults to a 15-second deadline with bounded engine/JavaScript memory. These controls are not an operating-system security sandbox.

Go directly to query_file for a question or read_section for a known location; use file_map only when an outline is useful. Repeated document reads reuse a cache of up to eight files, 16 MB of serialized parsed data, and 30 seconds, checking file identity and modification metadata on every hit. The optional Read hook still builds an outline and starts a separate process; it can add work and is not required. Small text and exact-string searches often need only built-ins. Tools have startup/validation overhead and do not guarantee lower total cost on every task.

New in tiny-context 0.3.0: reusable document profiles

Save a document's labels and checks once, then use extract on recurring forms/reports in one batch. TXT/Markdown, DOCX and text-layer PDFs; no training, model calls or automatic inference. Missing or ambiguous fields return needs_review without partial values. Profiles remain local, and every new document is parsed and checked again. Save and reuse a profile · Setup, batch and prepared-script measurements.

A smaller response is not proof of a smaller bill. Earlier keyed-comparison trials ran faster but cost about 33% and 3% more in their two paired runs. Profiles are opt-in for repeated work, not a replacement for a cheap single read or an existing correct script. Their total tool-definition payload is slightly smaller than 0.2.0 after shortening descriptions; agent/setup/cache costs still depend on the client. The saved-profile trial and its limits include the initial extra-call issue and the corrected result.

Install

MCPB-compatible clients: download the bundle for your OS from the agent bundle release and open it in your client. darwin = macOS, win32 = Windows, linux = Linux. Each bundles dependencies for x64 and arm64; a Node.js 20+ runtime is still required (some clients provide it). These are unsigned bundles with SHA-256 hashes in the registry. Downloads are approximately 77 MiB for macOS, 96 MiB for Linux and 34 MiB for Windows. All eight tools were tested from extracted bundles on macOS, Linux and Windows; not every CPU/OS combination or client UI has been tested.

Other MCP clients: use the existing commands below. They download only the dependencies needed for the current machine.

Node.js 20+ required. No npm account or token needed. Use the published GitHub release below. The npm package is not yet published; these commands do not depend on it. The server runs locally over stdio. Allow the first launch time to download its dependencies.

Claude Code

bash
claude mcp add tiny-context -- npx -y -p https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz tiny-context-mcp

Codex CLI (writes [mcp_servers.tiny-context] to ~/.codex/config.toml)

bash
codex mcp add tiny-context -- npx -y -p https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz tiny-context-mcp

Cursor — .cursor/mcp.json, or click the Install in Cursor badge above

json
{ "mcpServers": { "tiny-context": { "command": "npx", "args": ["-y", "-p", "https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz", "tiny-context-mcp"] } } }

VS Code — .vscode/mcp.json (note the servers key), or click the Install in VS Code badge above

json
{ "servers": { "tiny-context": { "type": "stdio", "command": "npx", "args": ["-y", "-p", "https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz", "tiny-context-mcp"] } } }

Windsurf — ~/.codeium/windsurf/mcp_config.json

json
{ "mcpServers": { "tiny-context": { "command": "npx", "args": ["-y", "-p", "https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz", "tiny-context-mcp"] } } }

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) · %APPDATA%\Claude\claude_desktop_config.json (Windows)

json
{ "mcpServers": { "tiny-context": { "command": "npx", "args": ["-y", "-p", "https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz", "tiny-context-mcp"] } } }

Then paste docs/AGENT_USAGE.md into your CLAUDE.md / AGENTS.md / .cursorrules so the agent reaches for the tools at the right moments. Claude Code users can also add the Read guard hook, an optional stricter policy. Start with the snippet; the hook did not improve the measured comparison.

TINY_TOOLS_DEBUG=1 logs each call to stderr.

Try it with your agent

Restart or reconnect your client after setup. Confirm that tiny-context is connected and exposes eight tools. Then use the three worked examples for a CSV question, a PDF clause and an error log, with expected answers.

Claude Code plugin: /plugin marketplace add Warddamn/tiny-tools, then /plugin install tiny-context@tiny-tools. This includes both the server and task-selection guidance. Choose this or the manual MCP setup to avoid duplicate servers.

Privacy

  • No telemetry from the tools. No usage reports or analytics are sent by the server.
  • The tools process local files and return selected text to your MCP client. They do not call a model or upload files themselves; your client may send that text to its model provider according to its settings.
  • First launch downloads the release and third-party dependencies using npm, including optional DuckDB for query_table. This is not an offline installer. GitHub and npm maintain their own download counters; those are not counts of agents or people.

What it replaces

Whole-file Read/cat calls that mattered for one turn; ls+grep+head loops to learn what a folder holds; scripts written just to sum a column; tail/grep loops over logs; opening PDFs and Office files that built-in tools can't read at all.

Why

~50% of a typical agent's context window is tool results, dominated by whole-file reads that mattered for one turn; agent workloads are read/review-heavy (~59% checking vs ~9% writing in published measurements); keeping intermediate data out of context has shown up-to-98% token reductions. These tools let an agent know things about files without reading them. Every response is bounded and ends with a savings line.

Reducing tokens-per-step and wall-clock-per-step is what lets an agent take more steps before its context degrades — a capability multiplier, not just a cost saving.

Benchmarks

17 tasks · 7,417,733 naive tokens → 9,158 tool tokens · 99.9% saved overall · median 11ms per call

ToolTaskNaive tokensTool tokensSavedTime
query_tabletotal sales by region (sales.csv)1,370,7627599.99%0.2s
query_tablehow many rows have a negative total (sales.csv)1,370,7623799.99%0.2s
query_tablewhich columns exist and their types (sales.csv)1,370,76218699.99%0.2s
summarize_logwhat's causing the 5xx spike (app.log)731,14538099.9%35ms
summarize_logsummarize this log (app.log)731,14569899.9%92ms
file_mapwhat's in this 100-page contract (contract.pdf)72,0552,06597.1%0.2s
query_filewhere does the contract discuss termination (contract.pdf)72,05571399.0%14ms
read_sectionread the termination pages (2 of 100) (contract.pdf)72,0551,52897.9%4ms
file_mapoutline the 40-page handbook (handbook.docx)31,69948398.5%7ms
query_filedoes the handbook cover remote work (handbook.docx)31,69931099.0%4ms
read_sectionread the handbook's Termination section (handbook.docx)31,6991,16696.3%1ms
extractevery email address in the handbook (handbook.docx)31,6995199.8%2ms
diff_fileswhat changed between two handbook versions (handbook.docx ↔ handbook-v2.docx)63,42929399.5%5ms
file_mapwhat's in this source tree (src/)2,78832788.3%3ms
file_mapwhich functions are in this module (src/…/paths.ts)1,60725983.9%3ms
query_filewhich functions call resolveInputs (src/**/*.ts)61,61055099.1%11ms
validate_fileis this 100k-row CSV well-formed (sales.csv)1,370,7623799.99%59ms

Fixtures (generated locally, seeded): sales.csv 5.2 MB · app.log 2.8 MB · contract.pdf 206 KB · handbook.docx 29 KB (100,000 rows · 50,000 lines · 100 pages · ~18k words) · src/ 38 TypeScript files. · Generated 2026-09-22; re-run with npm run bench.

Measured the way an agent would experience it: naive = tokens to read the raw content the task needs (bytes/4); tool = tokens of the tool's full response. Fixtures are generated locally by bench/.

Historical comparison (2026-09-19, before this patch): the same 12 tasks through headless Claude Code with and without tiny-context gave identical answers; the tools cut tokens ~20%, cost ~19%, wall-clock ~50% and turns 4.3 → 3.5, because one call replaces a loop of shell probes. See the archived evals/COMPARISON-2026-09-19.md; current results are in evals/COMPARISON.md.

Size

Install size: 134.7 MB (108 packages) — 21.9 MB without DuckDB, which only query_table needs. Largest: @duckdb/node-bindings-darwin-arm64 112.1 MB · zod 5.9 MB · @modelcontextprotocol/sdk 4.1 MB · unpdf 2.0 MB. Measured 2026-09-22 by npm run bench.

Dependencies and why each one earns its place:

DependencyWhyLoaded
@modelcontextprotocol/sdkthe official MCP server/client (stdio)at start
zodone schema drives lib, CLI and MCP; param descriptions live hereat start
commanderthe CLICLI only
@tiny_tools_pw/sharedpath/glob resolution, safe outputs, teach-errors, ledger, text extraction (pdf via unpdf, office via fflate + regex)at start; unpdf lazily
@duckdb/node-api (optional, native)SQL over CSV/TSV/Parquet/XLSX in query_tablelazily, only for query_table
ajv · yaml · fast-xml-parserJSON Schema · YAML · XML checks in validate_filelazily, per check

No models, no binaries, no network. extract uses system jq when present and a built-in path subset otherwise.

The Read guard hook (recommended)

Tool descriptions and the snippet make an agent choose tiny-context. The hook removes the choice: it intercepts the built-in Read when the target is a PDF/DOCX/PPTX/XLSX (which Read can't open) or a text file over 20 KB, blocks it, and hands the agent the file's outline plus the exact follow-up calls (read_section, query_file, query_table, summarize_log). Small files and Reads that already pass offset/limit are untouched. Any error inside the hook lets the Read through.

Claude Code — add to ~/.claude/settings.json (all projects) or .claude/settings.json (one project):

json
{  "hooks": {    "PreToolUse": [      { "matcher": "Read", "hooks": [ { "type": "command", "command": "tiny-context-read-guard", "timeout": 30 } ] }    ]  }}

tiny-context-read-guard is on PATH after npm i -g https://github.com/Warddamn/tiny-tools/releases/download/context-v0.3.0/tiny-context-standalone-0.3.0.tgz (or use the full path to hooks/read-guard.mjs). Threshold: TINY_CONTEXT_READ_GUARD_KB (default 20). Measured effect: see evals/COMPARISON.md (the hook condition runs with no snippet at all).

Tools

ToolOne lineBeats the built-in because
file_mapOutline of a file/dir without contents: headings, signatures, sheets/columns, slide titles, pages, size treeone call replaces ls+grep+head loops; opens office/PDF formats
query_fileRanked passages (BM25 + exact-phrase boost, or regex) across many files with exact locationsGrep can't search PDF/office files or rank across files; the follow-up read is surgical
read_sectionOnly the located part: heading section, page range, line range, ¶ range, sheet range, slideRead can't slice a PDF/DOCX/XLSX/PPTX; pairs with file_map/query_file
query_tableDuckDB SQL over CSV/TSV/Parquet/XLSX (table t), total rows reported, full result to CSV via outaggregates without the data entering context; no script writing
summarize_logTemplate clusters with counts, first/last time, one sample each; level counts; rate timeline80k lines → ~300 tokens; grep loops can't see structure
diff_filesDocument/table changes, unified diff, or keyed JSON/JSONL record changes with field scope and full reportone bounded result despite reordered exports; no guessed IDs
validate_fileJSON/YAML/XML parse · CSV shape · JSON Schema · Markdown/HTML internal links · encoding/BOMone call, no linter setup; deterministic checks you don't re-read for
extractRegex / built-in kinds (emails, urls, dates, numbers) / jq values with locations and countsGrep can't open office/PDF; dedupe + kinds + jq in one place

Every response: headline · bounded payload (≤ ~4,000 tokens) · caveats (caps hit, files skipped) · Returned ~214 tokens · raw ≈ 48,200 tokens · 99.6% saved · 0.4s.

Every error says what went wrong and what to do next (Input not found: … — accepts absolute paths and globs like './shots/*.png'; SQL errors include the table's columns and types).

CLI

bash
tiny-context map ./srctiny-context map ./report.docxtiny-context query ./contract.pdf "termination notice" -n 5tiny-context read ./contract.pdf --pages 3-5tiny-context read ./spec.md --heading Installationtiny-context read ./book.xlsx --sheet Sales --range A1:F20tiny-context table ./sales.csv "SELECT region, SUM(total) FROM t GROUP BY 1"tiny-context log ./app.log --focus errors --since 2htiny-context diff ./v1.docx ./v2.docxtiny-context validate ./out/data.json --schema ./schema.jsontiny-context extract ./docs/*.pdf --kind emailstiny-context extract ./data.json --jq ".items[].name"

Exit code 0 on success, 1 with the teach-error on stderr otherwise. tiny-context tools lists the MCP tools.

Tool reference

file_map

path (file or directory) · depth? (default 2, max 8). Markdown/DOCX → heading tree with line/¶ and word counts; code → function/class/method signatures with line numbers + imports (regex per language: TS/JS, Python, Go, Rust, Java/Kotlin/C#/C/C++, Ruby, PHP, Swift, shell, SQL); XLSX → sheets, headers, row/col counts; PPTX → slide titles; PDF → pages, outline, first line per page; CSV → columns + row count; JSON → shape; log → levels + span; directory → size-annotated tree (skips node_modules, .git, dist, … with counts).

query_file

path or paths[] (globs ok) · query · regex? · max_results? (8, cap 30) · context_lines? (2). Ranks ~700-char passages by BM25 with an exact-phrase boost; each hit shows file · location (heading path) and a short excerpt. Unreadable inputs are listed under skipped: and the rest still run.

read_section

path · locator = {heading} | {pages:"3-5"} | {lines:"120-180"} | {paras:"88-95"} | {sheet, range:"A1:F20" | "10-40"} | {slide: 4 | "2-5"} · max_tokens? (2000, cap 8000). When capped, the response says exactly which locator continues.

query_table

path (csv/tsv/parquet/xlsx/json) · sql (table t) · max_rows? (50, cap 200) · out? (CSV path for the full result) · sheet? (xlsx). Reports total result rows before capping. Errors include column names and types.

summarize_log

path · focus? (errors | warnings | keyword/regex) · since? (ISO or 2h/30m/3d) · max_clusters? (15, cap 50). Masks numbers/hex/uuids/ips/paths/urls/emails before grouping; recognises ISO, YYYY/MM/DD, syslog, Apache CLF and epoch timestamps.

diff_files

a · b · mode? (summary | unified | records) · max_hunks? (20, cap 100). Summary mode: two tables (csv/xlsx) → row-level add/remove/change (matched on the first column when it is unique); otherwise patience diff over extracted text. Records mode: JSON/JSONL/NDJSON with required key JSON Pointers, optional fields, records_path, and out for a complete JSONL report. Full record contract.

validate_file

path · schema? (JSON Schema, draft-07 or 2020-12). Checks by extension: json/jsonl · yaml · xml/svg · csv/tsv · md/html links, anchors and images; always: BOM, invalid UTF-8, NUL bytes, mixed line endings.

extract

Saved profiles: profile + batch paths, optional out (full JSONL report). Up to 100 recurring labeled TXT/Markdown, DOCX or text-layer PDF files. No training; checks required anchors/fields each time. Review rows first in bounded previews. Profile format and example. Other extraction modes follow:

path or paths[] · one of pattern (+ ignore_case?) | kind (emails urls dates numbers) | jq · max_matches? (100, cap 500) · dedupe? (true). jq uses the system binary when installed; the fallback supports .a.b, .items[], .items[2].name, .["k"], keys, length, values, .. and | chains.

Limits (honest)

No embeddings — query_file is keyword ranking. Code outlines are regex-based. PDFs without a text layer (scans) report NO TEXT LAYER; OCR is out of scope. query_table sees one file as one table (no joins). Nothing here calls a network or a model.

License: MIT.


Built by AVRG3 · MIT

来源:packages/context/README.md,提交 bd6d933

工具

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

版本历史

3
  1. v0.3.0最新Oct 1, 2026
  2. v0.1.1Sep 22, 2026
  3. v0.1.0Sep 21, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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