Barcode Scanner MCP Server

Let your AI assistant decode barcode images on your local machine. It calls a local scanner tool and returns the exact identifier alongside its format.

Barcode Scanner MCP Server at a glance

  • Open-source licence

    MIT

  • Tool your assistant calls

    scan_image

  • Local transport over standard input and output

    stdio

  • Runtime

    Node.js 22.19+ or 24+

Add the server and scan your first barcode image

MCP (Model Context Protocol) lets an AI assistant call external tools. The Barcode Scanner MCP Server is QR Code AI’s MIT-licensed npm package @qrcode-ai-com/qrcode-barcode-scanner-mcp. Your assistant app (the MCP host, such as Cursor, OpenClaw, Goose or Continue) launches it as a local process on your machine and communicates over standard input and output (stdio). By default it exposes a single tool, scan_image; a second tool, scan_file, is optional and disabled by default. Your assistant receives a real decoder result rather than relying on its own visual guess.

Add the server to your MCP host

Add this entry to your host’s MCP configuration. On first launch, npx fetches the published server package and reuses that cached copy afterwards. Requires Node.js 22.19 or later on the 22 release line, or Node.js 24 or later.

JSON
{
  "mcpServers": {
    "qrscan": {
      "command": "npx",
      "args": ["--yes", "--ignore-scripts", "@qrcode-ai-com/qrcode-barcode-scanner-mcp"]
    }
  }
}

The mcpServers structure is a widely used client convention. Place this entry in your host’s configuration file, then verify that scan_image appears in its tool list. Cursor and other hosts that read an mcpServers JSON file accept this entry as shown. On Windows, some hosts need to launch npx via cmd. Browse the Barcode Scanner Integrations directory for client-specific setups.

The MCP architecture overview explains the host, client and server roles.

The same local MCP server also decodes QR codes: see the QR Code Scanner MCP Server guide.

Install a local copy

If you prefer a pinned, audited copy that never queries npm at start-up, install the server in your project and point your host to its absolute paths.

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

Leave the installation folder where it is, as the host stores its absolute path.

Allow the server to read files by path

By default, the server accepts raw image bytes only: no file path and no URL. A second optional tool, scan_file, reads a single image file from its absolute path. It stays disabled by default and only becomes available when the person configuring the server sets the QRSCAN_MCP_ALLOWED_DIRECTORIES environment variable to the permitted folders.

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 the “Install a local copy” entry with one extra env line. Separate multiple folders in the same way as PATH: a colon on macOS and Linux, or a semicolon on Windows.

scan_file accepts the absolute path of one image inside an allowed folder and returns the same structured report as scan_image, with the same two optional arguments, profile and budgetMs, covered below.

Ask your assistant to read a barcode

You do not invoke the tool yourself: your assistant handles the call. For example, ask: “Read the barcode in inventory-label.png and give me its exact value and format.” An assistant that works from file paths rather than raw image bytes requires the optional scan_file tool shown above.

The assistant then invokes scan_image with imageBase64 (canonical base64 of the image bytes, with no whitespace or data-URL prefix), an optional profile (fast by default, or frame or full) and an optional budgetMs time limit in milliseconds where 0 removes the cap.

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

For inventory-label.png, a Code 128 label, the report returns STOCK-4827 along with its format. Your assistant receives this in structuredContent, the machine-readable part of the tool response.

If the image also contains a QR code, the report lists the QR code first: check the format of each detection.

To prepare the sample image, create a test barcode with Barcode Generator using Code 128 and STOCK-4827. Save the PNG as inventory-label.png, then let your host pass its image bytes to the tool.

The MCP server reference documents both tools, the input limits and the error codes.

What you get

The prompt above decodes your own label. For a reproducible reference, 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": []
  }
}

symbology is the detected format, content.text holds the digits exactly as encoded, and payload provides their parsed GS1 reading: Application Identifier 01 ("ai": "01") carrying the same number as a 14-digit GTIN, leading zero included.

The scanner’s published example report shows the same detection.

MCP hosts and distribution options for Barcode Scanner

The snippets above show the generic setup. Below are the supported MCP clients and published registries that distribute the same local stdio server.

Cursor and editor agents

Connect the MCP server to Cursor, GitHub Copilot, JetBrains Junie or Continue using each editor’s MCP settings and local tool permissions.

OpenClaw, Goose and Factory Droid

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

Official MCP Registry

Inspect the Official MCP Registry listing io.github.qrcode-ai-com/qrcode-barcode-scanner for machine-readable server metadata pointing to the npm package.

Glama MCP directory

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

npm package and GitHub archive

Install @qrcode-ai-com/qrcode-barcode-scanner-mcp from npm, or download the matching GitHub release archive when your environment pins local copies.

Desktop bundle (.mcpb)

Download the .mcpb desktop extension archive attached to GitHub Releases for desktop MCP hosts that install extension bundles directly.

How to connect the Barcode Scanner MCP server

