Agent Kit
Let AI coding agents register a Yolfi workspace, create payment links, configure webhooks, and add crypto checkout safely.
Yolfi Agent Kit
Yolfi Agent Kit is the official package, CLI, and MCP server for AI coding agents that add crypto payments to user applications.
Use it when a user asks an agent to add checkout, payment links, subscriptions, donations, webhook-based access logic, or payment-status checks with Yolfi.
Agent Kit does not create a second Yolfi API. It gives agents safe access to the existing Yolfi API through agent registration, bearer API-key auth, package commands, and MCP tools.
npm package
GitHub repository
Agent Kit page
Install
Run the package directly:
npx -y @yolfi/agent helpStart the MCP server:
npx -y @yolfi/agent mcpEnvironment variables:
| Name | Required | Description |
|---|---|---|
YOLFI_API_KEY | Yes for private tools | Organization API key returned by agent registration or created in Yolfi settings. |
YOLFI_API_BASE_URL | No | Defaults to https://app.yolfi.com/api. |
YOLFI_PAY_BASE_URL | No | Defaults to https://pay.yolfi.com. |
YOLFI_WEBHOOK_SECRET | No | Optional override if webhook signing is separated later. |
Register A Workspace
If the target app does not already have YOLFI_API_KEY, register an agent workspace:
yolfi auth:agent-register \
--project-name "Space Shop" \
--agent-name "Codex" \
--integration-intent accept_payments \
--ref docsThe returned API key is shown once. Store it in an ignored environment file or secret manager.
The registration response includes next actions:
- configure organization;
- configure settlement wallets;
- create or reuse a paylink;
- configure webhook;
- install checkout.
MCP Configuration
{
"mcpServers": {
"yolfi-api": {
"command": "npx",
"args": ["-y", "@yolfi/agent", "mcp"],
"env": {
"YOLFI_API_KEY": "..."
}
},
"yolfi-knowledge": {
"command": "npx",
"args": ["-y", "@yolfi/agent", "mcp"]
}
}
}The same server exposes API tools and knowledge resources. API tools need YOLFI_API_KEY; knowledge resources can be read without a key.
Agent Workflow
- Inspect the target app first.
- Find the framework, environment variable pattern, checkout UI, server routes, existing webhook handlers, and entitlement logic.
- Check whether
YOLFI_API_KEYalready exists. - Register a Yolfi workspace only if no key exists.
- Ask the user for settlement wallet addresses.
- Ask the user for product names, price, currency, and one-time versus recurring decisions.
- Create or reuse a paylink.
- Store paylink IDs in ignored env/config files.
- Add checkout UI or server routes using the target app's existing style.
- Configure webhook URL and adapter in Yolfi.
- Add webhook signature verification.
- Connect webhook events to existing entitlement or fulfillment logic when possible.
- Verify payment status through Yolfi before reporting completion.
Endpoint Adapter Matrix
| Agent action | Endpoint | Auth |
|---|---|---|
| Register workspace | POST /api/auth/agent/register | Public |
| Check account | GET /api/private/organization/current | Bearer API key |
| Configure organization, webhook, settlement | PUT /api/private/organization/current | Bearer API key |
| Get API key status | GET /api/private/organization/api-key | Bearer API key or cookie |
| Create paylink | POST /api/private/paylinks/create | Bearer API key |
| List paylinks | GET /api/private/paylinks | Bearer API key |
| Get paylink | GET /api/private/paylinks/:id | Bearer API key |
| Edit paylink | POST /api/private/paylinks/edit | Bearer API key |
| Disable paylink | POST /api/private/paylinks/disable | Bearer API key plus user confirmation |
| Public paylink | GET /api/public/paylinks/:id | Public |
| Create payment invoice | POST /api/public/payments | Public |
| Payment status | GET /api/public/payments/:id | Public |
| Transactions | GET /api/private/transactions | Bearer API key |
CLI Commands
yolfi auth:agent-register --project-name "App" --agent-name "Codex" --integration-intent accept_payments
yolfi auth:status
yolfi organization:update --json organization.json
yolfi settlement:configure --json settlement.json
yolfi webhooks:configure --url https://example.com/api/yolfi/webhook --adapter STRIPE
yolfi paylinks:create --json paylink.json
yolfi paylinks:list --page 1 --rows 10
yolfi paylinks:get --id <paylinkId>
yolfi paylinks:disable --id <paylinkId> --confirm
yolfi payments:create --json payment.json
yolfi payments:status --id <paymentId>
yolfi webhooks:verify --payload payload.json --signature <sig>
yolfi mcpWebhook Verification
Yolfi signs webhook payloads using X-Yolfi-Signature. In v1, the signing secret is the organization API key.
import { verifyWebhookSignature } from '@yolfi/agent';
const valid = verifyWebhookSignature(rawBody, signature, process.env.YOLFI_API_KEY);Always verify the raw request body. Do not parse and re-stringify JSON before verification.
Safety Rules
User decisions
Secrets
Payment proof
Webhooks
Agents must not:
- invent wallet addresses;
- invent pricing;
- commit secrets;
- create duplicate paylinks after a timeout without listing existing paylinks first;
- disable paylinks without explicit user approval;
- replace existing billing logic unnecessarily.