QR for Agent

io.github.benswel由 GitHub 帳號 benswel 發布v0.12.2更新於 Oct 27, 2026

Dynamic QR codes for AI agents — custom styling, scan tracking, webhooks

概覽

AI 產生的概覽

讓助理透過託管的 QR for Agent API 建立、美化、改指向並追蹤動態 QR 碼。

可以做什麼
  • 建立 11 種型式的 QR 碼(網址、vCard、WiFi、電子郵件、簡訊、電話、行程、文字、位置、社群、應用程式商店),並支援自訂樣式
  • 列出、檢視、更新與刪除 QR 碼,包括變更目標網址、UTM 參數與條件式轉址規則
  • 批次建立、更新、刪除 QR 碼,並可從 CSV 一次建立最多 500 個
  • 讀取掃描分析,含裝置、瀏覽器、作業系統、國家、城市與來源細分,並記錄或查詢轉換事件
  • 註冊、列出與刪除 Webhook,查看用量配額
  • 管理帳務與自訂網域,並註冊取得 API 金鑰
適用情境
適合讓助理為行銷活動、印刷品或活動產生 QR 碼,之後不必重印即可變更指向;也適合在對話中直接取得掃描與轉換數據。
執行需求
透過 npx(Node.js)以本機 stdio 程序執行。需在 API_KEY 環境變數提供 API 金鑰,可透過自助註冊取得;BASE_URL 為選用,可指向其他 API 位址。需要能連線至託管 API 的網路。
安裝前請注意
API 金鑰是敏感憑證,可存取該帳號下所有 QR 碼,請勿放入共用設定。相關工具可刪除 QR 碼及其分析資料(含批次刪除),也可變更轉址目標。帳務工具會開啟 Stripe 結帳與帳務入口,Pro 方案為付費訂閱。掃描與轉換資料(含 IP 與位置)由該服務儲存。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 QR for Agent,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

QR for Agent

[benswel/qr-for-agent-api MCP server]

QR-as-a-Service API built for AI agents. Create, update, and track dynamic QR codes programmatically via REST API or MCP (37 tools).

QR codes point to short URLs (/r/:shortId) that you can retarget at any time — the QR image never changes, but scanning it goes to the new destination. Multi-tenant by design, with full scan analytics.

Live API: api.qrforagent.com  |  Site: qrforagent.com  |  MCP: qr-for-agent

Features

  • Dynamic QR codes — change the destination URL without regenerating the image
  • 11 QR types — URL, vCard, WiFi, Email, SMS, Phone, Event, Text, Location, Social, App Store
  • Custom styling — dot shapes (square, rounded, dots, classy-rounded), corner styles, colors, gradients, logo embedding, frames with CTA text
  • SVG & PNG — vector and bitmap output
  • Enriched analytics — device type, browser, OS, country, city, referrer, scans-by-day
  • Real-time webhooks — HMAC-SHA256 signed payloads with delivery logging
  • UTM tracking — auto-append UTM parameters to redirect URLs
  • GTM support — intermediate page with Google Tag Manager snippets
  • Conditional redirects — route by device, OS, country, language, time range, or A/B split
  • Custom domains — Pro users brand short URLs with their own domain (qr.yourbrand.com/r/abc123)
  • Expiration & scheduling — auto-expire QR codes or schedule URL swaps
  • Conversion tracking — tracking pixel + API for post-scan events (purchases, signups) with ROI analytics
  • Frames & templates — decorative frames around QR codes (banner_top, banner_bottom, rounded) with CTA text
  • Bulk operations — create, update, or delete up to 50 QR codes per request, or up to 500 via CSV upload (Pro)
  • Multi-tenant — each API key sees only its own data
  • MCP server — qr-for-agent with 37 tools for Claude Desktop, Cursor, etc.
  • Plan-based quotas — Free (10 QR, 1K scans/month) and Pro ($19/month, unlimited)
  • Self-service registration — POST /api/register with email, no credit card
  • Stripe integration — checkout, billing portal, webhook-driven plan management
  • OpenAPI docs — Swagger UI at /documentation
  • AI-discoverable — /.well-known/ai-plugin.json and /.well-known/mcp.json
  • Open source — MIT license, self-hostable via Docker

