crossfin-mcp 1.8.8 → 1.8.9

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.
package/README.md CHANGED
@@ -1,14 +1,31 @@
1
1
  # CrossFin MCP Server
2
2
 
3
- **Give your AI agent access to Asian crypto markets.** 16 tools for real-time Korean exchange data, cross-exchange routing, and x402 paid API execution.
3
+ [![npm version](https://img.shields.io/npm/v/crossfin-mcp)](https://www.npmjs.com/package/crossfin-mcp)
4
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.17-brightgreen)](https://nodejs.org)
5
+ [![MCP](https://img.shields.io/badge/MCP-compatible-blue)](https://modelcontextprotocol.io)
6
+ [![x402](https://img.shields.io/badge/payments-x402%20USDC-purple)](https://x402.org)
4
7
 
5
- ## Install
8
+ **Give your AI agent access to Asian crypto markets.** 16 tools for real-time Korean exchange data, cross-exchange routing, and x402 paid API execution across 9 exchanges.
9
+
10
+ ---
11
+
12
+ ## Quick Start
6
13
 
7
14
  ```bash
8
15
  npx -y crossfin-mcp
9
16
  ```
10
17
 
11
- ### Claude Desktop config
18
+ That's it. Your agent now has 16 tools -- 14 free, 2 paid. No API key needed for free tools.
19
+
20
+ For paid tools ($0.01--$0.10 per call), set `EVM_PRIVATE_KEY` to a Base wallet with USDC.
21
+
22
+ ---
23
+
24
+ ## Client Configuration
25
+
26
+ ### Claude Desktop
27
+
28
+ `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
12
29
 
13
30
  ```json
14
31
  {
@@ -24,55 +41,197 @@ npx -y crossfin-mcp
24
41
  }
25
42
  ```
26
43
 
27
- > **No EVM key?** Free tools work without one. Paid tools ($0.01–$0.10 per call) require a Base wallet with USDC.
44
+ ### Cursor
28
45
 
29
- ## What your agent can do
46
+ `.cursor/mcp.json` in your project root:
30
47
 
31
- - **"빗썸에서 바이낸스로 500만원 USDC 만들려면?"** → `find_optimal_route` evaluates 11 bridge coins, returns cheapest path
32
- - **"한국-글로벌 스프레드 얼마야?"** → `get_kimchi_premium` returns real-time spread across 11 pairs
33
- - **"거래소별 XRP 가격 비교해줘"** → `compare_exchange_prices` checks 4 Korean exchanges
34
- - **"한국 시장 브리핑해줘"** → `call_paid_service` calls Morning Brief bundle
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "crossfin": {
52
+ "command": "npx",
53
+ "args": ["-y", "crossfin-mcp"],
54
+ "env": {
55
+ "EVM_PRIVATE_KEY": "0x..."
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
35
61
 
36
- ## Tools
62
+ ### VS Code
37
63
 
38
- | Tool | Free/Paid | Description |
39
- |------|-----------|-------------|
40
- | `find_optimal_route` | $0.10 | Optimal crypto transfer path across 9 exchanges (11 bridge coins) |
41
- | `list_exchange_fees` | Free | Trading + withdrawal fee comparison |
42
- | `compare_exchange_prices` | Free | Live price comparison across Korean exchanges |
43
- | `get_kimchi_premium` | Free | Korean vs. global price spread preview |
44
- | `call_paid_service` | Varies | Call any of 35 paid APIs with automatic x402 payment |
45
- | `search_services` | Free | Search registered services |
46
- | `list_services` | Free | Browse service catalog |
47
- | `get_service` | Free | Service details |
48
- | `list_categories` | Free | Service categories |
49
- | `get_guide` | Free | Full agent guide |
50
- | `get_analytics` | Free | Gateway usage stats |
51
- | `create_wallet` | Free | Local ledger wallet |
52
- | `get_balance` | Free | Check wallet balance |
53
- | `transfer` | Free | Transfer between wallets |
54
- | `list_transactions` | Free | Transaction history |
55
- | `set_budget` | Free | Daily spend limit |
64
+ `.vscode/mcp.json` in your project root (or user-level in settings):
56
65
 
57
- ## Supported exchanges
66
+ ```json
67
+ {
68
+ "inputs": [
69
+ {
70
+ "type": "promptString",
71
+ "id": "evm-key",
72
+ "description": "Base wallet private key for x402 payments (optional)",
73
+ "password": true
74
+ }
75
+ ],
76
+ "servers": {
77
+ "crossfin": {
78
+ "type": "stdio",
79
+ "command": "npx",
80
+ "args": ["-y", "crossfin-mcp"],
81
+ "env": {
82
+ "EVM_PRIVATE_KEY": "${input:evm-key}"
83
+ }
84
+ }
85
+ }
86
+ }
87
+ ```
58
88
 
59
- Bithumb, Upbit, Coinone, GoPax (Korea) + bitFlyer, WazirX (Regional Fiat) + Binance, OKX, Bybit (Global)
89
+ ### Windsurf
60
90
 
61
- ## Bridge coins
91
+ `~/.codeium/windsurf/mcp_config.json`:
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "crossfin": {
97
+ "command": "npx",
98
+ "args": ["-y", "crossfin-mcp"],
99
+ "env": {
100
+ "EVM_PRIVATE_KEY": "0x..."
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### npx (standalone)
108
+
109
+ ```bash
110
+ EVM_PRIVATE_KEY=0x... npx -y crossfin-mcp
111
+ ```
112
+
113
+ > **No EVM key?** Omit `EVM_PRIVATE_KEY` entirely. Free tools work without one.
114
+
115
+ ---
116
+
117
+ ## All 16 Tools
118
+
119
+ ### Routing Engine
120
+
121
+ | Tool | Price | Description |
122
+ |------|-------|-------------|
123
+ | `find_optimal_route` | $0.10 | Optimal crypto transfer path across 9 exchanges with 11 bridge coins |
124
+ | `list_exchange_fees` | Free | Trading + withdrawal fee comparison for all exchanges |
125
+ | `compare_exchange_prices` | Free | Live Bithumb KRW vs Binance USD price comparison |
126
+ | `get_kimchi_premium` | Free | Korean vs. global route spread preview (top 3 pairs) |
127
+
128
+ ### Paid API Gateway
129
+
130
+ | Tool | Price | Description |
131
+ |------|-------|-------------|
132
+ | `call_paid_service` | Varies | Call any of 35+ paid APIs with automatic x402 USDC payment |
133
+
134
+ ### Service Registry
135
+
136
+ | Tool | Price | Description |
137
+ |------|-------|-------------|
138
+ | `search_services` | Free | Search registered services by keyword |
139
+ | `list_services` | Free | Browse the service catalog with category filter |
140
+ | `get_service` | Free | Get details for a specific service |
141
+ | `list_categories` | Free | List all service categories with counts |
142
+ | `get_guide` | Free | Full CrossFin agent guide (services, pricing, x402 flow) |
143
+ | `get_analytics` | Free | Gateway usage stats (total calls, top services) |
144
+
145
+ ### Local Ledger
146
+
147
+ | Tool | Price | Description |
148
+ |------|-------|-------------|
149
+ | `create_wallet` | Free | Create a wallet in the local CrossFin ledger |
150
+ | `get_balance` | Free | Check wallet balance (KRW) |
151
+ | `transfer` | Free | Transfer funds between wallets |
152
+ | `list_transactions` | Free | Transaction history (optionally filtered by wallet) |
153
+ | `set_budget` | Free | Set a daily spend limit (KRW) |
154
+
155
+ ---
156
+
157
+ ## Sample Prompts
158
+
159
+ **Korean**
160
+
161
+ > 빗썸에서 바이낸스로 500만원 USDC 만들려면 가장 싼 방법이 뭐야?
162
+
163
+ > 지금 한국-글로벌 스프레드 얼마야?
164
+
165
+ > 거래소별 XRP 가격 비교해줘
166
+
167
+ > 오늘 한국 시장 브리핑해줘
168
+
169
+ **English**
170
+
171
+ > What's the cheapest way to move 5M KRW from Bithumb to Binance as USDC?
172
+
173
+ > Show me the current Korea-global crypto spread.
174
+
175
+ > Compare XRP prices across exchanges.
176
+
177
+ > Give me this morning's Korean market brief.
178
+
179
+ ---
180
+
181
+ ## Supported Exchanges
182
+
183
+ **Korea:** Bithumb, Upbit, Coinone, GoPax
184
+ **Regional Fiat:** bitFlyer, WazirX
185
+ **Global:** Binance, OKX, Bybit
186
+
187
+ ### Bridge Coins
62
188
 
63
189
  BTC, ETH, XRP, SOL, DOGE, ADA, DOT, LINK, AVAX, TRX, KAIA
64
190
 
65
- ## Environment variables
191
+ ---
192
+
193
+ ## Environment Variables
66
194
 
67
195
  | Variable | Required | Description |
68
196
  |----------|----------|-------------|
69
197
  | `EVM_PRIVATE_KEY` | For paid tools | Base wallet private key for x402 USDC payments |
70
198
  | `CROSSFIN_API_URL` | No | API base URL (default: `https://crossfin.dev`) |
71
- | `CROSSFIN_LEDGER_PATH` | No | Local ledger path (default: `~/.crossfin/ledger.json`) |
199
+ | `CROSSFIN_LEDGER_PATH` | No | Local ledger file path (default: `~/.crossfin/ledger.json`) |
200
+
201
+ ---
202
+
203
+ ## x402 Payments
204
+
205
+ Paid tools use the [x402 protocol](https://x402.org) for automatic micropayments. When your agent calls a paid endpoint:
206
+
207
+ 1. The API responds with `402 Payment Required` and a price header
208
+ 2. The MCP server signs a USDC payment on **Base** (L2) using your `EVM_PRIVATE_KEY`
209
+ 3. The payment is submitted and the API returns the data along with a transaction receipt
210
+
211
+ Payments settle on-chain. Each response includes `txHash` and a Basescan link for verification. Prices range from $0.01 to $0.20 per call.
212
+
213
+ To get started, fund a Base wallet with USDC and set `EVM_PRIVATE_KEY`. No account registration or API keys required.
214
+
215
+ ---
216
+
217
+ ## Agent Discovery
218
+
219
+ CrossFin exposes standard discovery endpoints so agent frameworks can auto-detect capabilities:
220
+
221
+ | Endpoint | Description |
222
+ |----------|-------------|
223
+ | [`/.well-known/ai-plugin.json`](https://crossfin.dev/.well-known/ai-plugin.json) | OpenAI plugin manifest |
224
+ | [`/.well-known/agent.json`](https://crossfin.dev/.well-known/agent.json) | A2A Agent Card (Google Agent-to-Agent protocol) |
225
+ | [`/.well-known/x402.json`](https://crossfin.dev/.well-known/x402.json) | x402 payment discovery (network, token, payTo) |
226
+ | [`/.well-known/crossfin.json`](https://crossfin.dev/.well-known/crossfin.json) | CrossFin metadata (MCP, API, registry links) |
227
+ | [`/llms.txt`](https://crossfin.dev/llms.txt) | LLM-friendly service description |
228
+
229
+ ---
72
230
 
73
231
  ## Links
74
232
 
75
- - [crossfin.dev](https://crossfin.dev) Dashboard
76
- - [live.crossfin.dev](https://live.crossfin.dev) Live routing demo
77
- - [GitHub](https://github.com/bubilife1202/crossfin) Source code
78
- - [npm](https://www.npmjs.com/package/crossfin-mcp) Package
233
+ - [crossfin.dev](https://crossfin.dev) -- Dashboard & API
234
+ - [live.crossfin.dev](https://live.crossfin.dev) -- Live routing demo
235
+ - [docs.crossfin.dev](https://docs.crossfin.dev) -- Documentation
236
+ - [GitHub](https://github.com/bubilife1202/crossfin) -- Source code
237
+ - [npm](https://www.npmjs.com/package/crossfin-mcp) -- Package
package/dist/index.js CHANGED
@@ -152,6 +152,17 @@ export default function createServer({ config }) {
152
152
  },
153
153
  };
154
154
  }
155
+ if (!('tx' in result)) {
156
+ return {
157
+ content: [{ type: 'text', text: result.error }],
158
+ structuredContent: {
159
+ transactionId: '',
160
+ fromBalanceKrw: -1,
161
+ toBalanceKrw: -1,
162
+ },
163
+ isError: true,
164
+ };
165
+ }
155
166
  const out = {
156
167
  transactionId: result.tx.id,
157
168
  fromBalanceKrw: result.fromBalanceKrw,
@@ -240,7 +251,7 @@ export default function createServer({ config }) {
240
251
  title: 'Get service',
241
252
  description: 'Get detailed information about a specific service by ID',
242
253
  inputSchema: z.object({
243
- serviceId: z.string().describe('Service ID (e.g. "svc_kimchi_premium")'),
254
+ serviceId: z.string().describe('Service ID (e.g. "crossfin_kimchi_premium")'),
244
255
  }),
245
256
  }, async ({ serviceId }) => {
246
257
  try {
@@ -67,6 +67,16 @@ export async function transfer(filePath, input) {
67
67
  return null;
68
68
  if (from.balanceKrw < amount)
69
69
  return null;
70
+ // Budget enforcement: check daily spend limit before executing
71
+ if (db.budget.dailyLimitKrw !== null) {
72
+ const todaySpent = getDailySpent(db, input.fromWalletId);
73
+ if (todaySpent + amount > db.budget.dailyLimitKrw) {
74
+ const remaining = Math.max(0, db.budget.dailyLimitKrw - todaySpent);
75
+ return {
76
+ error: `Daily budget exceeded. Limit: ${db.budget.dailyLimitKrw} KRW, spent today: ${todaySpent} KRW, remaining: ${remaining} KRW, requested: ${amount} KRW`,
77
+ };
78
+ }
79
+ }
70
80
  from.balanceKrw -= amount;
71
81
  to.balanceKrw += amount;
72
82
  const tx = {
@@ -82,6 +92,19 @@ export async function transfer(filePath, input) {
82
92
  await writeDb(filePath, db);
83
93
  return { tx, fromBalanceKrw: from.balanceKrw, toBalanceKrw: to.balanceKrw };
84
94
  }
95
+ /** Sum all outgoing transfers from a wallet for today (UTC). */
96
+ function getDailySpent(db, walletId) {
97
+ const todayPrefix = new Date().toISOString().slice(0, 10); // "YYYY-MM-DD"
98
+ let total = 0;
99
+ for (const tx of db.transactions) {
100
+ if (!tx.at.startsWith(todayPrefix))
101
+ continue;
102
+ if (tx.fromWalletId === walletId) {
103
+ total += tx.amountKrw;
104
+ }
105
+ }
106
+ return total;
107
+ }
85
108
  export async function listTransactions(filePath, input) {
86
109
  const db = await readDb(filePath);
87
110
  const limit = Math.max(1, Math.min(200, Math.round(input.limit)));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "crossfin-mcp",
3
3
  "private": false,
4
- "version": "1.8.8",
4
+ "version": "1.8.9",
5
5
  "mcpName": "io.github.bubilife1202/crossfin",
6
6
  "description": "CrossFin MCP server for service discovery and paid x402 API execution",
7
7
  "bin": {