@payzu/mcp-pix 0.0.0-stage → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +180 -2
  2. package/assets/brand-bg-dark.jpg +0 -0
  3. package/assets/brand-bg.jpg +0 -0
  4. package/assets/brand-logo-dark.png +0 -0
  5. package/assets/brand-logo.png +0 -0
  6. package/assets/connect.html +201 -0
  7. package/assets/icon.png +0 -0
  8. package/dist/client.d.ts +14 -0
  9. package/dist/client.js +63 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/env.d.ts +4 -0
  12. package/dist/env.js +11 -0
  13. package/dist/env.js.map +1 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +19 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/oauth.d.ts +9 -0
  18. package/dist/oauth.js +554 -0
  19. package/dist/oauth.js.map +1 -0
  20. package/dist/remote.d.ts +2 -0
  21. package/dist/remote.js +131 -0
  22. package/dist/remote.js.map +1 -0
  23. package/dist/schemas.d.ts +41 -0
  24. package/dist/schemas.js +33 -0
  25. package/dist/schemas.js.map +1 -0
  26. package/dist/server.d.ts +6 -0
  27. package/dist/server.js +29 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/tools/account.d.ts +3 -0
  30. package/dist/tools/account.js +33 -0
  31. package/dist/tools/account.js.map +1 -0
  32. package/dist/tools/callbacks.d.ts +3 -0
  33. package/dist/tools/callbacks.js +150 -0
  34. package/dist/tools/callbacks.js.map +1 -0
  35. package/dist/tools/infractions.d.ts +3 -0
  36. package/dist/tools/infractions.js +135 -0
  37. package/dist/tools/infractions.js.map +1 -0
  38. package/dist/tools/internal_transfer.d.ts +3 -0
  39. package/dist/tools/internal_transfer.js +60 -0
  40. package/dist/tools/internal_transfer.js.map +1 -0
  41. package/dist/tools/pix.d.ts +3 -0
  42. package/dist/tools/pix.js +90 -0
  43. package/dist/tools/pix.js.map +1 -0
  44. package/dist/tools/refund.d.ts +3 -0
  45. package/dist/tools/refund.js +37 -0
  46. package/dist/tools/refund.js.map +1 -0
  47. package/dist/tools/reports.d.ts +3 -0
  48. package/dist/tools/reports.js +230 -0
  49. package/dist/tools/reports.js.map +1 -0
  50. package/dist/tools/webhooks.d.ts +3 -0
  51. package/dist/tools/webhooks.js +147 -0
  52. package/dist/tools/webhooks.js.map +1 -0
  53. package/dist/tools/withdrawals.d.ts +3 -0
  54. package/dist/tools/withdrawals.js +123 -0
  55. package/dist/tools/withdrawals.js.map +1 -0
  56. package/dist/utils.d.ts +27 -0
  57. package/dist/utils.js +55 -0
  58. package/dist/utils.js.map +1 -0
  59. package/dist/version.d.ts +1 -0
  60. package/dist/version.js +4 -0
  61. package/dist/version.js.map +1 -0
  62. package/package.json +65 -4
