qrcode-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@qrcode-mcp decode the damaged QR code in this photo"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Run it from source (pip install -e .) or from the published package
(pip install qrcode-mcp / uvx qrcode-mcp). Either way the client setup is
the same β see Usage in MCP clients.
Why this exists
Every QR decoder assumes a reasonably clean symbol. Real-world captures β a phone pointed at a glossy screen, a payment terminal under ceiling lights β come back with a diagonal glare band that erases a dozen modules. zxing, OpenCV and ZBar all return a checksum error. That is where this server starts working.
The demo pair is synthetic and contains no real device identifiers. Regenerate it with python assets/build_assets.py.
On the real glare-damaged sample this project was built from: grid fitting landed on Version 3 / pitch 2.948 px / 99.2% function-pattern agreement, format information resolved to EC-L / mask 6, and hint verification reached 93.6% module agreement with the reconstructed symbol.
Related MCP server: D-Knowledge Graph
Features
π Layered decoding | zxing-cpp β OpenCV β ZBar β preprocessing variants β automatic repair fallback. Multi-code images, corner points, confidence and payload parsing. |
π©Ί Damaged-code repair | Module-grid fitting, format-information decoding, multi-segment parsing, ReedβSolomon erasure / Chase correction, then module-by-module self-verification. |
π¨ Generation |
|
π§ Pluggable OCR | Windows built-in WinRT OCR, RapidOCR (offline ONNX) and Tesseract, with |
π Safe by default | URL opening requires explicit confirmation, blocks dangerous schemes and private hosts, remote image fetching disabled, output confined to one directory. |
π Three transports |
|
Quick start
From source (works today):
git clone https://github.com/xiaobinger/qrcode-mcp
cd qrcode-mcp
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e . # core dependencies
pip install -e '.[full]' # optional: OpenCV, ZBar, all OCR backends
qrmcp --versionFrom the published PyPI package:
pip install qrcode-mcp # or: pip install 'qrcode-mcp[full]'
uvx qrcode-mcp qrmcp --version # no install, on-demand
qrmcp --transport stdioExtra | What it adds |
(core) |
|
|
|
| Windows 10+ built-in OCR, |
|
|
|
|
| all OCR backends / everything above |
|
|
Usage in MCP clients
mcp.entry.json in this repository is a ready-to-paste stdio fragment. Drop it
into the mcpServers object of your client and restart it.
Client | Where to put the config | Notes |
WorkBuddy |
| Trust the new server once in the connector panel |
Claude Desktop |
| Fully restart the app |
Cursor |
| Project scope is per-repository |
VS Code / Copilot |
| Uses the |
Cline / Roo Code | Extension settings β MCP Servers | Paste the JSON body |
Cherry Studio / Continue | Settings β MCP / Tools β import JSON | Pick |
Any MCP client | stdio JSON below | Works with protocol |
From a local checkout β point command at the venv interpreter (or set
PYTHONPATH to src):
{
"mcpServers": {
"qrcode_mcp": {
"command": "python",
"args": ["-m", "qrmcp", "--transport", "stdio"],
"env": { "PYTHONIOENCODING": "utf-8", "PYTHONPATH": "C:/path/to/qrcode-mcp/src" }
}
}
}From an installed package β use the console script:
{
"mcpServers": {
"qrcode_mcp": {
"command": "qrmcp",
"args": ["--transport", "stdio"],
"env": { "PYTHONIOENCODING": "utf-8" }
}
}
}On-demand, no install (uv):
{
"mcpServers": {
"qrcode_mcp": {
"command": "uvx",
"args": ["--from", "qrcode-mcp", "qrmcp", "--transport", "stdio"]
}
}
}Shared / HTTP clients β start one server, point several clients at it:
qrmcp --transport http --port 8765 --token "$QRMCP_HTTP_TOKEN"{
"mcpServers": {
"qrcode_mcp": { "type": "http", "url": "http://127.0.0.1:8765/mcp" }
}
}Then talk to your client in natural language:
"Decode the QR code in this screenshot β if it fails, try repairing it." "Generate a QR for this URL and save it under out/." "Read all text in this image and give me the line boxes." "Parse that QR link first and ask me before opening it."
Tools
Tool | What it does |
| Layered decode across engines and preprocessing variants; multi-code, corner points, confidence, payload parsing; falls back to |
| Recover glare / blur / low-resolution symbols (QR versions 1β4); returns diagnostics, verification score and a rebuilt scannable PNG |
| Generate QR codes with EC / version / mask / scale / border / colors; PNG Β· SVG Β· ASCII Β· base64 |
| Locate symbols without decoding β bounding boxes for cropping before repair |
| Interpret URL / WiFi / vCard / phone / email / payment payloads, split query parameters, flag phishing-style patterns |
| Validate and optionally open a QR URL in the system browser |
| Full text, line / word boxes and confidence via the pluggable OCR backends |
| Batch scan a directory or file list, optionally combining QR + OCR |
| Version, protocol versions, registered tools, backend availability, active safety policy |
All image inputs accept a local path, file://, a data: URI, a bare base64
string, or an http(s) URL when explicitly enabled.
Damaged-code repair
flowchart LR
A[Damaged image] --> B[Grid fitting<br/>finder patterns + quad]
B --> C[Format info<br/>EC level + mask]
C --> D[Segment parsing<br/>byte / numeric / alnum]
D --> E[RS erasure<br/>+ Chase search]
E --> F[Rebuild QR<br/>module-by-module verify]
F --> G[Clean scannable PNG]
E -. soft reading .-> H[soft_decode<br/>character candidates]
H -. hint= .-> FWhen glare destroys more codewords than the EC budget can restore, the server
does not invent a result. It returns a soft_decode with per-character
candidates; pass your best guess as hint= to verify it and obtain a scannable
rebuild:
{
"name": "qr_repair",
"arguments": {
"image": "screenshot.png",
"hint": "https://example.com/qrmcp?sn=12345678901234567890&eC=99",
"save_clean": true
}
}Single-block QR versions 1β4 (21Γ21 β¦ 33Γ33). Larger or rotated / mirrored symbols are reported as unsupported or best-effort rather than guessed.
A verification agreement of β₯ 92% on reliable modules is required before a reconstruction is accepted as valid.
Long URLs are encoded as
byte + numeric + bytesegments:segnoalone would put them in one byte segment and overflow Version 3-L, so the verification path uses a small in-house multi-segment encoder.Windows OCR needs a language pack; WinRT
StorageFilepath APIs are avoided in favour of in-memory streams for Python 3.13 compatibility.
Transports
Transport | Command | Endpoint | Use case |
|
| β | MCP clients launching a subprocess; no port, logs to stderr only |
|
|
| Streamable HTTP, spec |
|
|
| Legacy clients on |
HTTP/SSE bind to 127.0.0.1 by default; set --token or QRMCP_HTTP_TOKEN
to require a bearer token. All three share one tool registry.
Protocol support
2025-06-18 Β· 2025-03-26 Β· 2024-11-05. The server echoes the client's
version when supported, otherwise falls back to the newest it implements.
Implements initialize, tools/list, tools/call, ping, batch requests and
graceful shutdown.
Safety by default
qr_opennever opens a URL withoutconfirm=true; without it, it only validates and returns the normalized URL plus risk flags.Blocks
file:,javascript:,data:, userinfo, non-standard schemes and hosts resolving to private / loopback addresses (SSRF protection).QRMCP_URL_ALLOWLISTrestricts allowed hosts (*.example.comsupported).Remote image fetching is off unless
QRMCP_ALLOW_REMOTE=1.Generated files stay inside
QRMCP_OUTPUT_DIR(default./out); absolute paths and..traversal are rejected.QRMCP_MAX_IMAGE_BYTES,QRMCP_MAX_IMAGE_PIXELSandQRMCP_DECODE_BUDGET_MSbound resource usage.
Variable | Purpose |
| Directory for generated images |
| Comma-separated allowed hosts for |
| Allow private / loopback hosts |
| Allow fetching images over |
| Bearer token for HTTP / SSE |
| Backend order, e.g. |
| Path to the Tesseract binary |
| Input size caps |
| Decode time budget |
| Logging verbosity |
Test status
Suite | Result | Run it |
End-to-end self-test | 38 / 38 passing |
|
Portable CI smoke | 16 checks passing |
|
Wheel build | 24 modules, |
|
The self-test covers all three protocol versions, batch requests, all nine
tools, the three transports end-to-end, token auth, SSE delivery, OCR backends
and the damaged-image repair path. CI runs on Linux + Windows across Python
3.10β3.13 with core dependencies only β see
.github/workflows/ci.yml.
Contributing
Issues and PRs are welcome β see CONTRIBUTING.md. The shortest useful contribution is a damaged QR sample that currently fails: include the image and the expected payload.
License
MIT Β© qrmcp contributors
Available Tools
9 toolsocr_imageA
Recognize text in an image with pluggable OCR backends. backend=auto tries Windows built-in OCR, then RapidOCR, then Tesseract. Returns full text, per-line boxes/confidence and word boxes when available.
Inputs: image (required), detail, backend, upscale, +2 more. Returns: object
qr_batchA
Scan many images in one call. Accepts an explicit list of sources or a directory plus glob pattern; optionally runs OCR on every image too. Returns per-file results and aggregate counts.
Inputs: repair, pattern, sources, directory, +4 more. Returns: object
qr_decodeA
Decode one or more QR/2D codes from an image. Tries zxing-cpp (multiple binarizers), OpenCV, ZBar and preprocessing variants; if all fail it automatically falls back to qr_repair for glare/blur/low-resolution damage. Returns text, symbology, EC level, corner points, confidence and a parsed payload with URL risk flags.
Inputs: image (required), repair, formats, budget_ms, +2 more. Returns: object
qr_detectA
Locate QR symbols in an image without decoding. Returns bounding boxes and corner points, useful for cropping before qr_repair. Deduplicates results across engines.
Inputs: image (required), max_variants. Returns: object
qr_generateB
Generate a QR code. Supports error-correction level, fixed version/mask, scale, quiet zone, colors and PNG/SVG/ASCII output. Optionally saves to the sandbox output directory.
Inputs: text (required), dark, mask, save, +8 more. Returns: object
qr_openA
Validate and optionally open a QR-code URL in the system browser. IMPORTANT: show the URL and its risk flags to the user before calling with confirm=true. Without confirm=true this tool only validates and reports; it never opens anything. Blocks file/javascript/data schemes, private/loopback hosts (SSRF) and hosts outside QRMCP_URL_ALLOWLIST.
Inputs: url, image, confirm, dry_run, +3 more. Returns: object
qr_parseA
Interpret a decoded QR payload. Detects URL/WiFi/vCard/phone/email/payment/text, splits URL query parameters, extracts embedded links and flags phishing-style risks.
Inputs: text (required). Returns: object
qr_repairA
Recover a damaged QR code (glare, blur, low resolution, partial occlusion). Fits the module grid from the finder patterns, decodes format information via BCH, then applies Reed-Solomon erasure/Chase correction. Returns the recovered text, a verification score and a rebuilt clean QR image. Supports QR versions 1-4; larger versions are reported as unsupported. hint= accepts a suspected full text to verify against the damaged modules.
Inputs: image (required), ec, hint, mask, +3 more. Returns: object
server_healthA
Report server version, supported MCP protocol versions, transports, registered tools, available OCR backends and the active safety configuration.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 9 tools
Most tools have clearly distinct roles: generate, decode, detect, parse, repair, batch scan, OCR, open URL, and health reporting. The only mild overlap is between qr_decode and qr_batch, since both decode images, but qr_batch is clearly framed as a multi-file/directory orchestration tool whereas qr_decode handles individual decode attempts with fallback repair.
All tool names use consistent snake_case and follow predictable prefix_action conventions. QR-related operations consistently use the qr_ prefix, while ocr_image and server_health are clearly named support tools.
Nine tools is well-scoped for a QR/OCR utility server. Each tool covers a distinct operation, and there are no redundant or filler tools.
The surface covers generation, decoding, detection, parsing, repair, batch processing, OCR, opening URLs, and health checks, which is strong lifecycle coverage for this domain. Minor gaps exist around higher-level payload creation helpers or batch generation, but normal workflows can be handled via qr_generate.
Maintenance
Related MCP Connectors
Remote MCP server for Scanduro QR codes, scan analytics and controlled code actions.
PDF tools + QR over MCP: merge, split, rotate, text, metadata, malicious-content scan.
Create and manage dynamic QR codes and read their scan analytics from Claude and other MCP clients.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- AlicenseBqualityDmaintenanceProduction-ready MCP server with 40+ tools β QR codes, PDFs, text processing, TTS, web scraping, image generation and more. Built for AI agents.2553 npmMIT
- FlicenseNot gradedqualityDmaintenanceA local-first, LLM-agnostic MCP server that lets you ask hard questions about your documents, media, and code, and get traceable answers entirely offline.-
- AlicenseAqualityBmaintenanceLocal MCP server for PDF and photo tasks: merge, split, rotate and number PDFs, convert images to PDF, and inspect or strip hidden photo metadata (EXIF/GPS). Runs entirely on your machine β no uploads, no accounts, no API keys.91MIT
- AlicenseNot gradedqualityCmaintenanceA remote MCP server exposing developer utility tools that compute QR codes, JSON diffs and formatting, base64/URL encoding, hashes, JWT decoding, cron explanations, timestamp conversions, placeholder images, flowcharts, HTML/React forms, color scales and regex matches with exact results. Results can be previewed, edited and exported in an interactive workbench where the host supports MCP Apps.MIT