Barcode Scanner MCP Server

Give your AI assistant deterministic barcode reading via a local MCP tool that returns each exact value and symbology.

Barcode Scanner MCP Server at a glance

  • Open-source licence

    MIT

  • Tool your assistant calls

    scan_image

  • Local transport over stdio

    stdio

  • Runtime

    Node.js 22.19+ or 24+

Add the server and decode your first barcode image

MCP (Model Context Protocol) lets an AI assistant call external tools reliably. Barcode Scanner MCP Server is QR Code AI’s MIT-licensed npm package @qrcode-ai-com/qrcode-barcode-scanner-mcp. Your assistant host (such as Cursor, OpenClaw, Goose or Continue) spawns it locally over standard input and output (stdio). By default it exposes scan_image for base64 bytes, with an optional scan_file tool for local paths, delivering exact decoder output rather than visual guesswork.

Register the server in your MCP host

Add this block to your host’s MCP settings. npx fetches the published package on first launch and reuses it afterwards. Requires Node.js 22.19+ on the 22 release line, or Node.js 24+.

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

Most desktop and editor hosts accept the mcpServers JSON shape. Place it in your host’s config file and confirm scan_image appears. On Windows, some hosts need to launch npx via cmd. Check the Barcode Scanner Integrations directory for client-specific configs.

See the MCP architecture documentation for how host, client and server roles fit together.

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

Install a pinned local copy

To run an audited local copy that never touches npm at startup, install the package inside your workspace and point your host config at its absolute paths.

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

Leave the install folder in place because your host config references its absolute path.

Allow reading local files by path

By default the server accepts raw image bytes only, never file paths or URLs. A second optional tool, scan_file, decodes one image by absolute path. It stays disabled until the operator configures QRSCAN_MCP_ALLOWED_DIRECTORIES with the exact directories permitted for reading.

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 extends the “Install a pinned local copy” entry with an env block. Separate multiple folders just like PATH: colons on macOS and Linux, semicolons on Windows.

scan_file takes the absolute path to one image inside an allowed folder and outputs the identical report format as scan_image, with the same optional profile and budgetMs arguments.

Prompt your assistant to decode a barcode

Your assistant calls scan_image on your behalf rather than asking you to type JSON. For instance, ask: “Read the barcode in inventory-label.png and give me its exact value and format.” Assistants passing file paths instead of image bytes require scan_file enabled above.

The assistant invokes scan_image with imageBase64 (canonical base64 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 alongside its symbology inside structuredContent on the tool response.

If an image also includes a QR code, the report places QR codes ahead of barcodes, so inspect every detection’s symbology.

Need a test label? Create a test barcode with Barcode Generator using Code 128 and STOCK-4827, save it as inventory-label.png and pass its bytes through your host.

Read the MCP integration reference for both tools, file limits and error codes.

Expected output

To compare against your own label, here is the first detection returned for the public EAN-13 sample label:

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

symbology names the detected format, content.text preserves the digits exactly as encoded and payload gives their GS1 interpretation: Application Identifier 01 ("ai": "01") formatted as a 14-digit GTIN with its leading zero intact.

This excerpt matches the scanner’s published EAN-13 example report.

MCP hosts and distribution channels for Barcode Scanner

The snippets above show generic config. Below are supported MCP hosts and published registries indexing the exact same local stdio server.

Cursor and editor agents

Wire the MCP server into Cursor, GitHub Copilot, JetBrains Junie or Continue using each IDE’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 hosts via the shared plugin repo or the mcpServers block above.

Official MCP Registry

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

Glama MCP directory

View the published Glama listing for tool metadata, MIT licence info and quick reference links to the local stdio server.

npm package and GitHub archive

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

Desktop bundle (.mcpb)

Download the .mcpb desktop bundle from GitHub Releases for desktop MCP hosts that support direct extension archive installs.

How to connect the Barcode Scanner MCP server

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

  1. Step 1

    Register the server

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

  2. Step 2

    Send image bytes and pick a profile

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

  3. Step 3

    Verify output before acting

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

What a decoded barcode returns: 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) with no product lookup.