Quick Start

bash
git clone https://github.com/benswel/qr-for-agent-api.gitcd qr-for-agent-apinpm installnpm run dev

On first startup, an API key is auto-generated and printed to the console.

bash
curl -X POST http://localhost:3100/api/qr \  -H "Content-Type: application/json" \  -H "X-API-Key: qr_YOUR_KEY_HERE" \  -d '{"target_url": "https://example.com", "label": "My first QR"}'

API Endpoints

QR Code Management (X-API-Key required)

MethodPathDescription
POST/api/qrCreate a QR code (11 types, custom styling)
GET/api/qrList all QR codes (paginated)
GET/api/qr/:shortIdGet QR code details
PATCH/api/qr/:shortIdUpdate target URL, label, UTM, GTM, redirect rules
DELETE/api/qr/:shortIdDelete QR code and its analytics
GET/api/qr/:shortId/imageDownload QR image (regenerated with stored style)
POST/api/qr/bulkCreate up to 50 QR codes (all-or-nothing)
PATCH/api/qr/bulkUpdate up to 50 QR codes (partial success)
DELETE/api/qr/bulkDelete up to 50 QR codes (partial success)
POST/api/qr/bulk/csvCreate up to 500 QR codes from CSV (Pro only)

Analytics (X-API-Key required)

MethodPathDescription
GET/api/analytics/:shortIdScan stats with device, browser, OS, country, city breakdowns + conversions

Conversions (X-API-Key required)

MethodPathDescription
POST/api/conversionsRecord a conversion event for a QR code you own
GET/api/conversions/:shortIdGet conversion stats (totals, by_event, by_day, recent)

Webhooks (X-API-Key required)

MethodPathDescription
POST/api/webhooksRegister webhook endpoint (returns HMAC secret)
GET/api/webhooksList all webhooks
DELETE/api/webhooks/:idDelete a webhook

Custom Domain (X-API-Key required, Pro only)

MethodPathDescription
GET/api/domainGet current custom domain and DNS status
PUT/api/domainSet custom domain
DELETE/api/domainRemove custom domain

Account (X-API-Key required)

MethodPathDescription
GET/api/usageCurrent usage and quota
POST/api/stripe/checkoutCreate Stripe Checkout session (upgrade to Pro)
POST/api/stripe/portalOpen Stripe billing portal

Public (no auth)

MethodPathDescription
POST/api/registerSelf-service API key registration (rate-limited)
GET/r/:shortIdRedirect to target URL (records scan)
GET/t/:shortIdConversion tracking pixel (returns 1×1 GIF)
GET/i/:shortIdServe QR image (cacheable)
GET/healthHealth check
GET/documentationSwagger UI
GET/.well-known/ai-plugin.jsonAI plugin manifest
GET/.well-known/mcp.jsonMCP discovery manifest

Admin (X-Admin-Secret header required)

MethodPathDescription
GET/api/admin/keysList all registered API keys
GET/api/admin/statsDashboard metrics

Authentication

