Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions MCP_CONFIG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MCP install — one config block per client

`@aifinpay/mcp` is an MCP server that gives an LLM five payment tools.
The install is the same everywhere: register `npx @aifinpay/mcp` as an
`@aifinpay/mcp` is an MCP server that gives an LLM seven payment tools.
The install is the same everywhere: register `npx -y @aifinpay/mcp` as an
MCP server in your client's config. The client downloads the package on
first run via `npx`.

Expand All @@ -20,15 +20,15 @@ Edit `claude_desktop_config.json`:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
```

Restart Claude Desktop. The five tools (`payable_fetch`, `agent_address`,
`agent_quote`, `pay_with_split`, `quote_split`) show up in the hammer
menu.
Restart Claude Desktop. The seven tools (`agent_call`, `agent_claim_self`,
`payable_fetch`, `agent_address`, `agent_quote`, `pay_with_split`,
`quote_split`) show up in the hammer menu.

## Cursor

Expand All @@ -39,7 +39,7 @@ Edit `~/.cursor/mcp.json` (create it if missing):
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -56,7 +56,7 @@ Edit `~/.codeium/windsurf/mcp_config.json`:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -74,7 +74,7 @@ In `~/.continue/config.json`, add to `experimental.mcpServers`:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -90,7 +90,7 @@ Open the Cline MCP Servers panel → Configure MCP Servers → paste:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -102,7 +102,7 @@ Settings → Plugins → Custom MCP → add server with:

- name: `aifinpay`
- command: `npx`
- args: `@aifinpay/mcp`
- args: `-y @aifinpay/mcp`

## Configuration (optional)

Expand All @@ -111,7 +111,7 @@ The MCP server reads two environment variables:
| Var | Default | Effect |
|---|---|---|
| `AIFINPAY_AGENT_SECRET` | random (per-process) | base58-encoded Ed25519 secret to reuse across sessions. Persist this if you want the same agent identity / funded address across restarts. |
| `AIFINPAY_MAX_USD` | `0.10` | hard cap per `payable_fetch` call — refuses to settle anything more expensive. |
| `AIFINPAY_MAX_USD` | unset | Hard cap per `agent_call` or `payable_fetch`. Set this explicitly before paid use. |

Example with persistent identity and a higher cap:

Expand All @@ -120,7 +120,7 @@ Example with persistent identity and a higher cap:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"],
"args": ["-y", "@aifinpay/mcp"],
"env": {
"AIFINPAY_AGENT_SECRET": "<base58 secret from Agent.new()>",
"AIFINPAY_MAX_USD": "0.50"
Expand Down Expand Up @@ -148,10 +148,12 @@ the assistant message. The tx hash is in the tool result.

| Tool | Purpose |
|---|---|
| `agent_call(provider, ...)` | Call a provider from the AiFinPay directory with automatic payment. |
| `agent_claim_self(magic_link_url)` | Link the agent to an AiFinPay dashboard account. |
| `payable_fetch(url, ...)` | Fetch any URL; auto-pay on 402. |
| `agent_address()` | Show the agent's EVM/Solana address (for funding). |
| `agent_quote(url)` | Preview the cost before paying. |
| `pay_with_split(merchant, amount, order_id, chain)` | Direct B2B split-payment instruction (merchant 98.99% / treasury 1% / IP-creator 0.01%). |
| `pay_with_split(merchant, amount, order_id, chain)` | Prepare a direct on-chain split payment. Confirm the quoted total before paying. |
| `quote_split(chain, merchant_amount)` | Pure-view fee breakdown. |

## Troubleshooting
Expand All @@ -165,7 +167,8 @@ exact base58 string produced by `Agent.new().secret_b58` (Python) or
random identity on each start.

**Tool refuses to settle (`max_usd_exceeded`).** Raise
`AIFINPAY_MAX_USD`. Defaults are deliberately conservative.
`AIFINPAY_MAX_USD`. It is unset by default, so set it explicitly before
allowing paid calls.

**Agent address shows `0x...` zeros.** Means the SDK couldn't derive a
key. Check `node -v` is `≥ 18`.
53 changes: 26 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
[![Site](https://img.shields.io/badge/site-aifinpay.io-black.svg)](https://aifinpay.io)
[![MCP](https://img.shields.io/badge/MCP-compatible-purple.svg)](https://modelcontextprotocol.io)

**Stripe for autonomous AI agents.** One line of code — `agent.pay(url)`
and your agent settles a real on-chain payment on Polygon or Solana
mainnet, then receives the gated response. Non-custodial. Live since
**Stripe for autonomous AI agents.** One high-level call
`agent.call(...)` or `agent.fetchPaid(url)` — lets an agent settle a real
on-chain payment and receive the gated response. Non-custodial. Live since
2026. Polygon facilitator compatible. Direct splitter settlement
(Node SDK ≥ 1.3.0, `AiFinPayAgent.call()`) also works on Base, Optimism,
Unichain, BOT Chain and XRPL EVM (native-token path); the backend-quoted
Expand All @@ -23,13 +23,13 @@ invoice flow remains Polygon + Solana.

```bash
# Python
pip install aifinpay-agent
pip install --pre aifinpay-agent