A saved Code 128 barcode label passes through an MCP server workflow and outputs the decoded value STOCK-4827.

Decode STOCK-4827 from inventory-label.png

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

Runtime, limits, barcode formats and report 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; empty detections are valid while isError signals tool failures. Decoding makes zero network requests.

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

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

CLI, Docker, MCP server, skill or SDK: which barcode scanner fits?

The MCP server suits AI assistants that invoke tools directly. For another workflow, pick the matching guide below.

Barcode Scanner

Decode a single barcode right away in your browser with nothing to install.

Open barcode reader

Barcode Scanner CLI

Decode label images inside a shell script or CI pipeline with a single command.

Explore Barcode Scanner CLI

Barcode Scanner Docker

Run an identical containerised scanner environment across workstations and CI runners.

Explore Barcode Scanner Docker

Barcode Scanner Skills

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

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local barcode decoding directly inside your own application.

Explore scanner SDK

Barcode Scanner MCP Server questions

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

A barcode scanner MCP server is a local process giving an AI assistant a callable barcode-decoding tool over Model Context Protocol (MCP). Your assistant sends image bytes to scan_image and gets back the exact decoded identifier and format, such as Code 128 and STOCK-4827, directly from a real decoder rather than visual guesswork. QR Code AI’s open-source server ships as @qrcode-ai-com/qrcode-barcode-scanner-mcp on npm.

Any MCP host able to run a local stdio server, including Cursor, OpenClaw, Goose, Continue, GitHub Copilot, JetBrains Junie and Factory Droid. Hosts reading an mcpServers JSON file accept the snippet under “Register the server in your MCP host”. Check the Barcode Scanner Integrations directory for client-specific setups, then confirm scan_image is listed.

An image URL is never accepted; a local file path works only with the optional scan_file tool. scan_image expects imageBase64 (canonical base64 bytes with no data-URL prefix), so your host reads the file under its own permissions and sends the bytes. scan_file stays disabled until the operator lists permitted folders in QRSCAN_MCP_ALLOWED_DIRECTORIES, and returns the same report as scan_image.

No. A completed scan returning an empty detections list is a valid outcome, separate from a tool failure marked isError: true. If trace.budget_exhausted is true, treat an empty scan as incomplete rather than proof that no barcode exists.

No. The server outputs decoded content strictly as data and never follows URLs or triggers follow-up commands. Keep returned strings separate from assistant instructions; any choice to visit a link or query another tool belongs to your host workflow.

Start it via npx in your host’s MCP config using command npx and args --yes --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp, or install locally with npm install --prefix ./.qrscan-mcp --ignore-scripts @qrcode-ai-com/qrcode-barcode-scanner-mcp. Because it is a local stdio server rather than a hosted HTTP service, there is no remote URL. Its Official MCP Registry ID is io.github.qrcode-ai-com/qrcode-barcode-scanner.

scan_image returns the full report in structuredContent listing each detection’s text string and symbology. A Code 128 label storing STOCK-4827 returns STOCK-4827 as Code 128; the public EAN-13 sample returns 9506000134352 together with a parsed GS1 payload carrying the 14-digit GTIN 09506000134352. Keep every character including leading zeros and query the system that issued the code.

No. A retail number or internal SKU is purely a lookup key for another database. Decoding it does not confirm an assigned GS1 identifier, retrieve a product title or price, verify authenticity or certify printed-label quality. The report returns only the string, symbology and parsed payload such as a 14-digit GTIN.

No. Local MCP decoding uses zero generation credits and starts no trial: it is separate from QR Code AI’s creation platform and generation API. That service has free creation limits, a seven-day Premium trial triggered by the first dynamic QR code or Smart Link, and Premium requirements for continued use of affected features. Reading a barcode never alters what is encoded, and both the MCP server and engine are open source under the MIT licence.