Integrations / MCP / Cursor
Cursor
Подключение PayMCP в Cursor: mcp.json, включение сервера и готовый промпт для Agent-чата.
Общий setup и роли MCP / SKILL: Overview and setup. Ключ: кабинет.
1. Подключить Remote MCP
- Создайте ключ mcp_test_… или mcp_live_… в кабинете PayMCP.
- Добавьте .cursor/mcp.json в корень проекта (или через Settings → MCPs).
- Добавьте .cursor/mcp.json в .gitignore — там Bearer-ключ.
- Cursor Settings → MCP (в новых версиях Tools & MCP) — paymcp должен быть зелёным (7 tools).
- Если серый: проверьте backend :8080, Bearer, toggle off/on или рестарт Cursor.
.cursor/mcp.json
{
"mcpServers": {
"paymcp": {
"url": "http://93.170.72.62:10500/mcp",
"headers": {
"Authorization": "Bearer mcp_test_YOUR_KEY"
}
}
}
}Не коммитьте Bearer в git. Смена ключа test→live: правите JSON → toggle paymcp. В уже интегрированном магазине режим меняется через FREEDOMPAY_TESTING_MODE, не через ключ.
SKILL.md (опционально)
Только скачивает навык. Не вызывает MCP tools и не пишет код — для этого нужен промпт ниже.
terminal
mkdir -p .cursor/skills/paymcp
curl -sSL http://93.170.72.62:10500/SKILL.md -o .cursor/skills/paymcp/SKILL.md2. Промпт для Agent-чата
Скопируйте блок целиком
Вставьте промпт в Agent-чат Cursor. Перед этим заполните
<my_stack> или ответьте агенту на вопрос про стек. Агент должен вызвать PayMCP tools и править файлы репо.paymcp-prompt.md
# Connect FreedomPay payments via PayMCP — AI prompt
You are an AI coding agent integrating FreedomPay into the user's existing app
end-to-end in one session. The user already has a PayMCP cabinet account and an
API key (mcp_test_… or mcp_live_…). Start at MCP tools — do not invent PSP APIs.
Your job, in order:
(1) Call list_payment_providers and show options.
(2) Confirm FreedomPay (ready) + frontend_stack + backend_stack via select_integration.
(3) Call scaffold_integration, then EDIT the user's repository files.
(4) Wire POST /api/checkout (init_payment.php + redirect) and the result_url webhook
(pg_sig verify + signed XML reply).
(5) Call security_checklist.
(6) Tell the user what is left for them (see "Webhook business logic").
build_payment_params / sign_request / verify_webhook need merchant creds in PayMCP
vault (not in the cabinet yet). If they return "No merchant credentials" — skip them.
---
## <my_stack>
```
frontend_stack: # e.g. nextjs | nuxt | react-vite | vue | html
backend_stack: # e.g. nextjs | nest | express | go | fastapi | laravel | django
use_case: # e.g. "checkout 1000 KZT demo shop"
```
If <my_stack> is empty, ask once at the top, then proceed.
---
## Two environments
- Integrator agent (this chat): PayMCP MCP tools — scaffolding only.
- Production app: talks to FreedomPay directly. NEVER call PayMCP MCP from runtime.
---
## Client .env (shop)
```
FREEDOMPAY_MERCHANT_ID=
FREEDOMPAY_SECRET_KEY=
FREEDOMPAY_TESTING_MODE=1 # 1 for mcp_test_ key, 0 for mcp_live_
```
- Checkout reads FREEDOMPAY_TESTING_MODE at runtime (unset → 1) → pg_testing_mode.
Going live = change env in prod, no code change.
- No FREEDOMPAY_BASE_URL: API host is always https://api.freedompay.kz
- Cabinet LOGIN/PASSWORD are NOT used for Merchant API signatures.
- The user fills secrets into .env themselves — never ask them to paste secrets in chat.
---
## Signature
pg_sig = md5(script_name;values sorted by key (skip empty);SECRET_KEY)
- outgoing init_payment: script_name = "init_payment.php"
- incoming result_url: script_name = last path segment of YOUR result_url
(/api/webhooks/freedompay → "freedompay")
- reply to result_url with signed XML:
<response><pg_status>ok</pg_status><pg_description/><pg_salt/><pg_sig/></response>
---
## Webhook business logic — the user finishes it
You write the webhook skeleton: pg_sig verification, pg_result parsing, signed XML reply.
Do NOT invent the shop's fulfillment. Leave clearly marked TODOs where the user must add:
- find the order by pg_order_id in their DB; compare pg_amount / pg_currency
- idempotency: unique pg_payment_id, a repeated webhook must not fulfill twice
- pg_result=1 → mark paid + their action (grant access, email, stock); 0 → mark failed
- reply ok only after the DB write commits
At the end, list these TODOs to the user explicitly.
---
## Rules
- No merchant secrets in git, client bundles, or MCP tool arguments.
- success_url redirect ≠ paid — verify webhook pg_sig, compare order_id + amount.
- Idempotent fulfill on pg_payment_id.
- Do not invent APIs for status=soon providers (Halyk, Kaspi, ioka, Wooppay).
После промпта
- В `.env` магазина:
FREEDOMPAY_MERCHANT_ID,FREEDOMPAY_SECRET_KEY,FREEDOMPAY_TESTING_MODE. - Проверка бэка:
curl -X POST http://localhost:<порт>/api/checkoutили кнопка на фронте. mcp_test_→FREEDOMPAY_TESTING_MODE=1;mcp_live_→ 0. В бой — смените env на проде, код не трогать.- Вебхук: pg_sig со script name = последний сегмент result_url, ответ — подписанный XML. result_url должен быть доступен из интернета.
- Бизнес-логику /api/webhooks/freedompay дописываете сами: найти заказ, сверить сумму, не выдать товар дважды по одному
pg_payment_id, выдать доступ или отправить письмо. Агент пишет только каркас с проверкой подписи. Что именно дописать.