Register the local stdio server in your MCP host, pass a label image to scan_image and inspect the returned identifier.

  1. Step 1

    Connect the server

    Add the npx mcpServers entry and verify that your host lists scan_image, optional scan_file (when enabled) and the read-only schema and limits resources.

  2. Step 2

    Supply image data and scan options

    Pass base64 image bytes to scan_image with no network calls. Profile defaults to fast, with full for deepest scoring and frame for decoding only.

  3. Step 3

    Review the result before acting

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

What a decoded barcode gives you: Code 128 and EAN-13 examples

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

Diagram of a Code 128 barcode image passing through the MCP server workflow to produce the decoded value STOCK-4827.

Read STOCK-4827 from inventory-label.png

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

Runtime, limits, barcode formats and result fields

Runtime and limits. Requires Node.js 22.19+ (or 24+) on macOS, Linux and Windows x64 over stdio. Images cap at 8 MiB, 4,096 px per side and 16 MP; an empty detections list is valid while isError flags tool failures. Scanning makes zero network calls.

Supported barcodes. Reads 16 barcode symbologies (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec and MaxiCode; GS1-128 → code128, ITF-14 → itf, ISBN → ean13) plus QR codes. Check trace.budget_exhausted and set budgetMs: 0 for unbounded scans.

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

CLI, Docker, MCP server, skill or SDK: which barcode scanner tool do you need?

The MCP server is built for AI assistants that call tools. For another workflow, pick the matching guide below.

Barcode Scanner

Read a barcode directly in your browser, with nothing to install and no account needed.

Open the barcode reader

Barcode Scanner CLI

Decode images in a terminal script or CI pipeline with a single command.

Explore Barcode Scanner CLI

Barcode Scanner Docker

Run the same containerised scanner environment across every machine and CI runner.

Explore Barcode Scanner Docker

Barcode Scanner Skills

Give an AI agent a repeatable procedure for reading barcode images.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local barcode scanning directly into your own application, in your language.

Explore the scanner SDK

Barcode Scanner MCP Server questions

Hosts, tool input, empty results, installation and licensing.

A barcode scanner MCP server is a local program that gives an AI assistant a dedicated barcode-reading tool through the Model Context Protocol (MCP). The assistant sends image bytes to the scan_image tool and receives the decoded value alongside its format, for example Code 128 and STOCK-4827. That value comes from a real decoder rather than the assistant’s visual guess. QR Code AI’s open-source server is published on npm as @qrcode-ai-com/qrcode-barcode-scanner-mcp.

Any AI assistant or code editor that can launch a local MCP server over stdio, including Cursor, OpenClaw, Goose, Continue, GitHub Copilot, JetBrains Junie and Factory Droid. Hosts that read an mcpServers JSON file accept the entry shown under “Add the server to your MCP host”. Browse the Barcode Scanner Integrations directory for client-specific setups, then verify that your host lists scan_image.

You can never pass an image URL, and you can pass a local file path only through the optional scan_file tool. By default, scan_image takes imageBase64, the canonical base64 of the image bytes without a data-URL prefix: your host reads the chosen image within its own permissions and forwards the bytes. The optional scan_file tool stays disabled by default and reads a single image file by its absolute path once the person configuring the server lists permitted folders in QRSCAN_MCP_ALLOWED_DIRECTORIES. It returns the same report as scan_image.

No. An empty detections list is a valid completed result when no supported code is detected, and it differs from a tool error flagged with isError: true. If the report indicates that its time budget was exhausted, treat an empty result as incomplete evidence rather than proof that no code exists in the image.

No. The MCP server returns decoded content strictly as data and never follows a destination. Keep any returned URL or instruction-like text separate from the assistant’s own instructions. Any decision to open a link or invoke another tool remains under your host workflow’s control.

Both are shown in the setup section above. To launch the server with npx from your host’s MCP configuration, set the command to npx with the arguments --yes --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp. To pin a local copy instead, run npm install --prefix ./.qrscan-mcp --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp and point your mcpServers entry to the absolute paths. Because it runs as a local stdio server rather than a hosted HTTP endpoint, there is no remote server URL; the Official MCP Registry lists it under io.github.qrcode-ai-com/qrcode-barcode-scanner.

scan_image returns the scanner report in structuredContent, listing each detection with its decoded value as text and its symbology. A Code 128 inventory label carrying STOCK-4827 returns STOCK-4827 with the format Code 128; the public EAN-13 sample returns 9506000134352 and, as a parsed GS1 payload, the 14-digit GTIN 09506000134352. The value is an identifier rather than a product record: preserve every character, including leading zeros, and look it up in the system that assigned it.

No. A retail number or internal reference is only a lookup key for another system. Reading it does not confirm an assigned GS1 identifier, retrieve a product name or current price from a catalogue, verify authenticity or certify label print quality. The report returns the decoded value, its format and any parsed payload such as a 14-digit GTIN; it does not tell you who the number was assigned to or whether a printed label meets print-quality standards.

No. Decoding an existing image locally uses no generation credits and does not start a free trial: it is completely separate from the QR Code AI creation service and its generation API. That creation service has free creation limits and a seven-day Premium trial triggered by creating the first dynamic QR code or Smart Link; Premium is required for continued use of affected features. Reading a barcode never alters what is encoded in it. Both the MCP server and the scanner engine are open source under the MIT licence.