local-vision-mcp: Instructions file for Claude Code

CLAUDE.md

local-vision-mcp CLAUDE.md is an instructions file for Claude Code from tmchao7/local-vision-mcp. It costs 2,137 tokens per session, scanned A, original, MIT.

Project instructions for a local MCP server that gives text-only coding agents image understanding through a locally installed Ollama vision model. Images stay on the local machine and are analyzed through one tool.

In plain words
What is it for?
Use it when working on this local vision server: running tests, checking Ollama and its model, performing an end-to-end smoke test, or generating trusted MCP configuration.
Why use it?
It lets an agent inspect images without sending the image data to a text-model API. The instructions also explain the project’s commands, architecture, supported Node version, and privacy constraint.

Instructions file for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions Codex.

This is tmchao7/local-vision-mcp's own configuration. It tells Claude Code how to work on local-vision-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything local-vision-mcp configures →

Runs only inside a plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else, and the catalogue could not identify which plugin ships it.

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/tmchao7/local-vision-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/tmchao7/local-vision-mcp

Made for: Claude Code.

Wrote 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.

agentmods badge for local-vision-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/tmchao7/local-vision-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/tmchao7/local-vision-mcp/claude-md)
Your own site
<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.

agentmods 80×15 button for local-vision-mcp CLAUDE.md

Your own site · 80×15
<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>
Per session 2,137 This file is loaded in full into every session.
When invoked 2,137 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 9d ago against content hash 9ae957546fbb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

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.

CLAUDE.md · 52 lines

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 in src/.
  • src/config.mjs — all config from env (VISION_* vars, falls back to OLLAMA_HOST). Builds the path allowlist: CLAUDE_PROJECT_DIR + user Pictures/Desktop/Downloads + VISION_ALLOWED_PATHS (delimiter-split).
  • src/server.mjscreateVisionServer({ config, client, fetchImpl, log }). Registers the single vision_analyze tool with a zod schema (path + optional secondary_path for image comparison); the handler is single-exit through resultFor, downscales oversized PNGs via loadImage, 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.mjsVisionInputError with codes (INVALID_PATH, FILE_NOT_FOUND, PATH_NOT_ALLOWED, UNSUPPORTED_TYPE, NOT_A_FILE, FILE_TOO_LARGE). Allowlist check uses realpath on both the candidate and the allowed roots to defeat symlink escapes. PNG/JPEG/WebP only, 20 MB cap.
  • src/ollama-client.mjsOllamaClient with fetchImpl injected (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_ctx 16384, num_predict 4096 standard / 2048 fast) and listModels (GET /api/tags). Returns { content, truncated } (truncated = Ollama done_reason: "length"); falls back to message.thinking (tags stripped) when content is missing — qwen3-vl thinking variants can put the answer there (ollama #12831). timeoutMs is 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. OllamaError codes: MODEL_NOT_FOUND (message appends the ollama pull hint), OLLAMA_HTTP_ERROR, OLLAMA_UNAVAILABLE, TIMEOUT, INVALID_RESPONSE.
  • src/prompt.mjsbuildVisionPrompt({ question, mode, detail, imageCount }); mode guidance for ui/ocr/general, detail line for fast/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). For imageCount > 1 it prepends [img] markers (one per image, mapped to the Ollama images array 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 a truncated flag from context. When JSON.parse fails 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 --smoke run). Other unparseable output (mid-string truncation, arrays, fenced-with-prose) falls back to raw text as answer. createVisionError turns any thrown error into a structured report with error_code.
  • src/log.mjscreateLogger + isDebugEnabled (--debug flag or LOG_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:zlib deflate + 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 / decodePng return null for unsupported input so callers pass the original through; resizePng(buffer, maxEdge) returns null when already small enough. Screenshots over VISION_MAX_EDGE are downscaled locally in the server handler.
  • src/smoke.mjsrunSmoke, the real end-to-end check behind --smoke: builds a 96×96 orange-square PNG, calls analyzeImage directly (bypasses the path allowlist), flags empty model output as EMPTY_REPORT, always cleans up its tmp dir.
  • src/mcp-config.mjsconfigEnv (7 resolved VISION_* values, deliberately omits VISION_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 (generic normalizes to json, unknown → error).
  • skills/vision/SKILL.md — Claude Code skill describing when/how to invoke the tool; keep in sync with the tool's behavior.

Read the full file on GitHub · 52 lines

Changes

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.

  1. 9d ago First seen · 52 lines · 2,137 tokens per session scan A 9ae957546fbb

Subscribe to this mod's changes

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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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).

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens

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.

deepseek-ai/deepseek-harness · 3,735 tokens