Skip to main content
Glama

QR Code Generation MCP Server

A QR code generation MCP server implemented using FastMCP, supporting text-to-QR code conversion with base64 encoding output.

Features

  • Support for any text to QR code conversion (including Chinese characters)

  • Customizable colors and styles

  • Base64 encoding

  • Support for STDIO, HTTP, and SSE transport modes

Related MCP server: QR Code MCP Server

Installation

uv sync
# or
pip install qrcode Pillow mcp

Usage

0. Docker Usage

Build Image

docker build -t qrcode-mcp .

Run Container

# Default SSE mode
docker run -p 8008:8008 qrcode-mcp

# HTTP mode
docker run -p 8008:8008 -e TRANSPORT_MODE=http qrcode-mcp

# STDIO mode (for testing)
docker run -e TRANSPORT_MODE=stdio qrcode-mcp

# Custom host and port
docker run -p 9000:9000 -e TRANSPORT_MODE=http -e HOST=0.0.0.0 -e PORT=9000 qrcode-mcp

Environment Variables

  • TRANSPORT_MODE: Transport mode (sse, http, stdio), default: sse

  • HOST: Host address to bind, default: 0.0.0.0

  • PORT: Port to bind, default: 8008

Docker Compose

version: '3.8'
services:
  qrcode-mcp:
    build: .
    ports:
      - "8008:8008"
    environment:
      - TRANSPORT_MODE=sse
      - HOST=0.0.0.0
      - PORT=8008

1. MCP Server Mode

Start Server

# STDIO mode (for Claude Desktop)
python qrcode_mcp_server.py

# HTTP mode
python qrcode_mcp_server.py --http --host 127.0.0.1 --port 8008

# SSE mode (Server-Sent Events) Deprecated
python qrcode_mcp_server.py --sse --host 127.0.0.1 --port 8008

Configure Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

STDIO Mode (Local Use):

{
  "mcpServers": {
    "qrcode-mcp": {
      "command": "python",
      "args": ["/ABSOLUTE/PATH/TO/qrcode_mcp/qrcode_mcp_server.py"],
      "cwd": "/ABSOLUTE/PATH/TO/qrcode_mcp"
    }
  }
}

HTTP Mode (Network Deployment):

{
  "mcpServers": {
    "qrcode-mcp": {
      "transport": "http",
      "url": "http://127.0.0.1:8008/mcp/"
    }
  }
}

SSE Mode (Server-Sent Events):

{
  "mcpServers": {
    "qrcode-mcp": {
      "serverUrl": "http://127.0.0.1:8008/sse"
    }
  }
}

2. Direct Python API Usage

from qrcode_utils import text_to_qr_base64

# Basic usage
base64_result = text_to_qr_base64("Hello, World!")

# Custom styling
base64_result = text_to_qr_base64(
    "Custom QR Code",
    box_size=15,
    fill_color="darkblue",
    back_color="lightgray"
)

MCP Tools

generate_qr_code

Generate QR code and return base64 encoding.

Parameters:

  • text (required): Text content to convert

  • box_size (optional): Pixel size of each box, default 10

  • border (optional): Number of border boxes, default 4

  • fill_color (optional): Foreground color, default "black"

  • back_color (optional): Background color, default "white"

  • return_data_url (optional): Whether to return Data URL format, default false

Testing

python test_mcp_client.py

License

MIT License

Available Tools

1 tool
generate_qr_codeB

Generate QR code(生成二维码图片) from text and return as image with description.

Args:
    text: Text content to convert to QR code
    box_size: Size of each box in pixels (1-50)
    border: Number of boxes for border (0-20)
    fill_color: Foreground color
    back_color: Background color
ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
box_sizeNo
borderNo
fill_colorNoblack
back_colorNowhite

Output Schema

ParametersJSON Schema
NameRequiredDescription
dataYes
typeYes
_metaNo
mimeTypeYes
annotationsNo

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool returns an image with description, it doesn't cover important behavioral aspects like error conditions, performance characteristics, rate limits, or authentication requirements. The description is minimal and lacks behavioral context beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by organized parameter documentation. It's appropriately sized for a 5-parameter tool. The bilingual text (English/Chinese) adds slight redundancy but doesn't significantly impact conciseness. Every sentence serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's an output schema (though not provided in the context), the description doesn't need to explain return values. However, for a tool with 5 parameters and no annotations, the description should provide more behavioral context and usage guidance. The parameter documentation is good, but overall completeness is only adequate with clear gaps in behavioral transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides detailed parameter information in the 'Args' section, explaining each parameter's purpose and constraints (e.g., 'Size of each box in pixels (1-50)'). Since schema description coverage is 0%, this information is crucial and adds significant value beyond the bare schema. The only minor gap is that it doesn't explain parameter interactions or provide examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate QR code from text and return as image with description.' It specifies the verb (generate), resource (QR code), and output format (image with description). However, since there are no sibling tools, it doesn't need to differentiate from alternatives, so it can't achieve a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or typical use cases. It simply states what the tool does without context about when it's appropriate. With no sibling tools, this is less critical, but still a gap in usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool update
    • First observedgenerate_qr_code

TDQS

B3.2/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is singular and clearly defined as generating QR codes from text.

Naming Consistency5/5

The single tool name 'generate_qr_code' follows a clear verb_noun pattern. Since there is only one tool, consistency is inherently perfect with no deviations to assess.

Tool Count2/5

One tool is too few for a server with the broad name 'qrcode generator'. While it covers basic generation, typical QR code use cases might include features like reading/decoding QR codes, generating with logos, or batch processing, which are missing.

Completeness2/5

The tool surface is severely incomplete for a QR code generator domain. It only provides generation from text, lacking common operations like decoding QR codes, generating from URLs or other data types, or handling error correction levels, which are standard in such tools.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables generation of QR codes from text or URLs in multiple formats (DataURL, SVG, terminal display) with customizable options like error correction, colors, and size. Supports batch processing of multiple QR codes and integrates seamlessly with MCP-compatible clients.
    4
    4
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Converts URLs into scannable QR codes with customizable options like error correction levels and image sizes. Provides downloadable links for generated QR codes through a simple MCP tool interface.
    5
    4
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    An advanced MCP server for generating styled QR codes with logos, batch processing, and specialized formats like WiFi or vCards. It also provides tools to decode existing QR code images and analyze their quality or content.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/2niuhe/qrcode_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server