All /api/* endpoints require an X-API-Key header.

  • Format: qr_ + 32-character random string
  • Auto-generated: on first startup if no keys exist
  • Multi-tenant: each key only sees its own QR codes
  • Create a key: npm run key:create "my-label"
  • List keys: npm run key:list

Public endpoints (/r/*, /i/*, /health, /documentation, /.well-known/*) don't require auth.

MCP Server

Published as qr-for-agent on npm. 37 tools for AI agents to manage QR codes natively.

bash
npx qr-for-agent

Claude Desktop / Cursor

Add to your MCP config (claude_desktop_config.json or .cursor/mcp.json):

json
{  "mcpServers": {    "qr-for-agent": {      "command": "npx",      "args": ["-y", "qr-for-agent"],      "env": {        "API_KEY": "your-api-key",        "BASE_URL": "https://api.qrforagent.com"      }    }  }}

Available Tools (37)

ToolDescription
create_qr_codeCreate a URL QR code with optional custom styling
get_qr_codeGet QR code details by short ID
update_qr_destinationChange where a QR code redirects
list_qr_codesList all QR codes with pagination
delete_qr_codeDelete a QR code and its analytics
get_qr_analyticsGet scan stats and breakdowns
bulk_create_qr_codesCreate up to 50 QR codes at once
bulk_update_qr_codesUpdate up to 50 QR codes at once
bulk_delete_qr_codesDelete up to 50 QR codes at once
create_vcard_qrCreate a vCard contact QR code
create_wifi_qrCreate a WiFi credentials QR code
create_email_qrCreate an email (mailto:) QR code
create_sms_qrCreate an SMS QR code
create_phone_qrCreate a phone call QR code
create_event_qrCreate a calendar event QR code
create_text_qrCreate a plain text QR code
create_location_qrCreate a geo-location QR code
create_social_qrCreate a social media links QR code
create_app_store_qrCreate a smart app store redirect QR code
update_vcard_qrUpdate a vCard QR code
update_wifi_qrUpdate a WiFi QR code
update_social_qrUpdate a social media QR code
update_app_store_qrUpdate an app store QR code
create_webhookRegister a webhook endpoint
list_webhooksList all registered webhooks
delete_webhookDelete a webhook
registerRegister for an API key
get_usageGet current usage and quota
upgrade_to_proCreate a Stripe Checkout session
manage_billingOpen Stripe billing portal
set_utm_paramsSet UTM tracking parameters on a QR code
set_redirect_rulesSet conditional redirect rules on a QR code
set_custom_domainSet or remove custom domain (Pro)
get_custom_domainGet current custom domain and DNS status
bulk_create_from_csvCreate up to 500 QR codes from CSV data (Pro)
record_conversionRecord a post-scan conversion event
get_conversionsGet conversion stats for a QR code

Configuration

Copy .env.example to .env and edit:

VariableDefaultDescription
PORT3100HTTP port
HOST0.0.0.0Bind address
BASE_URLhttp://localhost:3100Public URL (used in short URLs)
DATABASE_URL./data/qr-agent.dbSQLite file path
SHORT_ID_LENGTH8Length of generated short IDs
ADMIN_SECRET(none)Secret for admin endpoints (X-Admin-Secret header)
STRIPE_SECRET_KEY(none)Stripe API secret key
STRIPE_WEBHOOK_SECRET(none)Stripe webhook signing secret
STRIPE_PRICE_ID(none)Stripe Price ID for Pro plan

Database

SQLite with Drizzle ORM. Six tables:

  • api_keys — key storage with label, email, plan (free/pro), Stripe IDs, custom domain
  • qr_codes — QR metadata, target URLs, type/type_data, style options, UTM, GTM, redirect rules, expiration/scheduling
  • scan_events — scan tracking: timestamp, user-agent, referer, IP, device, browser, OS, country, city
  • webhooks — webhook endpoints per API key, HMAC secret, subscribed events
  • webhook_deliveries — delivery log: status, response code, error messages
  • conversion_events — conversion tracking: event name, value, metadata, referer, IP, timestamp
bash
npm run db:generate   # Generate migration from schema changesnpm run db:migrate    # Apply pending migrationsnpm run db:studio     # Open Drizzle Studio (web UI)

Migrations run automatically on server startup.

Deployment

Docker

bash
docker compose up -d

The database is persisted in a Docker volume.

Railway

The project includes railway.toml and a multi-stage Dockerfile. Connect your GitHub repo to Railway — it builds and deploys automatically with health checks on /health.

Tests

195 integration tests covering all endpoints, auth, multi-tenant isolation, QR types, webhooks, bulk operations, custom domains, frames, conversions, CSV upload, and analytics.

bash
npm test           # Run all testsnpm run test:watch # Watch mode

Scripts

ScriptDescription
npm run devStart dev server with auto-reload
npm run buildCompile TypeScript
npm startRun production server
npm testRun test suite
npm run test:watchTests in watch mode
npm run key:createCreate API key
npm run key:listList API keys
npm run db:generateGenerate migration
npm run db:migrateRun migrations
npm run db:studioOpen Drizzle Studio

License

MIT

來源:README.md,提交 1ab7277

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.12.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分