Barcode Scanner MCP Server

Give your AI assistant dedicated barcode image decoding. It invokes a local scanner tool and retrieves each exact identifier and symbology.

Barcode Scanner MCP Server: quick summary

  • Open-source licence

    MIT

  • Tool exposed to your assistant

    scan_image

  • Local stdio transport over standard input and output

    stdio

  • Runtime

    Node.js 22.19+ or 24+

Register the server and decode your first barcode image

MCP (Model Context Protocol) enables AI assistants to call structured external tools. Barcode 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) spawns it locally and communicates over stdio (standard input and output). By default it exposes scan_image for image bytes, with scan_file available as an opt-in tool. 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+.

JSON
{
  "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. Check the Barcode Scanner Integrations directory for client-specific setups.

Refer to the MCP architecture overview to see how host, client and server roles fit together.

The same MCP server decodes QR codes as well: see the QR Code 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.

npm install --prefix ./.qrscan-mcp --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp

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.

JSON
{
  "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 a barcode

You do not invoke the tool manually: your assistant handles the call. For example, ask: “Decode the barcode in inventory-label.png and return its exact value and format.” Assistants that pass file paths instead of image bytes need scan_file enabled as shown above.

The assistant sends 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 limit).

JSON
{ "imageBase64": "<canonical base64 image>", "profile": "full", "budgetMs": 0 }

On inventory-label.png (a Code 128 label), the report contains STOCK-4827 along with its symbology inside structuredContent on the MCP tool response.

When an image also holds a QR code, QR entries appear first in the detections array, so inspect the symbology of each item.

To generate a test file yourself, create a test barcode with Barcode Generator using Code 128 and STOCK-4827, save the PNG as inventory-label.png and let your host pass its bytes to the tool.

Consult the MCP reference for both tools, size caps and error codes.

Expected output

The example above targets your own label. As a verifiable baseline, here is the first detection returned for the public EAN-13 sample image:

JSON
{
  "symbology": "ean13",
  "content": {
    "text": "9506000134352",
    "raw": "OTUwNjAwMDEzNDM1Mg==",
    "charset": "utf8"
  },
  "payload": {
    "kind": "gs1",
    "elements": [
      {
        "ai": "01",
        "value": "09506000134352"
      }
    ],
    "gtin": "09506000134352",
    "conformant": true,
    "issues": []
  }
}

Here symbology names the detected barcode format, content.text holds the exact encoded digits and payload gives the parsed GS1 reading: Application Identifier 01 ("ai": "01") with the same code expressed as a 14-digit GTIN including its leading zero.

The scanner’s published sample report shows the exact same detection structure.

Supported MCP hosts and package channels for Barcode Scanner

The config blocks above cover generic setups. Below are compatible MCP hosts and public registries distributing the same local stdio server.

Cursor and editor agents

Hook the MCP server into Cursor, GitHub Copilot, JetBrains Junie or Continue through each editor’s MCP settings and local tool permissions.

OpenClaw, Goose and Factory Droid

Bring local barcode decoding to OpenClaw, Goose, Factory Droid, Pi agent and other stdio MCP agents via the shared plugin repo or the mcpServers config above.

Official MCP Registry

Review the Official MCP Registry record io.github.qrcode-ai-com/qrcode-barcode-scanner for machine-readable metadata linking to the npm package.

Glama MCP directory

Check the published Glama listing for tool definitions, MIT licence details and reference links to the local stdio server.

npm package and GitHub archive

Fetch @qrcode-ai-com/qrcode-barcode-scanner-mcp from npm or grab the matching GitHub release archive when your team pins local dependencies.

Desktop bundle (.mcpb)

Download the .mcpb desktop bundle from GitHub Releases for desktop MCP apps that support direct extension bundle installation.

Step-by-step setup for Barcode Scanner MCP Server

Add the stdio server to your MCP host, send a label image to scan_image and inspect the returned identifier.

  1. Step 1

    Register the server

    Insert the npx mcpServers block and verify your host lists scan_image, optional scan_file (when enabled) and the schema/limits resources.

  2. Step 2

    Send image bytes and scan options

    Pass base64 image data to scan_image with zero network calls. Profile defaults to fast, with full for full-depth scoring and frame for decode only.

  3. Step 3

    Verify output before acting

    Inspect detections and isError separately. An empty array means no barcode was present rather than a tool failure; keep external lookups separate.

Decoded barcode output: Code 128 and EAN-13 examples

structuredContent supplies each detection’s content.text and symbology (for example STOCK-4827 as Code 128 or 9506000134352 as EAN-13) without running a product lookup.

A saved Code 128 barcode image passes through the MCP server workflow to return the decoded value STOCK-4827.

Extract STOCK-4827 from inventory-label.png

On inventory-label.png, scan_image returns STOCK-4827 (Code 128). Preserve every character and leading zero for your inventory database.

Runtime requirements, input limits, symbologies and report fields

Runtime and caps. Runs over stdio on Node.js 22.19+ (or 24+) across macOS, Linux and Windows x64. Inputs cap at 8 MiB, 4,096 px per side and 16 MP; empty detections are valid whereas isError indicates tool errors. Decoding makes zero network requests.

Supported barcode symbologies. Decodes 16 barcode formats (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec, MaxiCode and more; GS1-128 maps to code128, ITF-14 to itf and ISBN to ean13) plus QR codes. Check trace.budget_exhausted and use budgetMs: 0 for unbounded runs.

Host setups and open-source licence. Browse agent integration guides for Cursor, OpenClaw, Goose, Continue, GitHub Copilot, Junie and Factory Droid, alongside the MCP reference and MIT scanner repository.

CLI, Docker, MCP server, skill or SDK: choosing the right barcode scanner

Use the MCP server when an AI assistant needs direct tool calls. For other workflows, pick the right guide below.

Barcode Scanner

Scan a single code immediately in your browser with zero installation.

Open the barcode reader

Barcode Scanner CLI

Decode images inside a terminal script or CI job using one binary.

Explore Barcode Scanner CLI

Barcode Scanner Docker

Keep an identical scanner environment across developer laptops and CI runners.

Explore Barcode Scanner Docker

Barcode Scanner Skills

Supply an AI agent with a consistent step-by-step image scanning workflow.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local scanning directly inside your app in your chosen language.

Explore the scanner SDK

Barcode Scanner MCP Server: common questions

Compatible hosts, image inputs, empty scans, setup and licensing.

A barcode scanner MCP server is a local utility that gives an AI assistant a structured barcode decoding tool over Model Context Protocol (MCP). Your assistant sends image bytes to scan_image and receives the exact identifier and symbology, such as Code 128 and STOCK-4827, straight from the decoder instead of a visual guess. QR Code AI publishes this open-source server as @qrcode-ai-com/qrcode-barcode-scanner-mcp on npm.

Any MCP client capable of running a local stdio server works, including Cursor, OpenClaw, Goose, Continue, GitHub Copilot, JetBrains Junie and Factory Droid. Clients supporting mcpServers JSON can paste the block under “Register the server in your MCP host”. Check the Barcode Scanner Integrations directory for client-specific steps, then verify scan_image appears.

Remote URLs are never supported, and local file paths work only if you opt into scan_file. By default, scan_image expects imageBase64 (canonical base64 of the file bytes without any data-URL prefix), so your host reads the file under its own permissions and sends the bytes. To enable scan_file for absolute paths, list permitted folders in QRSCAN_MCP_ALLOWED_DIRECTORIES. It returns the exact same report schema as scan_image.

No. Returning an empty detections array is a valid completed scan and is distinct from a tool error signalled by isError: true. If trace.budget_exhausted is true, treat an empty list as an incomplete scan rather than proof that no barcode exists.

No. The MCP server only returns decoded strings as structured data and never visits destination URLs. Keep decoded links or prompt-like strings separate from system instructions, and leave opening links or invoking further tools entirely to your host workflow.

Launch it via npx inside your host’s MCP configuration using command npx and arguments --yes --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp. For a pinned local install instead, run npm install --prefix ./.qrscan-mcp --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp. Because it communicates locally over stdio, there is no remote URL. Its Official MCP Registry ID is io.github.qrcode-ai-com/qrcode-barcode-scanner.

scan_image returns the full JSON report in structuredContent, listing every detection with its text value and symbology. A Code 128 inventory label holding STOCK-4827 yields STOCK-4827 as Code 128, while the public EAN-13 sample yields 9506000134352 together with a parsed GS1 payload holding the 14-digit GTIN 09506000134352. Treat the value as an identifier rather than a product record: preserve every character including leading zeros, and query the system that issued it.

No. A retail barcode number or internal stock reference is merely a lookup key for another database. Decoding it does not prove an assigned GS1 identifier, retrieve a product title or current price, verify authenticity or certify printed-label quality. The report supplies the decoded value, its symbology and any parsed payload like a 14-digit GTIN; it never tells you who registered the number or what item it identifies.

No. Decoding an existing barcode image consumes zero generation credits and starts no trial: it is completely independent of the QR Code AI creation service and its generation API. The creation service has free creation limits, a seven-day Premium trial triggered when you create your first dynamic QR code or Smart Link, and Premium requirements for ongoing use of affected features. Reading a code never modifies its encoded data, and both the MCP server and scanner engine are open source under the MIT licence.