Borrowing it
Nothing to install: this file belongs to tmchao7/local-vision-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/tmchao7/local-vision-mcp/main/CLAUDE.mdgit clone --depth 1 https://github.com/tmchao7/local-vision-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/tmchao7/local-vision-mcp/claude-md)<a href="https://agentmods.dev/instructions/tmchao7/local-vision-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/tmchao7/local-vision-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/tmchao7/local-vision-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/tmchao7/local-vision-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02137 | $0.02137 |
| Opus 5 | $0.01069 | $0.01069 |
| Sonnet 5 | $0.00427 | $0.00427 |
| Haiku 4.5 | $0.00214 | $0.00214 |
Grade A, and why
local-vision-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What this project is
A local MCP server that gives text-only coding agents (Claude Code, DeepSeek/Codex workers) vision capability via a locally deployed Ollama vision model. The agent calls one tool, vision_analyze, with an explicit local image path; the image is sent to Ollama over localhost and the agent receives a text report. No image bytes ever reach the text LLM API — this is the core privacy invariant.
Commands
npm test # all tests (node:test runner)
npm run test:unit # same as above
npm test -- test/server.test.mjs # single test file
node --test --test-name-pattern="retries" test/ollama-client.test.mjs # single test by name
npm run doctor # health check: Ollama reachable + model installed
npm run smoke # real end-to-end vs local Ollama (generates a PNG in memory)
node bin/local-vision.mjs --print-mcp-config [--format json|codex] # emit trusted MCP config
No build step, no linter, no TypeScript. Plain ESM ("type": "module"), .mjs files, Node 20+.
Architecture
Flow: agent → MCP tool call → loadImage (validateImageInput path allowlist + optional PNG downscale) → OllamaClient.analyzeImage → prompt (+ [img] markers for two images) + base64 image(s) to Ollama /api/chat (grammar-constrained JSON Schema) → normalizeVisionReport → structured result with truncated flag.
bin/local-vision.mjs— entry point. Four modes:--doctor,--smoke,--print-mcp-config(with--format json|codex), or default stdio MCP server. Must never be imported by tests (it connects the transport at module scope); all shareable logic lives insrc/.src/config.mjs— all config from env (VISION_*vars, falls back toOLLAMA_HOST). Builds the path allowlist:CLAUDE_PROJECT_DIR+ userPictures/Desktop/Downloads+VISION_ALLOWED_PATHS(delimiter-split).src/server.mjs—createVisionServer({ config, client, fetchImpl, log }). Registers the singlevision_analyzetool with a zod schema (path+ optionalsecondary_pathfor image comparison); the handler is single-exit throughresultFor, downscales oversized PNGs vialoadImage, and logs per-call duration/ok/error_code/truncated/images plus a raw-output snippet at debug level. Returns{ server, client, config }— deps injectable for tests.src/validation.mjs—VisionInputErrorwith codes (INVALID_PATH,FILE_NOT_FOUND,PATH_NOT_ALLOWED,UNSUPPORTED_TYPE,NOT_A_FILE,FILE_TOO_LARGE). Allowlist check usesrealpathon both the candidate and the allowed roots to defeat symlink escapes. PNG/JPEG/WebP only, 20 MB cap.src/ollama-client.mjs—OllamaClientwithfetchImplinjected (never real network in tests).analyzeImage(POST/api/chat,stream: false,format=VISION_REPORT_SCHEMA(grammar-constrained JSON Schema, exported for tests),think: false, temp 0.1 / top_p 0.8 / top_k 20 / min_p 0.05 / repeat_penalty 1.1 / fixed seed 3407 /num_ctx16384,num_predict4096 standard / 2048 fast) andlistModels(GET/api/tags). Returns{ content, truncated }(truncated= Ollamadone_reason: "length"); falls back tomessage.thinking(tags stripped) when content is missing — qwen3-vl thinking variants can put the answer there (ollama #12831).timeoutMsis a total budget across both attempts — a first-attempt timeout consumes it and never retries (worst case ~120s, not 240s); 5xx/network errors retry once with the remaining budget.OllamaErrorcodes:MODEL_NOT_FOUND(message appends theollama pullhint),OLLAMA_HTTP_ERROR,OLLAMA_UNAVAILABLE,TIMEOUT,INVALID_RESPONSE.src/prompt.mjs—buildVisionPrompt({ question, mode, detail, imageCount }); mode guidance forui/ocr/general, detail line forfast/standard, a single-line JSON few-shot example, an injection-defense line, and a describe-only scanner contract (no advice/fixes/opinions, explicit uncertainty instead of guessing; OCR transcribes verbatim with[?]for uncertain characters). ForimageCount > 1it prepends[img]markers (one per image, mapped to the Ollamaimagesarray in order) plus compare guidance referencing Image 1/Image 2.src/report.mjs— tolerant normalization of model output: strips ```json fences, accepts aliases (summary/report,visibleText,text_seen,uncertain), caps every string (maxOutputChars, 1000 per list item), lists capped at 24 items, and carries atruncatedflag from context. WhenJSON.parsefails it retries with one closing brace appended — real qwen3-vl output truncates mid-JSON after a complete value, and that free repair recovers the structured report (observed in the real--smokerun). Other unparseable output (mid-string truncation, arrays, fenced-with-prose) falls back to raw text asanswer.createVisionErrorturns any thrown error into a structured report witherror_code.src/log.mjs—createLogger+isDebugEnabled(--debugflag orLOG_LEVEL∈ debug/trace/1). All output to stderr, off by default so plugin mode and tests behave identically.src/doctor.mjs— health check used by--doctor.src/png.mjs— zero-dependency in-memory truecolor PNG builder (node:zlibdeflate + CRC32 with a table fallback for Node <20.15); used by smoke and by resize's re-encode.src/resize.mjs— zero-dependency PNG decoder (8-bit RGB/RGBA only; inflate + all four filters) and bilinear downscaler.pngDimensions/decodePngreturn null for unsupported input so callers pass the original through;resizePng(buffer, maxEdge)returns null when already small enough. Screenshots overVISION_MAX_EDGEare downscaled locally in the server handler.src/smoke.mjs—runSmoke, the real end-to-end check behind--smoke: builds a 96×96 orange-square PNG, callsanalyzeImagedirectly (bypasses the path allowlist), flags empty model output asEMPTY_REPORT, always cleans up its tmp dir.src/mcp-config.mjs—configEnv(7 resolvedVISION_*values, deliberately omitsVISION_ALLOWED_PATHS— the resolved list can't round-trip and an explicit empty value would clobber the shell env),formatMcpServerConfig(json or codex TOML via JSON.stringify escapes — a valid TOML basic-string subset),mcpConfigFormat(genericnormalizes tojson, unknown → error).skills/vision/SKILL.md— Claude Code skill describing when/how to invoke the tool; keep in sync with the tool's behavior.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 52 lines · 2,137 tokens per session scan A 9ae957546fbb
local-vision-mcp CLAUDE.md is an instructions file published in the GitHub repository tmchao7/local-vision-mcp (2 stars, last pushed 1mo ago), licensed MIT. It adds 2,137 tokens to every session, about $0.0107 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.