@1ly/mcp-server 0.1.0 → 0.1.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 (43) hide show
  1. package/README.md +574 -166
  2. package/dist/config.d.ts +7 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js +19 -3
  5. package/dist/config.js.map +1 -1
  6. package/dist/index.js +18 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/keys.d.ts +13 -0
  9. package/dist/keys.d.ts.map +1 -0
  10. package/dist/keys.js +52 -0
  11. package/dist/keys.js.map +1 -0
  12. package/dist/selftest.d.ts.map +1 -1
  13. package/dist/selftest.js +14 -9
  14. package/dist/selftest.js.map +1 -1
  15. package/dist/tools/call.d.ts.map +1 -1
  16. package/dist/tools/call.js +48 -16
  17. package/dist/tools/call.js.map +1 -1
  18. package/dist/tools/create-key.d.ts +21 -0
  19. package/dist/tools/create-key.d.ts.map +1 -0
  20. package/dist/tools/create-key.js +38 -0
  21. package/dist/tools/create-key.js.map +1 -0
  22. package/dist/tools/create-store.d.ts +27 -0
  23. package/dist/tools/create-store.d.ts.map +1 -0
  24. package/dist/tools/create-store.js +99 -0
  25. package/dist/tools/create-store.js.map +1 -0
  26. package/dist/tools/list-keys.d.ts +17 -0
  27. package/dist/tools/list-keys.d.ts.map +1 -0
  28. package/dist/tools/list-keys.js +29 -0
  29. package/dist/tools/list-keys.js.map +1 -0
  30. package/dist/tools/review.d.ts.map +1 -1
  31. package/dist/tools/review.js +45 -20
  32. package/dist/tools/review.js.map +1 -1
  33. package/dist/tools/revoke-key.d.ts +22 -0
  34. package/dist/tools/revoke-key.d.ts.map +1 -0
  35. package/dist/tools/revoke-key.js +37 -0
  36. package/dist/tools/revoke-key.js.map +1 -0
  37. package/dist/wallet/evm.d.ts.map +1 -1
  38. package/dist/wallet/evm.js +4 -4
  39. package/dist/wallet/evm.js.map +1 -1
  40. package/dist/wallet/solana.d.ts.map +1 -1
  41. package/dist/wallet/solana.js +2 -1
  42. package/dist/wallet/solana.js.map +1 -1
  43. package/package.json +3 -3
package/README.md CHANGED
@@ -1,75 +1,74 @@
1
1
  # @1ly/mcp-server
2
2
 
