MCP (Model Context Protocol) is an open protocol enabling AI assistants to call local or remote tools. QR Code Scanner MCP Server ships as QR Code AI’s MIT-licensed npm package @qrcode-ai-com/qrcode-barcode-scanner-mcp. Your MCP host (such as Cursor, OpenClaw, Goose or Continue) launches it locally and communicates over stdio (standard input and output). It registers scan_image for image bytes plus an optional scan_file tool, disabled by default, for reading local files by path. Your assistant gets direct decoder output rather than guessing visually.
Register the server in your MCP host
Place this snippet inside your host’s MCP config file. npx fetches the npm package on the first launch and caches it locally afterwards. Requires Node.js 22.19+ on the 22 branch, or Node.js 24+.
12345678
{
"mcpServers": {
"qrscan": {
"command": "npx",
"args": ["--yes", "--ignore-scripts", "@qrcode-ai-com/qrcode-barcode-scanner-mcp"]
}
}
}
Most desktop and IDE hosts adopt the mcpServers JSON schema. Put this block into your client’s active config path and confirm scan_image appears in its tool list. Cursor and similar clients accept it as shown; on Windows, certain hosts require invoking npx via cmd.
Refer to the MCP architecture overview to see how host, client and server roles fit together.
Check the QR Code Scanner Integrations directory for step-by-step setups covering Cursor, OpenClaw, Goose, Continue, GitHub Copilot, Junie and Factory Droid.
The same MCP server decodes barcodes as well: see the Barcode Scanner MCP Server guide.
Keep a pinned local install
If you want an audited local copy that never reaches out to npm at startup, install the package inside a project folder and configure absolute paths in your host.
1
npm install --prefix ./.qrscan-mcp --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp
{
"mcpServers": {
"qrscan": {
"command": "/absolute/path/to/node",
"args": ["/absolute/path/to/.qrscan-mcp/node_modules/@qrcode-ai-com/qrcode-barcode-scanner-mcp/src/cli.mjs"]
}
}
}
Do not move the install directory afterwards, because your host points directly to its absolute path.
Enable file-path scanning (optional)
Out of the box, the server accepts image bytes only and rejects file paths or URLs. To let it read local images by path, opt into the second tool, scan_file, by setting the QRSCAN_MCP_ALLOWED_DIRECTORIES environment variable to the specific directories it may access.
123456789
{
"mcpServers": {
"qrscan": {
"command": "/absolute/path/to/node",
"args": ["/absolute/path/to/.qrscan-mcp/node_modules/@qrcode-ai-com/qrcode-barcode-scanner-mcp/src/cli.mjs"],
"env": { "QRSCAN_MCP_ALLOWED_DIRECTORIES": "/absolute/path/to/images" }
}
}
}
This builds on “Keep a pinned local install” by adding an env block. Separate multiple folders just like PATH: colons on macOS and Linux, semicolons on Windows.
scan_file expects the absolute path to one image inside an allowed folder and outputs the identical report format as scan_image, accepting the same optional profile and budgetMs fields explained below.
Prompt your assistant to decode an image
Your assistant constructs the scan_image call automatically, so you do not need to write JSON manually. For instance, ask: “Decode the QR code in qr-reference.png and give me the exact URL.” Assistants that pass file paths instead of image bytes need scan_file enabled as shown above.
The tool accepts imageBase64 (canonical base64 of the image bytes without whitespace or a data-URL prefix), an optional profile (fast by default, or frame / full) and an optional budgetMs time budget in milliseconds (0 removes the time limit).
1
{ "imageBase64": "<canonical base64 image>", "profile": "full", "budgetMs": 0 }
Consult the MCP reference for the complete tool schema, input caps and error codes.
Expected output
The snippet above targets your own file. As a concrete baseline, here is the first detection returned for the public clean QR sample image:
123456789101112
{
"symbology": "qr_code",
"content": {
"text": "https://qrc-ai.com/76xMa",
"raw": "aHR0cHM6Ly9xcmMtYWkuY29tLzc2eE1h",
"charset": "utf8"
},
"payload": {
"kind": "url",
"url": "https://qrc-ai.com/76xMa"
}
}
The complete JSON report is delivered inside structuredContent on the MCP tool response.
This sample matches the scanner’s published sample report.