Connecting via MCP (Claude, Cursor, and other agents)

Configure an MCP client to call generate_qr directly — copy-paste config for both the npx stdio bridge and native remote-HTTP connections.

Agents that support the Model Context Protocol can call generate_qr directly as a tool, instead of writing REST integration code first. The server is remote — hosted at https://developers.sgpaynowqr.com/api/mcp — so which config you use depends on whether your client speaks MCP over remote HTTP natively.

1. Get an API key

Create one from the dashboard (free tier: 50 requests/month). It’s the same key you’d use for the REST API or SDK — MCP calls count against the same monthly quota.

2. Configure your client

Most MCP clients (Cursor, Claude Desktop, Windsurf) only support launching a local process over stdio. Use @alexhalfborg/sgpaynowqr-mcp, a small npx-run wrapper that bridges stdio to the remote server:

{
  "mcpServers": {
    "sgpaynowqr": {
      "command": "npx",
      "args": ["-y", "@alexhalfborg/sgpaynowqr-mcp"],
      "env": { "SGPAYNOWQR_API_KEY": "sgpn_your_api_key_here" }
    }
  }
}

If your client supports remote MCP servers natively over Streamable HTTP (for example Claude Desktop or claude.ai custom connectors), you can skip the wrapper and point it at the endpoint directly — exact field names vary by client, so check its docs if this doesn’t match:

{
  "mcpServers": {
    "sgpaynowqr": {
      "type": "http",
      "url": "https://developers.sgpaynowqr.com/api/mcp",
      "headers": { "X-API-Key": "sgpn_your_api_key_here" }
    }
  }
}

3. Call the tool

generate_qr takes the same parameters as POST /generate (snake_case, see API docs) and returns the QR payload as text, plus a base64 PNG image block when include_image is true (the default).

Next steps

Not sure which payment type to use? Read Choosing a Payment Type. Writing code directly against the API instead? See TypeScript SDK Quickstart.