home / mcp / qr code generation mcp server

QR Code Generation MCP Server

mcp tool to generate qrcode

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "2niuhe-qrcode_mcp": {
      "url": "http://127.0.0.1:8008/mcp/",
      "headers": {
        "HOST": "0.0.0.0",
        "PORT": "8008",
        "TRANSPORT_MODE": "http"
      }
    }
  }
}

This QR Code Generation MCP Server lets you convert any text into a QR code and return it as a base64-encoded image. It supports a variety of transport modes (STDIO, HTTP, SSE) and offers customizable styling so you can tailor QR output to your needs.

How to use

Choose how you want to access the MCP server and then perform a text-to-QR code conversion. You can run the server locally in STDIO mode for desktop workflows, or expose it over HTTP for network usage. The server returns a base64-encoded QR image and supports Chinese characters and color customization.

How to install

Prerequisites: you need Python installed on your system. You may also use a package manager to install dependencies.

Install dependencies with one of these options:

uv sync
```

or

```
pip install qrcode Pillow mcp

Additional setup and usage notes

Run modes and example commands are shown below. You can run the server in STDIO mode for local use, or in HTTP mode to expose the API over a network.

# STDIO mode: local use
python qrcode_mcp_server.py

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

# SSE mode: deprecated but shown for reference
python qrcode_mcp_server.py --sse --host 127.0.0.1 --port 8008

Configuration and deployment options

You can also run via Docker with environment variables to choose transport mode and port. The default transport is SSE, but you can switch to HTTP or STDIO as needed.

docker build -t qrcode-mcp .

# 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

Server connection methods

You can connect to the MCP server using either the STDIO interface or the HTTP interface. The HTTP URL path for MCP is the base URL followed by /mcp/. When using STDIO, run the server directly and communicate over standard input/output.

# STDIO example (local):
python qrcode_mcp_server.py

# HTTP example (network):
http://127.0.0.1:8008/mcp/

Available tools

generate_qr_code

Generate QR code from text and return a base64-encoded string. Supports optional styling such as box size and colors.