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 分