# Node / TypeScript
npm install @aifinpay/agent

# MCP server (Claude Desktop, Cursor, Windsurf, Continue)
npx @aifinpay/mcp
npx -y @aifinpay/mcp
```

## One-click MCP for Claude Desktop / Cursor
Expand All @@ -43,7 +43,7 @@ or Cursor's `~/.cursor/mcp.json`:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -61,19 +61,17 @@ Cline) lives in [`MCP_CONFIG.md`](./MCP_CONFIG.md).

| Package | Path | Install | Latest |
|---|---|---|---|
| **`aifinpay-agent`** (Python) | [`./python`](./python) | `pip install aifinpay-agent` | `1.1.1` |
| **`@aifinpay/agent`** (Node / TypeScript) | [`./node`](./node) | `npm install @aifinpay/agent` | `1.2.1` |
| **`@aifinpay/mcp`** (MCP server) | [`./mcp`](./mcp) | `npx @aifinpay/mcp` | `1.1.1` |
| **`aifinpay-agent`** (Python pre-release) | [`./python`](./python) | `pip install --pre aifinpay-agent` | `0.2.0a2` |
| **`@aifinpay/agent`** (Node / TypeScript) | [`./node`](./node) | `npm install @aifinpay/agent` | `1.8.0` |
| **`@aifinpay/mcp`** (MCP server) | [`./mcp`](./mcp) | `npx -y @aifinpay/mcp` | `1.5.0` |
| Go SDK | — | `go get github.com/AiFinPay/sdk/go` | **soon** |
| Rust SDK | — | `cargo add aifinpay-sdk` | **soon** |

## What this is

`agent.pay(url)` — one line of Python or TypeScript that pays any
[x402-protected](https://www.x402.org) URL on behalf of an autonomous
AI agent. The SDK auto-detects the facilitator flavor (AiFinPay native,
Coinbase x402, …), signs an Ed25519 challenge, retries the request, and
returns the response.
The Node SDK exposes a chain-opaque `AiFinPayAgent` for named provider calls
and AIFP-1 paid fetches. The legacy `Agent.pay(url)` surface remains available
for existing x402 integrations.

Same agent, drop into Claude Desktop's MCP config and the LLM gets
seven tools (`payable_fetch`, `agent_address`, `agent_quote`,
Expand Down Expand Up @@ -106,19 +104,19 @@ invoice = agent.pay_with_split_invoice(
### Node.js / TypeScript

```ts
import { Agent } from "@aifinpay/agent";
import { AiFinPayAgent } from "@aifinpay/agent";

const agent = Agent.new();
console.log("Fund this address:", agent.address);

const res = await agent.pay("https://api.example.com/v1/data");
const agent = await AiFinPayAgent.new({
budgetCaps: { per_call_usd: 0.50, daily_usd: 5 },
});