package/README.md CHANGED
@@ -1,3 +1,181 @@
1
- # Temporary Holding Version
1
+ # @payzu/mcp-pix
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MCP server for the [PayZu Pix Processamento](https://docs.payzu.com.br/docs/pix-processamento) API. Plugs into Claude, Claude Code, Cursor, VS Code, Antigravity, Windsurf, and any other MCP-compatible AI client to let the assistant call PayZu's Pix API directly with typed tools.
4
+
5
+ **47 tools** covering every operation of the public Pix API: charges, withdrawals, refunds, internal transfers, account info, reports, webhooks, callbacks and MED infractions. No admin endpoints exposed.
6
+
7
+ ## Hosted server (no install)
8
+
9
+ ```
10
+ https://mcp.payzu.com.br/mcp
11
+ ```
12
+
13
+ Authentication is OAuth: the browser asks for your API token once, and no credential is stored in your client config.
14
+
15
+ - **Claude (web, desktop, mobile)** — Settings, Connectors, Add custom connector, paste the URL above.
16
+ - **Claude Code** — `claude mcp add --transport http payzu-pix https://mcp.payzu.com.br/mcp`
17
+ - **Cursor** — [install](https://cursor.com/en/install-mcp?name=payzu-pix&config=eyJ1cmwiOiJodHRwczovL21jcC5wYXl6dS5jb20uYnIvbWNwIn0=)
18
+ - **VS Code** — [install](https://insiders.vscode.dev/redirect/mcp/install?name=payzu-pix&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.payzu.com.br%2Fmcp%22%7D)
19
+
20
+ The shared hosted server exposes 43 tools and does not move money out of the account. Withdrawals, refunds and internal transfers (marked ¹ below) are not registered there, because a shared server has a single egress IP and that defeats the per-account IP whitelist that protects cash-out. Install locally to use them.
21
+
22
+ Every tool declares a `title` and `readOnlyHint` or `destructiveHint`, so clients can tell reads from writes.
23
+
24
+ ## Local install (all 47 tools)
25
+
26
+ ### Claude Desktop
27
+
28
+ Add to `claude_desktop_config.json` (`~/Library/Application Support/Claude/` on macOS, `%APPDATA%\Claude\` on Windows):
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "payzu-pix": {
34
+ "command": "npx",
35
+ "args": ["-y", "@payzu/mcp-pix"],
36
+ "env": {
37
+ "PAYZU_TOKEN": "<your-bearer-token-from-dashboard>"
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Cursor
45
+
46
+ Add to `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` globally):
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "payzu-pix": {
52
+ "command": "npx",
53
+ "args": ["-y", "@payzu/mcp-pix"],
54
+ "env": { "PAYZU_TOKEN": "..." }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### Claude Code
61
+
62
+ ```bash
63
+ claude mcp add payzu-pix --env PAYZU_TOKEN=<your-token> -- npx -y @payzu/mcp-pix
64
+ ```
65
+
66
+ ## Configuration
67
+
68
+ | Env var | Required | Default | Description |
69
+ |---|---|---|---|
70
+ | `PAYZU_TOKEN` | yes | — | Bearer token from the [dashboard](https://web.payzu.processamento.com/credentials) |
71
+ | `PAYZU_API_URL` | no | `https://api.payzu.processamento.com/v1` | Override for whitelabel tenants |
72
+
73
+ ## Revoking access
74
+
75
+ The hosted server issues stateless OAuth tokens that wrap your API token, so there is no server-side session to delete. To cut off a connected client, rotate your API token in the [dashboard](https://web.payzu.processamento.com/credentials) — every issued token stops working at the API on the next call.
76
+
77
+ ## Tools
78
+
79
+ Each tool description links to the corresponding endpoint page in [docs.payzu.com.br](https://docs.payzu.com.br/docs/pix-processamento).
80
+
81
+ ### Pix charges (4)
82
+ - `pix_create` — POST /pix
83
+ - `pix_get` — GET /pix
84
+ - `pix_qr_code` — GET /pix/qr-code/{transactionId}
85
+ - `pix_proof` — GET /proof/{id}
86
+
87
+ ### Withdrawals (6)
88
+ - `withdraw_create` — POST /withdraw (by Pix key) ¹
89
+ - `withdraw_get` — GET /withdraw
90
+ - `withdraw_by_qr` — POST /withdraw/qrcode ¹
91
+ - `withdraw_read_qr` — POST /pix/qrcode/read
92
+ - `withdraw_dict` — GET /pix/key?pixKey={key}
93
+ - `withdraw_proof` — GET /withdraw/proof/{id}
94
+
95
+ ### Refunds (1)
96
+ - `refund_create` — POST /refund/{transactionId} ¹
97
+
98
+ ### Webhooks (8)
99
+ - `webhooks_create` — POST /user/webhooks
100
+ - `webhooks_list` — GET /user/webhooks
101
+ - `webhooks_get` — GET /user/webhooks/{id}
102
+ - `webhooks_update` — PATCH /user/webhooks/{id}
103
+ - `webhooks_delete` — DELETE /user/webhooks/{id}
104
+ - `webhooks_rotate_secret` — POST /user/webhooks/{id}/rotate-secret
105
+ - `webhooks_sent_quantity` — GET /user/webhooks/sent/quantity
106
+ - `webhooks_sent_detail` — GET /user/webhooks/{id}/sent/{callbackId}
107
+
108
+ ### Internal transfer (2)
109
+ - `internal_transfer_create` — POST /internal-transfer ¹
110
+ - `internal_transfer_get` — GET /internal-transfer
111
+
112
+ ### Account (2)
113
+ - `account_profile` — GET /user
114
+ - `account_balance` — GET /user/balance
115
+
116
+ ### Reports (11)
117
+ - `reports_list_transactions` — GET /user/transactions
118
+ - `reports_get_transaction` — GET /user/transactions/{id}
119
+ - `reports_create_csv` — POST /user/report
120
+ - `reports_list_jobs` — GET /user/report
121
+ - `reports_get_job` — GET /user/report/{id}
122
+ - `reports_download` — POST /user/report/{id}/download
123
+ - `reports_bank_statements` — GET /user/bank-statements
124
+ - `reports_bank_statement` — GET /user/bank-statements/{id}
125
+ - `reports_deposit_pending` — GET /user/deposit-pending
126
+ - `reports_deposit_pending_get` — GET /user/deposit-pending/{id}
127
+ - `reports_summary` — GET /user/summary
128
+
129
+ ### Callbacks (8)
130
+ - `callbacks_list` — GET /user/callbacks
131
+ - `callbacks_get` — GET /user/callbacks/{id}
132
+ - `callbacks_resend` — POST /user/callbacks/resend/{transactionId}
133
+ - `callbacks_resend_bulk` — POST /user/callbacks/resend
134
+ - `callbacks_resend_webhook` — POST /user/callbacks/resend/webhook/{webhookId}
135
+ - `callbacks_resend_webhook_bulk` — POST /user/callbacks/resend/webhook
136
+ - `callbacks_create_secret` — POST /user/callbacks/secret
137
+ - `callbacks_rotate_secret` — PATCH /user/callbacks/secret/rotate
138
+
139
+ ### MED Infractions (5)
140
+ - `infractions_list` — GET /user/infractions
141
+ - `infractions_get` — GET /user/infractions/{id}
142
+ - `infractions_create_defense` — POST /user/infractions/{id}/defenses (multipart)
143
+ - `infractions_list_defenses` — GET /user/infractions/{id}/defenses
144
+ - `infractions_get_defense` — GET /user/infractions/{id}/defenses/{defenseId}
145
+
146
+ ¹ Disabled on the hosted server, for the reason above: they answer that the operation is not available there. They work in the local install.
147
+
148
+ ## Conventions enforced
149
+
150
+ - **Amounts always in BRL decimals** (`99.90`, not `9990`). Note the schema does NOT catch a unit mistake: `9990` is a valid amount and means R$ 9,990.00.
151
+ - **`clientReference` required** on all create operations for idempotency.
152
+ - **`callbackUrl` optional** on creates: pass it when you have an endpoint to be notified of status changes, or poll with the get tools.
153
+ - **Auto-retry on reads only** (`GET`) on 408, 429, 500, 502, 503 and 504, with exponential backoff + jitter (3 attempts max). Creates are never retried.
154
+ - **Errors include `errorCode` and `requestId`** — log them and send to support if you need to investigate.
155
+
156
+ ## Custom base URL
157
+
158
+ If your account uses a custom Pix Processamento endpoint, override the default via env:
159
+
160
+ ```json
161
+ "env": {
162
+ "PAYZU_TOKEN": "<your-token>",
163
+ "PAYZU_API_URL": "https://api.example.processamento.com/v1"
164
+ }
165
+ ```
166
+
167
+ All 47 tools work identically against any compatible endpoint.
168
+
169
+ ## Links
170
+
171
+ - Hosted server: https://mcp.payzu.com.br/mcp
172
+ - MCP guide: https://docs.payzu.com.br/docs/pix-processamento/mcp
173
+ - Documentation: https://docs.payzu.com.br/docs/pix-processamento
174
+ - OpenAPI: https://docs.payzu.com.br/openapi.json
175
+ - llms-full.txt: https://docs.payzu.com.br/pix-processamento/llms-full.txt
176
+ - Issues: https://github.com/PayZuAI/payzu-mcp/issues
177
+ - Pix SDKs: [`payzu-pix` on npm](https://www.npmjs.com/package/payzu-pix), [`payzu-pix` on PyPI](https://pypi.org/project/payzu-pix/)
178
+
179
+ ## License
180
+
181
+ MIT
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,201 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>PayZu Pix no seu assistente de IA | Conector MCP</title>
7
+ <meta name="description" content="Conecte Claude, ChatGPT, Cursor, VS Code e Gemini à sua conta PayZu Pix pelo protocolo MCP. Crie cobranças, consulte saldo e transações por conversa.">
8
+ <meta name="keywords" content="PayZu, PayZu Pix, MCP, Model Context Protocol, conector MCP, Claude, ChatGPT, Cursor, VS Code, Gemini, Pix por IA, API Pix, pagamentos, assistente de IA">
9
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
10
+ <meta name="author" content="PayZu">
11
+ <link rel="canonical" href="https://ia.payzu.com.br/">
12
+ <meta name="theme-color" content="#14ce71">
13
+ <meta property="og:type" content="website">
14
+ <meta property="og:url" content="https://ia.payzu.com.br/">
15
+ <meta property="og:title" content="PayZu Pix no seu assistente de IA | Conector MCP">
16
+ <meta property="og:description" content="Conecte Claude, ChatGPT, Cursor, VS Code e Gemini à sua conta PayZu Pix. Cobranças, saldo e transações por conversa.">
17
+ <meta property="og:image" content="https://ia.payzu.com.br/og.png">
18
+ <meta property="og:image:width" content="1200">
19
+ <meta property="og:image:height" content="630">
20
+ <meta property="og:locale" content="pt_BR">
21
+ <meta property="og:site_name" content="PayZu">
22
+ <meta name="twitter:card" content="summary_large_image">
23
+ <meta name="twitter:title" content="PayZu Pix no seu assistente de IA | Conector MCP">
24
+ <meta name="twitter:description" content="Sua conta Pix no seu assistente de IA, por conversa.">
25
+ <meta name="twitter:image" content="https://ia.payzu.com.br/og.png">
26
+ <link rel="icon" href="/favicon.ico">
27
+ <script type="application/ld+json">
28
+ {
29
+ "@context": "https://schema.org",
30
+ "@graph": [
31
+ {
32
+ "@type": "SoftwareApplication",
33
+ "name": "PayZu Pix MCP",
34
+ "applicationCategory": "BusinessApplication",
35
+ "operatingSystem": "Claude, ChatGPT, Cursor, VS Code, Gemini",
36
+ "description": "Conector MCP (Model Context Protocol) que liga assistentes de IA à conta PayZu Pix para criar cobranças, consultar saldo e transações, gerar relatórios e mais, por conversa.",
37
+ "url": "https://ia.payzu.com.br/",
38
+ "offers": { "@type": "Offer", "price": "0", "priceCurrency": "BRL" },
39
+ "publisher": { "@type": "Organization", "name": "PayZu", "url": "https://payzu.com.br" }
40
+ },
41
+ {
42
+ "@type": "WebSite",
43
+ "name": "PayZu Pix MCP",
44
+ "url": "https://ia.payzu.com.br/",
45
+ "inLanguage": "pt-BR",
46
+ "publisher": { "@type": "Organization", "name": "PayZu", "url": "https://payzu.com.br" }
47
+ },
48
+ {
49
+ "@type": "FAQPage",
50
+ "mainEntity": [
51
+ {
52
+ "@type": "Question",
53
+ "name": "Como conectar minha IA à PayZu?",
54
+ "acceptedAnswer": { "@type": "Answer", "text": "Adicione o servidor MCP https://mcp.payzu.com.br/mcp no seu assistente (Claude, ChatGPT, Cursor, VS Code ou Gemini) e autorize com seu token de API PayZu." }
55
+ },
56
+ {
57
+ "@type": "Question",
58
+ "name": "O que dá para fazer pela IA?",
59
+ "acceptedAnswer": { "@type": "Answer", "text": "Criar e consultar cobranças Pix, ver saldo e transações, gerar relatórios e acompanhar callbacks e infrações. Saque e transferência funcionam pelo aplicativo local." }
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ </script>
66
+ <link rel="preconnect" href="https://fonts.googleapis.com">
67
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
68
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap" rel="stylesheet">
69
+ <style>
70
+ :root {
71
+ --background: 150 10% 96%;
72
+ --foreground: 220 12% 25%;
73
+ --primary: 147 64% 42%;
74
+ --primary-foreground: 0 0% 100%;
75
+ --card: 0 0% 100%;
76
+ --card-foreground: 220 12% 25%;
77
+ --border: 220 10% 90%;
78
+ --muted: 0 0% 89.43%;
79
+ --muted-foreground: 220 8% 46%;
80
+ --radius: 0.75rem;
81
+ }
82
+ @media (prefers-color-scheme: dark) {
83
+ :root {
84
+ --background: 220 21% 9%;
85
+ --foreground: 220 10% 95%;
86
+ --primary: 147 77% 61%;
87
+ --primary-foreground: 220 20% 5%;
88
+ --card: 220 18% 11%;
89
+ --card-foreground: 220 10% 95%;
90
+ --border: 220 15% 18%;
91
+ --muted: 220 16% 14%;
92
+ --muted-foreground: 220 10% 55%;
93
+ }
94
+ }
95
+ * { box-sizing: border-box; }
96
+ body {
97
+ margin: 0;
98
+ min-height: 100vh;
99
+ padding: 48px 20px;
100
+ font-family: 'Montserrat', -apple-system, system-ui, sans-serif;
101
+ background: hsl(var(--background));
102
+ color: hsl(var(--foreground));
103
+ }
104
+ .wrap { max-width: 640px; margin: 0 auto; }
105
+ .logo { height: 34px; display: block; margin: 0 auto 28px; }
106
+ h1 { font-size: 26px; font-weight: 300; letter-spacing: -0.02em; text-align: center; margin: 0 0 8px; }
107
+ .lead { font-size: 14px; font-weight: 300; line-height: 1.6; color: hsl(var(--muted-foreground)); text-align: center; margin: 0 auto 32px; max-width: 460px; }
108
+ .endpoint {
109
+ display: flex; align-items: center; gap: 10px;
110
+ background: hsl(var(--card)); border: 1px solid hsl(var(--border));
111
+ border-radius: var(--radius); padding: 12px 14px; margin: 0 0 32px;
112
+ }
113
+ .endpoint code { flex: 1; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; color: hsl(var(--foreground)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
114
+ .label { font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); margin: 0 0 10px; }
115
+ .rows { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow: hidden; margin: 0 0 28px; }
116
+ .row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid hsl(var(--border)); }
117
+ .row:last-child { border-bottom: 0; }
118
+ .row .ico { width: 26px; height: 26px; flex: none; display: flex; align-items: center; justify-content: center; color: hsl(var(--foreground)); }
119
+ .row .ico svg { width: 22px; height: 22px; }
120
+ .row .meta { flex: 1; min-width: 0; }
121
+ .row .name { font-size: 14px; font-weight: 500; }
122
+ .row .desc { font-size: 12px; font-weight: 300; color: hsl(var(--muted-foreground)); margin-top: 2px; }
123
+ .btn {
124
+ flex: none; border: 0; border-radius: 8px; padding: 9px 16px;
125
+ background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
126
+ font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
127
+ text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
128
+ transition: opacity .15s;
129
+ }
130
+ .btn:hover { opacity: .9; }
131
+ .btn.ghost { background: transparent; color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); }
132
+ .note { font-size: 13px; font-weight: 300; line-height: 1.7; color: hsl(var(--muted-foreground)); text-align: center; }
133
+ .note a { color: hsl(var(--primary)); text-decoration: none; }
134
+ .note a:hover { text-decoration: underline; }
135
+ .note strong { color: hsl(var(--foreground)); font-weight: 500; }
136
+ @media (max-width: 560px) {
137
+ .row { flex-wrap: wrap; }
138
+ .btn { width: 100%; justify-content: center; }
139
+ }
140
+ </style>
141
+ </head>
142
+ <body>
143
+ <div class="wrap">
144
+ <picture>
145
+ <source srcset="/brand/logo-dark.png" media="(prefers-color-scheme: dark)">
146
+ <img class="logo" src="/brand/logo.png" alt="PayZu">
147
+ </picture>
148
+ <h1>Conecte sua IA à PayZu</h1>
149
+ <p class="lead">Sua conta Pix no seu assistente de IA. Cobranças, saldo e transações, tudo por conversa.</p>
150
+
151
+ <div class="label">Servidor MCP</div>
152
+ <div class="endpoint">
153
+ <code id="endpoint">https://mcp.payzu.com.br/mcp</code>
154
+ <button class="btn ghost" data-copy="https://mcp.payzu.com.br/mcp">Copiar</button>
155
+ </div>
156
+
157
+ <div class="label">Conecte seu app</div>
158
+ <div class="rows">
159
+ <div class="row">
160
+ <div class="ico"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2 3 7v10l9 5 9-5V7l-9-5Zm0 2.3 6.5 3.6L12 11.5 5.5 7.9 12 4.3Z"/></svg></div>
161
+ <div class="meta"><div class="name">Cursor</div><div class="desc">Instala e configura automaticamente</div></div>
162
+ <a class="btn" href="https://cursor.com/en/install-mcp?name=PayZu&config=eyJ1cmwiOiJodHRwczovL21jcC5wYXl6dS5jb20uYnIvbWNwIn0=">Adicionar</a>
163
+ </div>
164
+ <div class="row">
165
+ <div class="ico"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M17 2 7 12l10 10 4-2V4l-4-2Zm-1 5.5v9L11 12l5-4.5ZM3 8l3-1 4 5-4 5-3-1V8Z"/></svg></div>
166
+ <div class="meta"><div class="name">VS Code (Copilot)</div><div class="desc">Instala e configura automaticamente</div></div>
167
+ <a class="btn" href="https://insiders.vscode.dev/redirect/mcp/install?name=PayZu&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.payzu.com.br%2Fmcp%22%7D">Adicionar</a>
168
+ </div>
169
+ <div class="row">
170
+ <div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 17l6-5-6-5M12 19h8"/></svg></div>
171
+ <div class="meta"><div class="name">Claude Code</div><div class="desc">Cole no terminal (autoriza no 1º uso)</div></div>
172
+ <button class="btn ghost" data-copy='claude mcp add --transport http PayZu https://mcp.payzu.com.br/mcp'>Copiar comando</button>
173
+ </div>
174
+ <div class="row">
175
+ <div class="ico"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 3v18"/></svg></div>
176
+ <div class="meta"><div class="name">Claude Desktop · ChatGPT</div><div class="desc">Conectores → adicionar → colar a URL</div></div>
177
+ <button class="btn ghost" data-copy="https://mcp.payzu.com.br/mcp">Copiar URL</button>
178
+ </div>
179
+ <div class="row">
180
+ <div class="ico"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Zm0 4a6 6 0 0 1 6 6h-2a4 4 0 0 0-4-4Z"/></svg></div>
181
+ <div class="meta"><div class="name">Gemini CLI</div><div class="desc">Instala como extensão do Gemini</div></div>
182
+ <button class="btn ghost" data-copy="gemini extensions install github.com/PayZuAI/payzu-mcp">Copiar comando</button>
183
+ </div>
184
+ </div>
185
+
186
+ <p class="note"><a href="https://web.payzu.processamento.com/credentials" target="_blank" rel="noopener">Pegar meu token</a> · <a href="https://docs.payzu.com.br/docs/pix-processamento/mcp" target="_blank" rel="noopener">Documentação</a></p>
187
+ </div>
188
+ <script>
189
+ document.querySelectorAll('[data-copy]').forEach((el) => {
190
+ const original = el.textContent;
191
+ let t;
192
+ el.addEventListener('click', async () => {
193
+ await navigator.clipboard.writeText(el.getAttribute('data-copy'));
194
+ el.textContent = 'Copiado ✓';
195
+ clearTimeout(t);
196
+ t = setTimeout(() => { el.textContent = original; }, 1600);
197
+ });
198
+ });
199
+ </script>
200
+ </body>
201
+ </html>
Binary file
@@ -0,0 +1,14 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export interface PayzuError {
3
+ statusCode: number;
4
+ error: string;
5
+ message: string;
6
+ errorCode?: string;
7
+ requestId?: string;
8
+ }
9
+ export interface HttpConfig {
10
+ token: string;
11
+ baseUrl: string;
12
+ }
13
+ export declare function createHttp({ token, baseUrl }: HttpConfig): AxiosInstance;
14
+ export declare function formatError(err: unknown): string;
package/dist/client.js ADDED
@@ -0,0 +1,63 @@
1
+ import axios from 'axios';
2
+ import { VERSION } from './version.js';
3
+ const RETRY_STATUSES = new Set([408, 429, 500, 502, 503, 504]);
4
+ const RETRY_METHODS = new Set(['get', 'head', 'options']);
5
+ const MAX_RETRIES = 3;
6
+ function backoffMs(attempt) {
7
+ const base = 250 * Math.pow(2, attempt);
8
+ const jitter = Math.random() * 250;
9
+ return Math.min(base + jitter, 5000);
10
+ }
11
+ function sleep(ms) {
12
+ return new Promise((r) => setTimeout(r, ms));
13
+ }
14
+ export function createHttp({ token, baseUrl }) {
15
+ const http = axios.create({
16
+ baseURL: baseUrl,
17
+ timeout: 30_000,
18
+ headers: {
19
+ Authorization: `Bearer ${token}`,
20
+ 'Content-Type': 'application/json',
21
+ 'User-Agent': `payzu-mcp-pix/${VERSION}`,
22
+ },
23
+ });
24
+ http.interceptors.response.use(undefined, async (err) => {
25
+ const cfg = err.config;
26
+ if (!cfg)
27
+ throw err;
28
+ const status = err.response?.status ?? 0;
29
+ const method = (cfg.method ?? 'get').toLowerCase();
30
+ cfg.__retry = (cfg.__retry ?? 0) + 1;
31
+ if (cfg.__retry > MAX_RETRIES || !RETRY_STATUSES.has(status) || !RETRY_METHODS.has(method)) {
32
+ throw err;
33
+ }
34
+ process.stderr.write(`[payzu-mcp-pix] retry ${cfg.__retry}/${MAX_RETRIES} ${cfg.method} ${cfg.url} (status=${status})\n`);
35
+ await sleep(backoffMs(cfg.__retry - 1));
36
+ return http.request(cfg);
37
+ });
38
+ return http;
39
+ }
40
+ function errorBody(data) {
41
+ if (!(data instanceof ArrayBuffer || Buffer.isBuffer(data)))
42
+ return data;
43
+ try {
44
+ return JSON.parse(new TextDecoder().decode(data));
45
+ }
46
+ catch {
47
+ return undefined;
48
+ }
49
+ }
50
+ export function formatError(err) {
51
+ if (axios.isAxiosError(err)) {
52
+ const data = errorBody(err.response?.data);
53
+ const status = err.response?.status ?? 'network';
54
+ const message = data?.message ?? err.message;
55
+ const details = [
56
+ data?.errorCode ? `errorCode=${data.errorCode}` : '',
57
+ data?.requestId ? `requestId=${data.requestId}` : '',
58
+ ].filter(Boolean).join(', ');
59
+ return details ? `[${status}] ${message} (${details})` : `[${status}] ${message}`;
60
+ }
61
+ return err instanceof Error ? err.message : String(err);
62
+ }
63
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAevC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,SAAS,SAAS,CAAC,OAAe;IAChC,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;IACnC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,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AAK,OAAO,EAAE,CAAC;IACpF,CAAC;IACD,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const env: Readonly<{
2
+ PAYZU_TOKEN: string;
3
+ PAYZU_API_URL: string;
4
+ } & import("envalid").CleanedEnvAccessors>;
package/dist/env.js ADDED
@@ -0,0 +1,11 @@
1
+ import { cleanEnv, str, url } from 'envalid';
2
+ export const env = cleanEnv(process.env, {
3
+ PAYZU_TOKEN: str({
4
+ desc: 'Bearer token from the PayZu dashboard (web.payzu.processamento.com -> Credentials)',
5
+ }),
6
+ PAYZU_API_URL: url({
7
+ default: 'https://api.payzu.processamento.com/v1',
8
+ desc: 'Base URL of the Pix Processamento API. Override for whitelabel tenants (api.<slug>.processamento.com/v1).',
9
+ }),
10
+ });
11
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE;IACvC,WAAW,EAAE,GAAG,CAAC;QACf,IAAI,EAAE,oFAAoF;KAC3F,CAAC;IACF,aAAa,EAAE,GAAG,CAAC;QACjB,OAAO,EAAE,wCAAwC;QACjD,IAAI,EAAE,2GAA2G;KAClH,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { createHttp } from './client.js';
4
+ import { createServer } from './server.js';
5
+ import { env } from './env.js';
6
+ import { VERSION } from './version.js';
7
+ async function main() {
8
+ process.stderr.write(`[payzu-mcp-pix] starting v${VERSION} baseURL=${env.PAYZU_API_URL}\n`);
9
+ const http = createHttp({ token: env.PAYZU_TOKEN, baseUrl: env.PAYZU_API_URL });
10
+ const server = createServer(http, { enableCashOut: true });
11
+ const transport = new StdioServerTransport();
12
+ await server.connect(transport);
13
+ process.stderr.write(`[payzu-mcp-pix] listening on stdio\n`);
14
+ }
15
+ main().catch((err) => {
16
+ process.stderr.write(`[payzu-mcp-pix] fatal: ${err?.message ?? err}\n`);
17
+ process.exit(1);
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,OAAO,YAAY,GAAG,CAAC,aAAa,IAAI,CAAC,CAAC;IAC5F,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;IAChF,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;AAC/D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,GAAG,EAAE,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC;IACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import express from 'express';
2
+ export interface OauthConfig {
3
+ publicUrl: string;
4
+ tokenKey: Buffer;
5
+ apiUrl: string;
6
+ }
7
+ export declare function requestPublicUrl(req: express.Request, fallback: string): string;
8
+ export declare function resolvePayzuToken(config: OauthConfig, bearer: string): string | undefined;
9
+ export declare function createOauthRouter(config: OauthConfig): express.Router;