3
- MCP server for [1ly.store](https://1ly.store) — Discover and pay for APIs with AI agents.
3
+ MCP server for [1ly.store](https://1ly.store) — Enable AI agents to discover, pay for, and sell APIs using crypto.
4
4
 
5
- ## What is this?
5
+ ## Overview
6
6
 
7
- This MCP server enables AI agents (Claude, GPT, Cursor, etc.) to:
7
+ This MCP server gives AI agents the ability to:
8
8
 
9
- 1. **Search** for APIs and services on 1ly.store
10
- 2. **Get details** about pricing, reviews, and usage
11
- 3. **Call APIs** with automatic crypto payments (x402 protocol)
12
- 4. **Leave reviews** after purchases
13
- 5. **Create and manage API links** (Developer Mode + API key)
9
+ - **Buy** — Search, discover, and pay for APIs, resources with automatic crypto payments (x402 protocol)
10
+ - **Sell** Create a store, list paid API endpoints or resources, and accept payments
14
11
 
15
- ## Quick Start (1 minute)
12
+ **Supported Networks:** Solana (mainnet), Base (mainnet)
13
+ **Payment Currency:** USDC
16
14
 
17
- Pick **one** of the following and paste it into your terminal.
15
+ ## What is this?
16
+ This MCP server enables AI agents (Claude, GPT, Cursor, or any AI Agents etc.) to:
18
17
 
19
- ### Solana (mainnet)
18
+ Create store on 1ly.store
19
+ Accept payments for your own APIs/resources using 1ly as the payment layer
20
+ Create paid links that any x402‑compatible agent can call and pay automatically
21
+ Paid links are listed on the 1ly marketplace by default for instant agent discovery
22
+ Search for APIs and services on 1ly.store
23
+ Get details about pricing, reviews, and usage
24
+ Call paid APIs with automatic crypto payments (x402 protocol) in secure way.
25
+ Leave reviews after purchases, optional but recommended to make better experience for 1ly users
20
26
 
21
- ```bash
22
- ONELY_WALLET_TYPE=solana \
23
- ONELY_WALLET_KEY="$HOME/1ly-agent-wallet.json" \
24
- npx @1ly/mcp-server
25
- ```
27
+ ---
28
+
29
+ ## Quick Start
26
30
 
27
- ### Base (mainnet)
31
+ ### 1. Install and Run
28
32
 
29
33
  ```bash
30
- ONELY_WALLET_TYPE=evm \
31
- ONELY_WALLET_KEY="$HOME/.1ly-base-private-key" \
32
- npx @1ly/mcp-server
33
- ```
34
+ # Solana wallet
35
+ ONELY_WALLET_SOLANA_KEY="/path/to/solana-wallet.json" npx @1ly/mcp-server
34
36
 
35
- Optional safety limits:
37
+ # OR Base/EVM wallet
38
+ ONELY_WALLET_EVM_KEY="/path/to/evm.key" npx @1ly/mcp-server
36
39
 
37
- ```bash
38
- ONELY_BUDGET_PER_CALL=1.00
39
- ONELY_BUDGET_DAILY=50.00
40
+ # OR both wallets
41
+ ONELY_WALLET_SOLANA_KEY="/path/to/solana-wallet.json" \
42
+ ONELY_WALLET_EVM_KEY="/path/to/evm.key" \
43
+ npx @1ly/mcp-server
40
44
  ```
41
45
 
42
- ### Developer Mode (create/manage API links)
46
+ ### 2. Verify Setup
43
47
 
44
48
  ```bash
45
- ONELY_API_KEY="1ly_live_..." \
46
- npx @1ly/mcp-server
49
+ ONELY_WALLET_SOLANA_KEY="/path/to/solana-wallet.json" npx @1ly/mcp-server --self-test
47
50
  ```
48
51
 
49
- ## Get an API Key (Developer Mode)
50
-
51
- 1. Sign in to 1ly store: `https://1ly.store`
52
- 2. Open **Settings** (profile dropdown → Settings)
53
- 3. Enable **Developer Mode**
54
- 4. Open **Developer Settings** and click **Create API Key**
55
- 5. Copy the key (shown once)
52
+ ---
56
53
 
57
- Keys look like:
58
- ```
59
- 1ly_live_xxxxxxxx...
60
- ```
54
+ ## Configuration
61
55
 
62
- ## How API keys are used
56
+ ### Environment Variables
63
57
 
64
- - **For MCP tools**: set `ONELY_API_KEY` in your MCP config or environment.
65
- The MCP server attaches it as `Authorization: Bearer <key>` automatically.
66
- - **For direct API calls**: include the header yourself:
58
+ | Variable | Required | Description |
59
+ |----------|----------|-------------|
60
+ | `ONELY_WALLET_SOLANA_KEY` | Yes* | Path to Solana keypair JSON file, or inline JSON array |
61
+ | `ONELY_WALLET_EVM_KEY` | Yes* | Path to EVM private key file, or inline hex key (with or without `0x`) |
62
+ | `ONELY_API_KEY` | No | API key for seller tools. Auto-loaded after `1ly_create_store` |
63
+ | `ONELY_BUDGET_PER_CALL` | No | Max USD per API call (default: `1.00`) |
64
+ | `ONELY_BUDGET_DAILY` | No | Daily USD spending limit (default: `50.00`) |
65
+ | `ONELY_BUDGET_STATE_FILE` | No | Path to local budget state file (default: `~/.1ly-mcp-budget.json`) |
66
+ | `ONELY_NETWORK` | No | Preferred network: `solana` or `base` (default: `solana`) |
67
+ | `ONELY_API_BASE` | No | API base URL (default: `https://1ly.store`) |
67
68
 
68
- ```http
69
- Authorization: Bearer 1ly_live_...
70
- ```
69
+ *At least one wallet is required for payments.
71
70
 
72
- ## Install (Claude Desktop)
71
+ ### Claude Desktop Configuration
73
72
 
74
73
  Add to `claude_desktop_config.json`:
75
74
 
@@ -80,8 +79,7 @@ Add to `claude_desktop_config.json`:
80
79
  "command": "npx",
81
80
  "args": ["@1ly/mcp-server"],
82
81
  "env": {
83
- "ONELY_WALLET_TYPE": "solana",
84
- "ONELY_WALLET_KEY": "/path/to/solana-wallet.json",
82
+ "ONELY_WALLET_SOLANA_KEY": "/absolute/path/to/solana-wallet.json",
85
83
  "ONELY_BUDGET_PER_CALL": "1.00",
86
84
  "ONELY_BUDGET_DAILY": "50.00"
87
85
  }
@@ -90,7 +88,8 @@ Add to `claude_desktop_config.json`:
90
88
  }
91
89
  ```
92
90
 
93
- ### Developer Mode (API key only)
91
+ <details>
92
+ <summary>Base/EVM wallet configuration</summary>
94
93
 
95
94
  ```json
96
95
  {
@@ -99,25 +98,28 @@ Add to `claude_desktop_config.json`:
99
98
  "command": "npx",
100
99
  "args": ["@1ly/mcp-server"],
101
100
  "env": {
102
- "ONELY_API_KEY": "1ly_live_..."
101
+ "ONELY_WALLET_EVM_KEY": "/absolute/path/to/evm.key",
102
+ "ONELY_BUDGET_PER_CALL": "1.00",
103
+ "ONELY_BUDGET_DAILY": "50.00"
103
104
  }
104
105
  }
105
106
  }