const invoice = await agent.payWithSplitInvoice({
chain: "polygon",
merchantWallet: "0xMerchant...",
merchantAmount: 10n ** 18n,
orderId: "search-1",
const res = await agent.call({
provider: "exa",
body: { query: "what is x402" },
});

if (!res) throw new Error("AiFinPay call returned no response");
console.log(await res.json());
```

### MCP (Claude Desktop)
Expand All @@ -128,7 +126,7 @@ const invoice = await agent.payWithSplitInvoice({
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"],
"args": ["-y", "@aifinpay/mcp"],
"env": {
"AIFINPAY_AGENT_SECRET": "<base58 secret>",
"AIFINPAY_MAX_USD": "0.50"
Expand Down Expand Up @@ -226,8 +224,9 @@ sdk/

## Releasing

All three packages are published as stable `1.0.0` on PyPI and npm under
the default (`latest`) tag, with semver-compatible updates from here.
The Node SDK and MCP server are published under npm's stable `latest` tag.
The Python package remains a PyPI pre-release and must be installed with
`--pre` until its stable release.

```bash
# Python
Expand Down
10 changes: 5 additions & 5 deletions examples/claude-mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Zero-code integration. Drop one config block, restart Claude, done.
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
}
Expand All @@ -25,9 +25,9 @@ Zero-code integration. Drop one config block, restart Claude, done.

## Verify it loaded

Click the hammer icon in the chat input. You should see five tools:
`payable_fetch`, `agent_address`, `agent_quote`, `pay_with_split`,
`quote_split`.
Click the hammer icon in the chat input. You should see seven tools:
`agent_call`, `agent_claim_self`, `payable_fetch`, `agent_address`,
`agent_quote`, `pay_with_split`, `quote_split`.

## First conversation

Expand Down Expand Up @@ -64,7 +64,7 @@ funds. To persist:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"],
"args": ["-y", "@aifinpay/mcp"],
"env": {
"AIFINPAY_AGENT_SECRET": "<base58 secret>",
"AIFINPAY_MAX_USD": "0.50"
Expand Down
4 changes: 2 additions & 2 deletions mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protocol itself is live across 13 networks — see
## Install

```bash
# Globally — usable as `npx @aifinpay/mcp` from any client config
# Globally — usable as `npx -y @aifinpay/mcp` from any client config
# (installs the latest stable — the old @alpha tag is retired, don't use it)
npm install -g @aifinpay/mcp
```
Expand All @@ -42,7 +42,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"],
"args": ["-y", "@aifinpay/mcp"],
"env": {
"AIFINPAY_AGENT_SECRET": "<base58 secret — see below>",
"AIFINPAY_MAX_USD": "0.50"
Expand Down
12 changes: 6 additions & 6 deletions mcp/server.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"$schema": "https://modelcontextprotocol.io/schemas/server.json",
"name": "aifinpay",
"version": "1.0.0",
"description": "Stripe for AI agents. Pay for any HTTP API in stablecoins or native tokens on Polygon and Solana mainnet with one MCP call. Non-custodial, on-chain settlement.",
"vendor": "CoinSecurities (SECCO)",
"version": "1.5.0",
"description": "Non-custodial payment tools for AI agents: wallet addresses, quotes, paid HTTP calls, x402 settlement, receipts, and direct split payments.",
"vendor": "AiFinPay",
"license": "MIT",
"homepage": "https://aifinpay.io",
"repository": "https://github.com/AiFinPay/sdk",
Expand All @@ -15,19 +15,19 @@
],
"install": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
},
"claude_desktop_config": {
"mcpServers": {
"aifinpay": {
"command": "npx",
"args": ["@aifinpay/mcp"]
"args": ["-y", "@aifinpay/mcp"]
}
}
},
"env": {
"AIFINPAY_AGENT_SECRET": "base58 Ed25519 secret (persistent agent identity; Solana + EVM addresses both derive from it)",
"AIFINPAY_MAX_USD": "hard cap per paid call (agent_call + payable_fetch), default 0.10",
"AIFINPAY_MAX_USD": "hard cap per paid call (agent_call + payable_fetch); unset by default",
"AIFINPAY_BASE_URL": "override the AiFinPay backend endpoint, default https://aifinpay.io"
},
"tools": [
Expand Down
Loading
Loading