BagsBags Docs
Guides

Agents & MCP

Connect AI agents to Bags via MCP, WebMCP, and machine-readable discovery endpoints.

Bags is built for agent-native commerce. Agents can discover payment capabilities, preview checkout links, and compute tax quotes without a merchant API key.


MCP server

Bags runs a Model Context Protocol server at:

POST https://www.getbags.app/api/mcp/mcp

Transport: Streamable HTTP (MCP 2025-03-26). Stateless — no session Redis required.

Tools

ToolDescription
bags-preview-payment-linkFetch public metadata for a payment link UUID (name, amount, networks, merchant info)
bags-tax-quoteCompute tax estimate for a payment link + customer address; returns signed quoteToken

Both tools are read-only / anonymous and rate-limited per client IP. They mirror the browser WebMCP tools registered on the marketing layout.

Example (conceptual)

Connect your MCP client to https://www.getbags.app/api/mcp/mcp, then invoke:

{
  "tool": "bags-preview-payment-link",
  "arguments": { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
}

Discovery endpoints

Agents and clients can discover Bags capabilities without scraping HTML:

ResourceURL
MCP server card/.well-known/mcp/server-card.json
Agent skills index/.well-known/agent-skills/index.json
API catalog (RFC 9727)/.well-known/api-catalog
OAuth protected resource/.well-known/oauth-protected-resource
OpenAPI/openapi.yaml

Production: https://www.getbags.app/.well-known/...


WebMCP (browser)

On the marketing site, Bags registers WebMCP tools via navigator.modelContext — the same tool surface as the remote MCP server. Useful for in-browser agents and automation.


x402 pay-per-use

For monetizing your own API endpoints (not just previewing Bags checkouts), use x402 Agentic Payments. Clients receive HTTP 402 with payment instructions until USDC payment succeeds.


Merchant API vs agent tools

CapabilityAuthUse case
MCP preview / tax quoteNone (rate-limited)Agents researching or quoting before checkout
POST /api/v1/checkoutsAPI keyCreating real checkout sessions server-side
Payment Links APIAPI keyManaging products and links

Never embed live API keys in agent prompts or MCP configs exposed to end users.


What's next

On this page