qr-code-mcp

QR Code MCP Server

License MCP

A Model Context Protocol (MCP) server that lets you generate, decorate, and decode QR codes directly from any MCP client (Claude Desktop, Cursor, VS Code via Continue.dev, etc.).


Features

Tool Description
generate_qr Generate a QR code PNG from text or a URL
generate_qr_with_logo Generate a QR code with a centred logo image
decode_qr Decode a QR code from a base64-encoded PNG

Quick Start

Prerequisites

Installation

# Clone or create the project directory
mkdir qr-code-mcp && cd qr-code-mcp

# Install dependencies
pip install -r requirements.txt

# (Optional) Install pyzbar for QR decoding
pip install pyzbar

Note for Windows users: pyzbar requires the ZBar library. Download the Windows build and ensure zbar.dll is on your PATH, or use the Windows PyPI wheel.

Run the server

python server.py

The server starts in stdio mode, ready to be connected by any MCP client.


MCP Client Configuration

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "qr-code-mcp": {
      "command": "python",
      "args": ["/absolute/path/to/qr-code-mcp/server.py"]
    }
  }
}

VS Code (Continue.dev)

Add to your ~/.continue/config.json:

{
  "experimental": {
    "mcpServers": [
      {
        "name": "qr-code-mcp",
        "transport": "stdio",
        "command": "python",
        "args": ["/absolute/path/to/qr-code-mcp/server.py"]
      }
    ]
  }
}

Usage Examples

1. Generate a QR code

# Input
data = "https://example.com"
size = 400

# Returns:
# {
#   "format": "png",
#   "base64": "iVBORw0KGgo...",
#   "mime_type": "image/png"
# }
# Input
data = "https://example.com"
logo_url = "https://example.com/logo.png"
size = 400

# Returns the same format as generate_qr with the logo centred
# on the QR code. If the logo download fails, the QR code is
# returned without the logo and an error note is provided.

3. Decode a QR code

# Input
image_base64 = "iVBORw0KGgo..."

# Returns:
# {
#   "data": "https://example.com"
# }

Requires pyzbar. If not installed, a helpful error message with install instructions is returned instead.


API Reference

generate_qr(data, size?, format?)

Parameter Type Default Description
data string Text or URL to encode (required)
size integer 400 Width/height of the output PNG
format string "png" Output format (currently only "png")

generate_qr_with_logo(data, logo_url?, size?)

Parameter Type Default Description
data string Text or URL to encode (required)
logo_url string "" URL of the logo image to centre on the QR
size integer 400 Width/height of the output PNG

decode_qr(image_base64)

Parameter Type Default Description
image_base64 string Base64-encoded PNG data (required)

Smithery Deployment

This server is ready to deploy on Smithery.ai. The smithery.yaml configuration is included in this repository.


Pricing

$19/month — includes:

Subscribe now


License

MIT