@sylphx/image-reader-mcp 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -16
- package/bin/image-reader-mcp +48 -0
- package/bin/native/image-reader-mcp-server +0 -0
- package/dist/doctor-cli.js +6705 -0
- package/package.json +22 -10
- package/src/doctor-cli.ts +18 -0
- package/src/doctor.ts +216 -0
- package/src/engine/rust-decode.ts +145 -0
- package/src/handlers/readImage.ts +255 -0
- package/src/mcp.ts +302 -0
- package/src/schemas/readImage.ts +170 -0
- package/src/sdk.ts +27 -0
- package/src/utils/agentMap.ts +93 -0
- package/src/utils/applyImageIntelligence.ts +68 -0
- package/src/utils/errors.ts +18 -0
- package/src/utils/layout.ts +114 -0
- package/src/utils/metadata.ts +108 -0
- package/src/utils/ocr.ts +279 -0
- package/src/utils/optionalLlm.ts +67 -0
- package/src/utils/palette.ts +36 -0
- package/src/utils/pathUtils.ts +40 -0
- package/src/utils/safety.ts +29 -0
- package/dist/index.js +0 -624
package/README.md
CHANGED
|
@@ -1,34 +1,247 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Iris
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Image evidence for agents
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Iris** (transitional package `@sylphx/image-reader-mcp`) — local-first image facts, not default VLM guesses.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="https://mark.sylphx.com/api/v1/banner?type=holo&theme=tokyonight&text=image+reader+mcp&desc=Evidence-first+image+reading+for+AI+agents+%E2%80%94+metadata%2C+OCR+text%2C+regions%2C+and+ci&height=200&animation=rise&credit=0" alt="image-reader-mcp — Sylphx Mark banner" width="100%" />
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
### Your agent looked at the image. **Did it see the truth?**
|
|
14
|
+
|
|
15
|
+
Evidence-first image reading for AI agents. One call turns any local image into an
|
|
16
|
+
**Agent Media Twin** — dimensions, metadata, optional OCR with bounding boxes, and
|
|
17
|
+
trust warnings you can cite without asking a vision LLM to guess.
|
|
18
|
+
|
|
19
|
+
[](https://www.npmjs.com/package/@sylphx/image-reader-mcp)
|
|
20
|
+
[](https://opensource.org/licenses/MIT)
|
|
21
|
+
[](https://github.com/SylphxAI/image-reader-mcp/actions/workflows/ci.yml)
|
|
22
|
+
[](https://www.typescriptlang.org/)
|
|
23
|
+
|
|
24
|
+
**Local-first** · **One smart `read_image` call** · **Evidence with bbox + provenance** · **23 tests**
|
|
25
|
+
|
|
26
|
+
SOTA family roadmap: [docs/roadmap/sota-family-roadmap.md](docs/roadmap/sota-family-roadmap.md).
|
|
27
|
+
|
|
28
|
+
[⭐ Star this repo](https://github.com/SylphxAI/image-reader-mcp) if agents should read images with facts, not vision-model guesses.
|
|
29
|
+
· [Quick start](#quick-start) · [See it work](#see-it-work) · [Why not vision LLM guess?](#why-not-vision-llm-guess)
|
|
30
|
+
|
|
31
|
+
This repository is product SSOT. Sibling agent tools live in separate repos.
|
|
32
|
+
Each instrument is an independent repository (marketplace + stars).
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Read images (not vague vision)
|
|
41
|
+
|
|
42
|
+
Iris is **local-first**: geometry + OCR + **layout blocks** + **agent_map** so a text-only agent can understand picture architecture without a vision model.
|
|
43
|
+
|
|
44
|
+
Spec: [docs/specs/agent-image-read-contract.md](docs/specs/agent-image-read-contract.md)
|
|
45
|
+
|
|
46
|
+
## Product docs
|
|
47
|
+
|
|
48
|
+
| Doc | Purpose |
|
|
10
49
|
| --- | --- |
|
|
11
|
-
| [
|
|
12
|
-
|
|
|
13
|
-
| [
|
|
14
|
-
| [
|
|
50
|
+
| [docs/POSITIONING.md](docs/POSITIONING.md) | Strategic positioning |
|
|
51
|
+
| [docs/COMPETITIVE.md](docs/COMPETITIVE.md) | Peer anchors and wedge |
|
|
52
|
+
| [docs/EVIDENCE_CONTRACT.md](docs/EVIDENCE_CONTRACT.md) | Evidence = result contract |
|
|
53
|
+
| [docs/TOOL_SURFACE.md](docs/TOOL_SURFACE.md) | Few clear tools policy |
|
|
54
|
+
| [docs/PRODUCT_INDEPENDENCE.md](docs/PRODUCT_INDEPENDENCE.md) | This repo is SSOT |
|
|
55
|
+
| [docs/IPPB.md](docs/IPPB.md) | Independent public product bar |
|
|
56
|
+
| [docs/PUBLISH.md](docs/PUBLISH.md) | npm/git publish status |
|
|
57
|
+
|
|
58
|
+
## The problem
|
|
15
59
|
|
|
16
|
-
|
|
60
|
+
Images are not filenames. They are pixels, EXIF, orientation, embedded GPS,
|
|
61
|
+
hidden metadata, and text that only exists if you OCR it with geometry.
|
|
17
62
|
|
|
18
|
-
|
|
63
|
+
Most agent stacks route images through a **vision LLM** and get a plausible
|
|
64
|
+
description. Dimensions get rounded. OCR text gets paraphrased. Metadata
|
|
65
|
+
disappears. Citations become "the model said so." Then the agent hallucinates —
|
|
66
|
+
confidently.
|
|
19
67
|
|
|
20
|
-
**
|
|
68
|
+
**Image Reader MCP is built for the moment your agent needs measurable facts about
|
|
69
|
+
an image, not a creative caption.**
|
|
21
70
|
|
|
22
|
-
##
|
|
71
|
+
## Why not vision LLM guess?
|
|
72
|
+
|
|
73
|
+
| Typical vision path | Image Reader MCP |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| "Describe this image" | Return filename, mime, dimensions, and structured metadata |
|
|
76
|
+
| Paraphrased OCR | Optional Tesseract lines with bounding boxes and confidence |
|
|
77
|
+
| GPS and EXIF leak into context | GPS redacted; trust warnings for suspicious metadata |
|
|
78
|
+
| No provenance | Agent Media Twin JSON with measurable, citeable fields |
|
|
79
|
+
| Cloud API by default | **Local-first** — sharp + exifr on your machine |
|
|
80
|
+
| Ship and pray | **23** unit tests on schema, metadata, OCR hooks, safety limits, doctor, and release gate |
|
|
23
81
|
|
|
24
|
-
|
|
82
|
+
## See it work
|
|
25
83
|
|
|
26
|
-
|
|
84
|
+
### Install (30 seconds)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install -g @sylphx/image-reader-mcp
|
|
88
|
+
iris doctor
|
|
89
|
+
claude mcp add iris -- npx @sylphx/image-reader-mcp
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Install once. Call once.**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
claude mcp add image-reader -- npx @sylphx/image-reader-mcp
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"path": "/absolute/path/to/photo.jpg",
|
|
101
|
+
"include_metadata": true,
|
|
102
|
+
"include_ocr": true
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`read_image` inspects the file locally and returns an Agent Media Twin — no
|
|
107
|
+
generative LLM required:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"filename": "photo.jpg",
|
|
112
|
+
"mime": "image/jpeg",
|
|
113
|
+
"dimensions": { "width": 4032, "height": 3024 },
|
|
114
|
+
"orientation": 1,
|
|
115
|
+
"metadata": {
|
|
116
|
+
"Make": "ExampleCamera",
|
|
117
|
+
"Model": "Pro X",
|
|
118
|
+
"DateTimeOriginal": "2026-03-15T14:22:10"
|
|
119
|
+
},
|
|
120
|
+
"ocr": {
|
|
121
|
+
"available": true,
|
|
122
|
+
"lines": [
|
|
123
|
+
{
|
|
124
|
+
"text": "INVOICE #1042",
|
|
125
|
+
"bbox": { "x": 120, "y": 48, "width": 310, "height": 36 },
|
|
126
|
+
"confidence": 92
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"trust_warnings": []
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Abbreviated shape — optional OCR skips gracefully when Tesseract is not installed.
|
|
135
|
+
|
|
136
|
+
## MCP Tool Surface
|
|
137
|
+
|
|
138
|
+
| Tool | Use it when the agent needs to... |
|
|
139
|
+
| --- | --- |
|
|
140
|
+
| `read_image` | Read a local image and return dimensions, mime, metadata, optional OCR, and trust warnings. |
|
|
141
|
+
|
|
142
|
+
Supported formats: PNG, JPEG, GIF, WebP, TIFF, and other formats sharp can decode.
|
|
143
|
+
|
|
144
|
+
## Quick Start
|
|
145
|
+
|
|
146
|
+
### Claude Code
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
claude mcp add image-reader -- npx @sylphx/image-reader-mcp
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Claude Desktop
|
|
153
|
+
|
|
154
|
+
Add this to `claude_desktop_config.json`:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"mcpServers": {
|
|
159
|
+
"image-reader": {
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["@sylphx/image-reader-mcp"]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Any MCP Client
|
|
27
168
|
|
|
28
169
|
```bash
|
|
29
170
|
npx @sylphx/image-reader-mcp
|
|
30
171
|
```
|
|
31
172
|
|
|
173
|
+
Node.js `>=22.13` is required. Optional OCR uses a local Tesseract adapter when
|
|
174
|
+
installed — no cloud credentials required by default.
|
|
175
|
+
|
|
176
|
+
## Security model
|
|
177
|
+
|
|
178
|
+
- **Local-first** — `read_image` resolves paths on the local machine; no cloud vision API by default.
|
|
179
|
+
- **GPS redaction** — location metadata is stripped from agent-facing output unless explicitly opted in.
|
|
180
|
+
- **Size and format limits** — oversized or unsupported inputs return structured errors, not partial guesses.
|
|
181
|
+
- **Optional OCR** — Tesseract runs locally when installed; missing OCR is reported as `available: false`, not silent failure.
|
|
182
|
+
- **Trust warnings** — suspicious EXIF, orientation, or metadata anomalies surface in `trust_warnings` for agent verification.
|
|
183
|
+
|
|
184
|
+
## Release proof
|
|
185
|
+
|
|
186
|
+
Claims are backed by CI `benchmark:release-gate` and the shipped-path matrix (Rust-default route, no legacy Node engine on primary tools).
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
bun run benchmark:release-gate
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Artifact: `benchmark-artifacts/image_reader_release_gate.json` — must report `status: passed` before release.
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
git clone https://github.com/SylphxAI/image-reader-mcp.git
|
|
198
|
+
cd image-reader-mcp
|
|
199
|
+
bun install
|
|
200
|
+
bun run build
|
|
201
|
+
bun test
|
|
202
|
+
bun run doctor
|
|
203
|
+
bun run benchmark:release-gate
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Useful checks:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
bun run check
|
|
210
|
+
bun run typecheck
|
|
211
|
+
bun run validate
|
|
212
|
+
bun run benchmark:release-gate
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Example `read_image` requests live in [`examples/`](examples/).
|
|
216
|
+
|
|
217
|
+
## Support
|
|
218
|
+
|
|
219
|
+
- [Issues](https://github.com/SylphxAI/image-reader-mcp/issues)
|
|
220
|
+
- [npm package](https://www.npmjs.com/package/@sylphx/image-reader-mcp)
|
|
221
|
+
- Portfolio orchestration: [smart-reader-mcp](https://github.com/SylphxAI/smart-reader-mcp)
|
|
222
|
+
|
|
223
|
+
## Help this reach more builders
|
|
224
|
+
|
|
225
|
+
If vision-model guesses have wasted your context, your citations, or your trust
|
|
226
|
+
in agent output, you are exactly who this project is for.
|
|
227
|
+
|
|
228
|
+
**[⭐ Star the repo](https://github.com/SylphxAI/image-reader-mcp)** — it is the
|
|
229
|
+
fastest way to help more agent builders find evidence-first image reading. Share
|
|
230
|
+
it in your MCP client setup, team wiki, or agent stack README.
|
|
231
|
+
|
|
232
|
+
### Discovery (in progress)
|
|
233
|
+
|
|
234
|
+
| Channel | Status |
|
|
235
|
+
| --- | --- |
|
|
236
|
+
| [Glama MCP directory](https://glama.ai/mcp/servers/SylphxAI/image-reader-mcp) | Listed — [claim server](https://glama.ai/mcp/servers/SylphxAI/image-reader-mcp/admin) for full discoverability |
|
|
237
|
+
| [Official MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.SylphxAI/image-reader-mcp) | Listed — `io.github.SylphxAI/image-reader-mcp` @ v0.1.0 |
|
|
238
|
+
| [TensorBlock MCP Index PR #1113](https://github.com/TensorBlock/awesome-mcp-servers/pull/1113) | Open — multimedia/document processing listing |
|
|
239
|
+
| [MCP servers community issue #4500](https://github.com/modelcontextprotocol/servers/issues/4500) | Open — community server highlight |
|
|
240
|
+
| [mcp.so listing issue #3068](https://github.com/chatmcp/mcpso/issues/3068) | Open — directory submission request |
|
|
241
|
+
| [mcpservers.org submit](https://mcpservers.org/submit) | Not listed yet — free web-form submission |
|
|
242
|
+
|
|
243
|
+
Know another MCP directory? [Open an issue](https://github.com/SylphxAI/image-reader-mcp/issues/new) with the link.
|
|
244
|
+
|
|
32
245
|
## License
|
|
33
246
|
|
|
34
|
-
MIT © [SylphxAI](https://github.com/SylphxAI)
|
|
247
|
+
MIT © [SylphxAI](https://github.com/SylphxAI)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Image Reader MCP launcher — Rust rmcp only (fail-closed, no TS stdio fallback).
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
|
|
7
|
+
resolve_rust_bin() {
|
|
8
|
+
if [[ -n "${IMAGE_READER_MCP_RUST_BIN:-}" && -x "${IMAGE_READER_MCP_RUST_BIN}" ]]; then
|
|
9
|
+
printf '%s\n' "${IMAGE_READER_MCP_RUST_BIN}"
|
|
10
|
+
return 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
for candidate in \
|
|
14
|
+
"$ROOT/bin/native/image-reader-mcp-server" \
|
|
15
|
+
"$ROOT/target/release/image-reader-mcp-server" \
|
|
16
|
+
"$ROOT/target/debug/image-reader-mcp-server"; do
|
|
17
|
+
if [[ -x "$candidate" ]]; then
|
|
18
|
+
printf '%s\n' "$candidate"
|
|
19
|
+
return 0
|
|
20
|
+
fi
|
|
21
|
+
done
|
|
22
|
+
|
|
23
|
+
return 1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
resolve_transport() {
|
|
27
|
+
if [[ -n "${IMAGE_READER_MCP_TRANSPORT:-}" ]]; then
|
|
28
|
+
printf '%s\n' "${IMAGE_READER_MCP_TRANSPORT}"
|
|
29
|
+
return 0
|
|
30
|
+
fi
|
|
31
|
+
if [[ -n "${MCP_TRANSPORT:-}" ]]; then
|
|
32
|
+
printf '%s\n' "${MCP_TRANSPORT}"
|
|
33
|
+
return 0
|
|
34
|
+
fi
|
|
35
|
+
printf '%s\n' "stdio"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if bin="$(resolve_rust_bin)"; then
|
|
39
|
+
transport="$(resolve_transport)"
|
|
40
|
+
if [[ "$transport" == "http" ]]; then
|
|
41
|
+
export MCP_TRANSPORT=http
|
|
42
|
+
export IMAGE_READER_MCP_TRANSPORT=http
|
|
43
|
+
fi
|
|
44
|
+
exec "$bin" "$@"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
echo "[image-reader-mcp] Rust MCP server (rmcp) is not built. Run: bun run build:rust" >&2
|
|
48
|
+
exit 1
|
|
Binary file
|