106
107
  }
107
108
  ```
109
+ </details>
108
110
 
109
- ## Install (Cursor)
110
-
111
- Add to `.cursor/mcp.json`:
111
+ <details>
112
+ <summary>Both Solana + Base wallets</summary>
112
113
 
113
114
  ```json
114
115
  {
115
- "servers": {
116
+ "mcpServers": {
116
117
  "1ly": {
117
- "command": "npx @1ly/mcp-server",
118
+ "command": "npx",
119
+ "args": ["@1ly/mcp-server"],
118
120
  "env": {
119
- "ONELY_WALLET_TYPE": "solana",
120
- "ONELY_WALLET_KEY": "/path/to/solana-wallet.json",
121
+ "ONELY_WALLET_SOLANA_KEY": "/absolute/path/to/solana-wallet.json",
122
+ "ONELY_WALLET_EVM_KEY": "/absolute/path/to/evm.key",
121
123
  "ONELY_BUDGET_PER_CALL": "1.00",
122
124
  "ONELY_BUDGET_DAILY": "50.00"
123
125
  }
@@ -125,199 +127,605 @@ Add to `.cursor/mcp.json`:
125
127
  }
126
128
  }
127
129
  ```
130
+ </details>
131
+
132
+ ---
133
+
134
+ ## Tools Reference
135
+
136
+ ### Buyer Tools (Pay for APIs)
128
137
 
129
- ### Developer Mode (API key only)
138
+ These tools require a **wallet** configured.
139
+
140
+ #### `1ly_search`
141
+
142
+ Search for APIs on 1ly.store marketplace.
143
+
144
+ | Parameter | Type | Required | Description |
145
+ |-----------|------|----------|-------------|
146
+ | `query` | string | **Yes** | Search term (e.g., "weather api") |
147
+ | `type` | string | No | Filter: `"api"` or `"standard"` |
148
+ | `maxPrice` | number | No | Maximum price in USD |
149
+ | `minPrice` | number | No | Minimum price in USD |
150
+ | `limit` | number | No | Results to return (default: 10, max: 50) |
130
151
 
131
152
  ```json
132
153
  {
133
- "servers": {
134
- "1ly": {
135
- "command": "npx @1ly/mcp-server",
136
- "env": {
137
- "ONELY_API_KEY": "1ly_live_..."
154
+ "query": "weather api",
155
+ "type": "api",
156
+ "maxPrice": 0.10
157
+ }
158
+ ```
159
+
160
+ **Returns:**
161
+ ```json
162
+ {
163
+ "ok": true,
164
+ "data": {
165
+ "results": [
166
+ {
167
+ "title": "Real-time Weather",
168
+ "endpoint": "/api/link/joe/weather",
169
+ "price": "$0.010000000000000000 USDC",
170
+ "type": "api",
171
+ "seller": "Joe's APIs",
172
+ "stats": { "buyers": 150, "rating": "95%" }
138
173
  }
174
+ ],
175
+ "total": 42,
176
+ "showing": 10
177
+ }
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ #### `1ly_get_details`
184
+
185
+ Get detailed information about a specific API.
186
+
187
+ | Parameter | Type | Required | Description |
188
+ |-----------|------|----------|-------------|
189
+ | `endpoint` | string | **Yes** | API endpoint (e.g., `"joe/weather"`) |
190
+
191
+ ```json
192
+ {
193
+ "endpoint": "joe/weather"
194
+ }
195
+ ```
196
+
197
+ **Returns (example):**
198
+ ```json
199
+ {
200
+ "ok": true,
201
+ "data": {
202
+ "endpoint": "/api/link/joe/weather",
203
+ "fullUrl": "https://1ly.store/api/link/joe/weather",
204
+ "link": {
205
+ "title": "Real-time Weather",
206
+ "description": "Global weather data",
207
+ "slug": "weather",
208
+ "price": "0.010000000000000000",
209
+ "currency": "USDC"
210
+ },
211
+ "paymentInfo": { "networks": ["solana", "base"] },
212
+ "reviews": {
213
+ "stats": { "total": 50, "positive": 48 },
214
+ "recent": [{ "positive": true, "comment": "Fast!" }]
139
215
  }
140
216
  }
141
217
  }
142
218
  ```
143
219
 
144
- ## Verify it works (recommended)
220
+ ---
145
221
 
146
- Run a quick self-test:
222
+ #### `1ly_call`
147
223
 
148
- ```bash
149
- ONELY_WALLET_TYPE=solana \
150
- ONELY_WALLET_KEY="$HOME/1ly-agent-wallet.json" \
151
- npx @1ly/mcp-server --self-test
224
+ Call a paid API with automatic crypto payment.
225
+
226
+ | Parameter | Type | Required | Description |
227
+ |-----------|------|----------|-------------|
228
+ | `endpoint` | string | **Yes** | API endpoint (e.g., `"joe/weather"`) |
229
+ | `method` | string | No | HTTP method: `GET`, `POST`, `PUT`, `DELETE`, `PATCH` (default: `GET`) |
230
+ | `body` | object | No | Request body for POST/PUT/PATCH |
231
+ | `headers` | object | No | Additional headers |
232
+
233
+ ```json
234
+ {
235
+ "endpoint": "joe/weather",
236
+ "method": "POST",
237
+ "body": { "city": "NYC" }
238
+ }
239
+ ```
240
+
241
+ **Returns (example):**
242
+ ```json
243
+ {
244
+ "ok": true,
245
+ "data": {
246
+ "data": {
247
+ "temp": 72,
248
+ "conditions": "sunny"
249
+ },
250
+ "_1ly": {
251
+ "purchaseId": "abc123",
252
+ "txHash": "tx_hash_here",
253
+ "reviewUrl": "https://1ly.store/api/review/abc123",
254
+ "reviewToken": "xyz789"
255
+ }
256
+ }
257
+ }
258
+ ```
259
+
260
+ > **Note:** The `_1ly` object contains tokens needed for `1ly_review`. Save these if you want to leave a review.
261
+ > For free APIs, `_1ly` may be `{ "note": "No payment required (free API)" }`.
262
+
263
+ ---
264
+
265
+ #### `1ly_review`
266
+
267
+ Leave a review after a successful purchase.
268
+
269
+ | Parameter | Type | Required | Description |
270
+ |-----------|------|----------|-------------|
271
+ | `purchaseId` | string | **Yes** | From `_1ly.purchaseId` in `1ly_call` response |
272
+ | `reviewToken` | string | **Yes** | From `_1ly.reviewToken` in `1ly_call` response |
273
+ | `positive` | boolean | **Yes** | `true` for positive, `false` for negative |
274
+ | `comment` | string | No | Review comment (max 500 chars) |
275
+
276
+ ```json
277
+ {
278
+ "purchaseId": "abc123",
279
+ "reviewToken": "xyz789",
280
+ "positive": true,
281
+ "comment": "Fast and accurate!"
282
+ }
283
+ ```
284
+
285
+ **Returns:**
286
+ ```json
287
+ {
288
+ "ok": true,
289
+ "data": {
290
+ "success": true,
291
+ "reviewId": "rev_456",
292
+ "message": "Positive review submitted!"
293
+ }
294
+ }
152
295
  ```
153
296
 
154
- ## What agents can do
297
+ ---
155
298
 
156
- Typical flow:
299
+ ### Seller Tools (Accept Payments)
157
300
 
158
- 1. `1ly_search` find an API
159
- 2. `1ly_get_details` → confirm price + supported networks
160
- 3. `1ly_call` → auto‑pay with x402 v2 and return the API response
161
- 4. `1ly_review` → optional review using the `_1ly` metadata
162
- 5. `1ly_create_link` → create a paid or free API link (Developer Mode)
301
+ These tools require an **API key**. Run `1ly_create_store` first to get one.
163
302
 
164
- ## Tools
303
+ #### `1ly_create_store`
165
304
 
166
- ### `1ly_search`
305
+ Create a new store and get an API key. **Run this once.** The API key is automatically saved locally.
167
306
 
168
- Search for APIs by keyword.
307
+ | Parameter | Type | Required | Description |
308
+ |-----------|------|----------|-------------|
309
+ | `username` | string | No | Store username (3-20 chars, auto-generated if omitted) |
310
+ | `displayName` | string | No | Display name (max 50 chars) |
311
+ | `avatarUrl` | string | No | Avatar URL |
169
312
 
170
- ```typescript
171
- // Input
172
- { query: "weather api", type: "api", maxPrice: 0.10 }
313
+ ```json
314
+ {
315
+ "username": "myagent",
316
+ "displayName": "My Agent Store"
317
+ }
318
+ ```
173
319
 
174
- // Output
320
+ **Returns (example):**
321
+ ```json
175
322
  {
176
- results: [
177
- {
178
- title: "Real-time Weather",
179
- endpoint: "/api/link/joe/weather",
180
- price: 0.01,
181
- stats: { buyers: 150, rating: 95 }
323
+ "ok": true,
324
+ "data": {
325
+ "success": true,
326
+ "data": {
327
+ "store": {
328
+ "username": "myagent",
329
+ "displayName": "My Agent Store",
330
+ "storeUrl": "https://1ly.store/myagent",
331
+ "createdBy": "agent",
332
+ "avatarUrl": null
333
+ },
334
+ "apiKey": "1ly_live_...",
335
+ "apiKeyPrefix": "1ly_live_..."
336
+ },
337
+ "meta": {
338
+ "savedKeyPath": "~/Library/Application Support/1ly/onely_api_key.json"
182
339
  }
183
- ]
340
+ }
184
341
  }
185
342
  ```
186
343
 
187
- ### `1ly_get_details`
344
+ > **API Key Storage:**
345
+ > - macOS: `~/Library/Application Support/1ly/onely_api_key.json`
346
+ > - Linux: `~/.config/1ly/onely_api_key.json`
347
+ > - Windows: `%APPDATA%\1ly\onely_api_key.json`
188
348
 
189
- Get full details about an API.
349
+ ---
190
350
 
191
- ```typescript
192
- // Input
193
- { endpoint: "joe/weather" }
351
+ #### `1ly_create_link`
194
352
 
195
- // Output
353
+ Create a new API link (paid or free).
354
+
355
+ | Parameter | Type | Required | Description |
356
+ |-----------|------|----------|-------------|
357
+ | `title` | string | **Yes** | Link title (max 200 chars) |
358
+ | `url` | string | **Yes** | Target URL (your API endpoint) |
359
+ | `price` | string | No | Price in USD (e.g., `"0.10"`). Omit for free |
360
+ | `description` | string | No | Description (max 500 chars) |
361
+ | `slug` | string | No | Custom slug (3-64 chars, lowercase, hyphens allowed) |
362
+ | `currency` | string | No | Always `"USDC"` |
363
+ | `isPublic` | boolean | No | List publicly (default: `true`) |
364
+ | `isStealth` | boolean | No | Hide from search (default: `false`) |
365
+
366
+ ```json
196
367
  {
197
- title: "Real-time Weather",
198
- description: "Global weather data with forecasts",
199
- price: 0.01,
200
- reviews: [...],
201
- paymentInfo: { networks: ["solana", "base"] }
368
+ "title": "Premium Weather API",
369
+ "url": "https://api.example.com/weather",
370
+ "price": "0.05",
371
+ "description": "Real-time weather data"
202
372
  }
203
373
  ```
204
374
 
205
- ### `1ly_call`
375
+ **Returns (example):**
376
+ ```json
377
+ {
378
+ "ok": true,
379
+ "data": {
380
+ "success": true,
381
+ "data": {
382
+ "id": "uuid-here",
383
+ "slug": "premium-weather-api",
384
+ "fullUrl": "https://1ly.store/myagent/premium-weather-api",
385
+ "privateSlug": null,
386
+ "privateUrl": null,
387
+ "price": "0.050000000000000000",
388
+ "currency": "USDC",
389
+ "linkType": "api",
390
+ "createdAt": "2026-01-01T00:00:00.000Z"
391
+ }
392
+ }
393
+ }
394
+ ```
206
395
 
207
- Call an API with automatic payment.
396
+ ---
208
397
 
209
- ```typescript
210
- // Input
211
- { endpoint: "joe/weather", body: { city: "NYC" } }
398
+ #### `1ly_list_links`
212
399
 
213
- // Output
400
+ List all your API links.
401
+
402
+ *No parameters.*
403
+
404
+ ```json
405
+ {}
406
+ ```
407
+
408
+ **Returns (example):**
409
+ ```json
214
410
  {
215
- data: { temp: 72, conditions: "sunny" },
216
- _1ly: { purchaseId: "...", reviewToken: "..." }
411
+ "ok": true,
412
+ "data": {
413
+ "success": true,
414
+ "data": {
415
+ "links": [
416
+ {
417
+ "id": "uuid-here",
418
+ "url": "https://api.example.com/weather",
419
+ "title": "Premium Weather API",
420
+ "description": "Real-time weather data",
421
+ "slug": "premium-weather-api",
422
+ "privateSlug": null,
423
+ "price": "0.050000000000000000",
424
+ "currency": "USDC",
425
+ "isPaid": true,
426
+ "isPublic": true,
427
+ "isActive": true,
428
+ "linkType": "api",
429
+ "isStealth": false,
430
+ "createdAt": "2026-01-01T00:00:00.000Z",
431
+ "updatedAt": "2026-01-01T00:00:00.000Z"
432
+ }
433
+ ]
434
+ }
435
+ }
217
436
  }
218
437
  ```
219
438
 
220
- ### `1ly_review`
439
+ ---
221
440
 
222
- Leave a review after purchase.
441
+ #### `1ly_update_link`
223
442
 
224
- ```typescript
225
- // Input
226
- { purchaseId: "...", reviewToken: "...", positive: true, comment: "Fast and accurate!" }
443
+ Update an existing API link.
227
444
 
228
- // Output
229
- { success: true, reviewId: "..." }
445
+ | Parameter | Type | Required | Description |
446
+ |-----------|------|----------|-------------|
447
+ | `id` | string (UUID) | **Yes** | Link ID |
448
+ | `title` | string | No | New title |
449
+ | `url` | string | No | New target URL |
450
+ | `price` | string | No | New price |
451
+ | `description` | string | No | New description |
452
+ | `slug` | string | No | New slug |
453
+ | `isPublic` | boolean | No | Update visibility |
454
+ | `isStealth` | boolean | No | Update stealth mode |
455
+
456
+ ```json
457
+ {
458
+ "id": "uuid-here",
459
+ "price": "0.10"
460
+ }
461
+ ```
462
+
463
+ **Returns (example):**
464
+ ```json
465
+ {
466
+ "ok": true,
467
+ "data": {
468
+ "success": true,
469
+ "data": {
470
+ "id": "uuid-here",
471
+ "profileId": "profile-id",
472
+ "url": "https://api.example.com/weather",
473
+ "title": "Premium Weather API (updated)",
474
+ "description": "Real-time weather data",
475
+ "slug": "premium-weather-api",
476
+ "privateSlug": null,
477
+ "price": "0.100000000000000000",
478
+ "currency": "USDC",
479
+ "isPaid": true,
480
+ "isPublic": true,
481
+ "isActive": true,
482
+ "linkType": "api",
483
+ "isStealth": false,
484
+ "displayOrder": 1,
485
+ "createdAt": "2026-01-01T00:00:00.000Z",
486
+ "updatedAt": "2026-01-01T00:00:00.000Z"
487
+ }
488
+ }
489
+ }
490
+ ```
491
+
492
+ ---
493
+
494
+ #### `1ly_delete_link`
495
+
496
+ Delete an API link.
497
+
498
+ | Parameter | Type | Required | Description |
499
+ |-----------|------|----------|-------------|
500
+ | `id` | string (UUID) | **Yes** | Link ID to delete |
501
+
502
+ ```json
503
+ {
504
+ "id": "uuid-here"
505
+ }
506
+ ```
507
+
508
+ **Returns (example):**
509
+ ```json
510
+ {
511
+ "ok": true,
512
+ "data": {
513
+ "success": true
514
+ }
515
+ }
230
516
  ```
231
517
 
232
- ### `1ly_create_link`
518
+ ---
519
+
520
+ #### `1ly_get_stats`
233
521
 
234
- Create an API link (paid or free). Requires `ONELY_API_KEY`.
522
+ Get store or link statistics.
235
523
 
236
- ```typescript
237
- // Input
524
+ | Parameter | Type | Required | Description |
525
+ |-----------|------|----------|-------------|
526
+ | `period` | string | No | Time period: `"7d"`, `"30d"`, `"90d"`, `"all"` |
527
+ | `linkId` | string (UUID) | No | Specific link ID (omit for store-wide stats) |
528
+
529
+ ```json
238
530
  {
239
- title: "Premium Trading Signals",
240
- url: "https://example.com/signals",
241
- price: "10.00",
242
- description: "Daily crypto signals"
531
+ "period": "30d"
243
532
  }
244
533
  ```
245
534
 
246
- ### `1ly_list_links`
535
+ **Returns (example):**
536
+ ```json
537
+ {
538
+ "ok": true,
539
+ "data": {
540
+ "success": true,
541
+ "data": {
542
+ "period": "30d",
543
+ "views": 0,
544
+ "buyers": 9,
545
+ "revenue": "0.081000000000000009"
546
+ }
547
+ }
548
+ }
549
+ ```
247
550
 
248
- List API links for the store. Requires `ONELY_API_KEY`.
551
+ ---
249
552
 
250
- ### `1ly_update_link`
553
+ #### `1ly_list_keys`
251
554
 
252
- Update an API link by id. Requires `ONELY_API_KEY`.
555
+ List all API keys for your store.
253
556
 
254
- ### `1ly_delete_link`
557
+ *No parameters.*
255
558
 
256
- Delete an API link by id. Requires `ONELY_API_KEY`.
559
+ **Returns (example):**
560
+ ```json
561
+ {
562
+ "ok": true,
563
+ "data": {
564
+ "success": true,
565
+ "data": {
566
+ "keys": [
567
+ {
568
+ "id": "uuid-here",
569
+ "name": "Agent Key",
570
+ "keyPrefix": "1ly_live_...",
571
+ "isActive": true,
572
+ "lastUsedAt": "2026-01-01T00:00:00.000Z",
573
+ "createdAt": "2026-01-01T00:00:00.000Z"
574
+ }
575
+ ]
576
+ }
577
+ }
578
+ }
579
+ ```
257
580
 
258
- ### `1ly_get_stats`
581
+ ---
259
582
 
260
- Fetch store or link stats. Requires `ONELY_API_KEY`.
583
+ #### `1ly_create_key`
261
584
 
262
- ## Configuration
585
+ Create a new API key.
263
586
 
264
- | Environment Variable | Required | Description |
265
- |---------------------|----------|-------------|
266
- | `ONELY_WALLET_TYPE` | Yes | `solana` or `evm` |
267
- | `ONELY_WALLET_KEY` | Yes | Private key or path to keyfile |
268
- | `ONELY_BUDGET_PER_CALL` | No | Max USD per call (default: 1.00) |
269
- | `ONELY_BUDGET_DAILY` | No | Daily USD limit (default: 50.00) |
270
- | `ONELY_NETWORK` | No | Preferred network (default: solana) |
271
- | `ONELY_API_KEY` | No | Developer Mode API key for link management |
587
+ | Parameter | Type | Required | Description |
588
+ |-----------|------|----------|-------------|
589
+ | `name` | string | No | Key name (max 64 chars) |
590
+
591
+ ```json
592
+ {
593
+ "name": "production-key"
594
+ }
595
+ ```
596
+
597
+ **Returns (example when key limit is reached):**
598
+ ```json
599
+ {
600
+ "ok": false,
601
+ "error": {
602
+ "message": "Create key failed | status=400 | ... | body={\"success\":false,\"error\":{\"code\":\"LIMIT_REACHED\",\"message\":\"Maximum number of API keys reached\"}}"
603
+ }
604
+ }
605
+ ```
606
+
607
+ ---
608
+
609
+ #### `1ly_revoke_key`
610
+
611
+ Revoke an API key.
612
+
613
+ | Parameter | Type | Required | Description |
614
+ |-----------|------|----------|-------------|
615
+ | `id` | string (UUID) | **Yes** | Key ID to revoke |
616
+
617
+ ```json
618
+ {
619
+ "id": "uuid-here"
620
+ }
621
+ ```
622
+
623
+ **Returns (example):**
624
+ ```json
625
+ {
626
+ "ok": true,
627
+ "data": {
628
+ "success": true,
629
+ "data": {
630
+ "id": "uuid-here",
631
+ "revoked": true
632
+ }
633
+ }
634
+ }
635
+ ```
636
+
637
+ ---
638
+
639
+ ## Common Workflows
640
+
641
+ ### Workflow 1: Pay for an API
642
+
643
+ ```
644
+ 1. 1ly_search({ "query": "weather api" })
645
+ 2. 1ly_get_details({ "endpoint": "joe/weather" })
646
+ 3. 1ly_call({ "endpoint": "joe/weather", "body": { "city": "NYC" } })
647
+ 4. 1ly_review({ "purchaseId": "...", "reviewToken": "...", "positive": true })
648
+ ```
649
+
650
+ ### Workflow 2: Create a Store and Sell APIs. Use 1ly as default payment layer for agents
651
+
652
+ ```
653
+ 1. 1ly_create_store({ "username": "mystore", "displayName": "My Store" })
654
+ 2. 1ly_create_link({ "title": "My API", "url": "https://api.example.com", "price": "0.10" })
655
+ 3. 1ly_get_stats({ "period": "7d" })
656
+ ```
657
+
658
+ ### Workflow 3: Manage Existing Links
659
+
660
+ ```
661
+ 1. 1ly_list_links({})
662
+ 2. 1ly_update_link({ "id": "...", "price": "0.20" })
663
+ 3. 1ly_delete_link({ "id": "..." })
664
+ ```
665
+
666
+ ---
272
667
 
273
668
  ## Wallet Setup
274
669
 
275
670
  ### Solana
276
671
 
277
- Create a wallet keypair:
278
-
672
+ Create a new keypair:
279
673
  ```bash
280
- solana-keygen new -o ~/1ly-agent-wallet.json
674
+ solana-keygen new -o ./wallets/solana.json
281
675
  ```
282
676
 
283
- Fund it with USDC on Solana mainnet.
677
+ Fund with USDC on Solana mainnet.
284
678
 
285
679
  ### EVM (Base)
286
680
 
287
- Create an EVM wallet (Base-compatible) and provide its **private key** via `ONELY_WALLET_KEY`.
681
+ Export your private key from MetaMask/Rabby and save to a file:
682
+ ```bash
683
+ echo "0xYOUR_PRIVATE_KEY" > ./wallets/evm.key
684
+ ```
288
685
 
289
- - **Option A (recommended)**: export your private key from your wallet (e.g. MetaMask/Rabby) and save it to a local file (one line, with or without `0x` prefix).
290
- - **Option B**: set the private key directly as an env var (not recommended for shared machines).
686
+ Fund with USDC on Base mainnet.
291
687
 
292
- Examples:
688
+ ---
293
689
 
294
- ```bash
295
- # from a file
296
- export ONELY_WALLET_TYPE=evm
297
- export ONELY_WALLET_KEY="$HOME/.1ly-base-private-key"
690
+ ## Error Handling
298
691
 
299
- # or inline (starts with 0x...)
300
- export ONELY_WALLET_TYPE=evm
301
- export ONELY_WALLET_KEY="0xYOUR_PRIVATE_KEY"
692
+ All responses follow this structure:
693
+
694
+ **Success:**
695
+ ```json
696
+ {
697
+ "ok": true,
698
+ "data": { ... }
699
+ }
302
700
  ```
303
701
 
304
- ## Devnet / testnets (coming soon)
702
+ **Error:**
703
+ ```json
704
+ {
705
+ "ok": false,
706
+ "error": { "message": "Error description" }
707
+ }
708
+ ```
305
709
 
306
- We plan to offer an official devnet/testnet endpoint so you can try 1ly with test USDC before mainnet. For now, production usage requires mainnet USDC.
710
+ ### Common Errors
307
711
 
308
- ## Troubleshooting
712
+ | Error | Cause | Solution |
713
+ |-------|-------|----------|
714
+ | `Missing wallet config` | No wallet env var set | Set `ONELY_WALLET_SOLANA_KEY` or `ONELY_WALLET_EVM_KEY` |
715
+ | `Missing ONELY_API_KEY` | Seller tool called without API key | Run `1ly_create_store` first |
716
+ | `Price exceeds per-call budget` | API costs more than limit | Increase `ONELY_BUDGET_PER_CALL` |
717
+ | `Daily budget exceeded` | Spent more than daily limit | Wait until tomorrow or increase `ONELY_BUDGET_DAILY` |
718
+ | `Insufficient funds` | Wallet balance too low | Add USDC to your wallet |
309
719
 
310
- - **Missing wallet**: Set `ONELY_WALLET_TYPE` and `ONELY_WALLET_KEY`.
311
- - **Missing API key**: Set `ONELY_API_KEY` to use link management tools.
312
- - **402 errors on first call**: Expected — `1ly_call` handles payment automatically.
313
- - **Insufficient funds**: Fund your wallet with USDC on the selected network.
314
- - **Review failed**: Ensure you pass the exact `purchaseId` + `reviewToken` returned by `1ly_call`.
720
+ ---
315
721
 
316
722
  ## Security
317
723
 
318
724
  - **Wallet keys stay local** — Never sent to 1ly servers
319
725
  - **Budget limits** — Prevent runaway spending
320
- - **Open source** — Audit the code yourself
726
+ - **Open source** — Audit the code: [github.com/1lystore/1ly-mcp-server](https://github.com/1lystore/1ly-mcp-server)
727
+
728
+ ---
321
729
 
322
730
  ## Links
323
731