apiosk-mcp 1.3.0__tar.gz

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.
@@ -0,0 +1,610 @@
1
+ Metadata-Version: 2.4
2
+ Name: apiosk-mcp
3
+ Version: 1.3.0
4
+ Summary: PyPI launcher for the official Apiosk MCP server
5
+ Author: Apiosk
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://apiosk.com
8
+ Project-URL: Repository, https://github.com/obcraft/apiosk-mcp
9
+ Project-URL: Issues, https://github.com/obcraft/apiosk-mcp/issues
10
+ Keywords: apiosk,mcp,model-context-protocol,x402,agent-tools,payments
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Internet
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+
21
+ # Apiosk MCP Server
22
+
23
+ Official MCP server for discovering, paying for, and publishing Apiosk APIs.
24
+
25
+ ## Quick Start
26
+
27
+ ### Package names
28
+
29
+ The scoped npm package is the canonical client SDK package:
30
+
31
+ ```bash
32
+ npm install @apiosk/mcp
33
+ ```
34
+
35
+ It exposes the same CLI binaries as the legacy package:
36
+
37
+ ```bash
38
+ npx -y @apiosk/mcp
39
+ apiosk-mcp
40
+ apiosk-mcp-server
41
+ apiosk
42
+ ```
43
+
44
+ The previous public package name, `apiosk-mcp-server`, remains supported as a
45
+ compatibility install path for existing MCP client configs.
46
+
47
+ For MCP registry submission forms, use:
48
+
49
+ - npm Package: `@apiosk/mcp`
50
+ - PyPI Package: `apiosk-mcp`
51
+ - Short Description: `Discover, pay for, execute, and publish Apiosk APIs through MCP.`
52
+
53
+ The PyPI package is a launcher for the canonical npm package, so `uvx
54
+ apiosk-mcp` starts the same MCP server as `npx -y @apiosk/mcp`.
55
+
56
+ ### Local stdio package
57
+
58
+ ```bash
59
+ npx -y @apiosk/mcp
60
+ ```
61
+
62
+ Python/uv users can install through PyPI:
63
+
64
+ ```bash
65
+ uvx apiosk-mcp
66
+ ```
67
+
68
+ The PyPI launcher requires Node.js 20+ and `npx` on `PATH`. By default it runs
69
+ `npx -y @apiosk/mcp@1.3.0`; set `APIOSK_MCP_NPM_PACKAGE=@apiosk/mcp@next` to
70
+ override the npm package spec.
71
+
72
+ ### Publishing packages
73
+
74
+ From this `mcp/` directory:
75
+
76
+ ```bash
77
+ npm run pack:check
78
+ npm publish --access public
79
+ ```
80
+
81
+ ```bash
82
+ python3 -m pip install --upgrade build twine
83
+ python3 -m build
84
+ python3 -m twine upload dist/apiosk_mcp-1.3.0*
85
+ ```
86
+
87
+ After both uploads are live, the MCP registry package fields are:
88
+
89
+ ```text
90
+ npm Package: @apiosk/mcp
91
+ PyPI Package: apiosk-mcp
92
+ Short Description: Discover, pay for, execute, and publish Apiosk APIs through MCP.
93
+ ```
94
+
95
+ ### With automatic x402 payments from an env wallet
96
+
97
+ ```bash
98
+ APIOSK_PRIVATE_KEY=0x... npx -y @apiosk/mcp
99
+ ```
100
+
101
+ ### With dashboard-managed access
102
+
103
+ ```bash
104
+ APIOSK_CONNECT_TOKEN=... npx -y @apiosk/mcp
105
+ ```
106
+
107
+ After the MCP server is installed in Claude, Codex, or another client, the fastest first-run path in local stdio mode is:
108
+
109
+ ```json
110
+ { "wallet_label": "My Apiosk wallet" }
111
+ ```
112
+
113
+ Call that through `apiosk_get_started`. It will create a local wallet when needed, or you can pass `connect_string` to save managed access locally and immediately run a discovery probe plus a small test call.
114
+
115
+ ## Local Wallet Mode
116
+
117
+ The local stdio package exposes wallet tools that let Claude or Codex:
118
+
119
+ - create or import a wallet
120
+ - show the wallet address
121
+ - select the active wallet used for paid calls
122
+ - reveal or save the private key when the user explicitly asks
123
+ - publish and manage APIs without opening the dashboard
124
+
125
+ The active wallet is mirrored to:
126
+
127
+ - `~/.apiosk/wallet.json`
128
+ - `~/.apiosk/wallet.txt`
129
+
130
+ so older Apiosk scripts can reuse it.
131
+
132
+ ## Agent Configuration
133
+
134
+ ### Claude Desktop
135
+
136
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "apiosk": {
142
+ "command": "npx",
143
+ "args": ["-y", "@apiosk/mcp"]
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Cursor
150
+
151
+ ```json
152
+ {
153
+ "mcpServers": {
154
+ "apiosk": {
155
+ "command": "npx",
156
+ "args": ["-y", "@apiosk/mcp"]
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### Windsurf
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "apiosk": {
168
+ "command": "npx",
169
+ "args": ["-y", "@apiosk/mcp"]
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ ### Claude Code
176
+
177
+ Remote HTTP:
178
+
179
+ ```bash
180
+ claude mcp add --transport http apiosk https://mcp.apiosk.com/mcp
181
+ ```
182
+
183
+ Local stdio:
184
+
185
+ ```json
186
+ {
187
+ "mcpServers": {
188
+ "apiosk": {
189
+ "command": "npx",
190
+ "args": ["-y", "@apiosk/mcp"]
191
+ }
192
+ }
193
+ }
194
+ ```
195
+
196
+ ### Cline / Continue / Goose
197
+
198
+ ```json
199
+ {
200
+ "mcpServers": {
201
+ "apiosk": {
202
+ "command": "npx",
203
+ "args": ["-y", "@apiosk/mcp"]
204
+ }
205
+ }
206
+ }
207
+ ```
208
+
209
+ ### Using a local checkout
210
+
211
+ ```json
212
+ {
213
+ "mcpServers": {
214
+ "apiosk": {
215
+ "command": "node",
216
+ "args": ["/full/path/to/apiosk-mcp/index.mjs"]
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ### ChatGPT and other remote MCP apps
223
+
224
+ Use the hosted MCP endpoint:
225
+
226
+ ```text
227
+ https://mcp.apiosk.com/mcp
228
+ ```
229
+
230
+ Protected tools on the hosted server use OAuth. The remote MCP surface is fully
231
+ capable — discovery, payment guidance, generic **and** dynamic per-API
232
+ execution, prepaid credits, and managed agent-wallet CRUD. Public tools
233
+ (discovery + guidance) work before authorization; paid execution and managed
234
+ tools require OAuth. Publishing stays local/portal-only because it needs a
235
+ client-side signing key the hosted server never holds.
236
+
237
+ ## Provider MCP Monetization
238
+
239
+ If you own an MCP server and want to sell its tools through Apiosk, keep payment
240
+ logic out of your MCP. Apiosk is the paid edge.
241
+
242
+ Provider requirements:
243
+
244
+ - Host your MCP over HTTPS, for example `https://tools.example.com/mcp`.
245
+ - Support normal MCP `initialize`, `tools/list`, and `tools/call`.
246
+ - Keep tool names stable; imported tools become paid operation ids.
247
+ - Provide useful descriptions and JSON schemas; these become buyer-facing
248
+ discovery metadata.
249
+ - Protect the provider MCP with bearer auth or another upstream secret, then
250
+ configure Apiosk to inject that secret so buyers cannot bypass the gateway.
251
+
252
+ Provider portal flow:
253
+
254
+ 1. Open the provider portal and choose `Import MCP`.
255
+ 2. Enter the MCP URL and optional bearer token.
256
+ 3. Apiosk scans `tools/list` and creates one paid action per selected tool.
257
+ 4. Review tool paths, schemas, descriptions, and per-call prices.
258
+ 5. Publish the draft after linking a payout wallet.
259
+
260
+ Buyer-facing surfaces after publish:
261
+
262
+ - Hosted Apiosk MCP: `https://mcp.apiosk.com/mcp`
263
+ - Catalog search: `https://gateway.apiosk.com/v1/apis?search=<slug>`
264
+ - Metadata: `GET https://gateway.apiosk.com/<slug>/metadata`
265
+ - Execution: `POST https://gateway.apiosk.com/<slug>/execute`
266
+
267
+ The traffic path is:
268
+
269
+ ```text
270
+ buyer agent -> Apiosk MCP/gateway -> payment rail -> provider MCP tools/call
271
+ ```
272
+
273
+ The provider MCP should reject direct unauthenticated traffic, but it should not
274
+ return `402 Payment Required` or inspect `X-Payment`. Payment challenges,
275
+ credits, x402 proof verification, and revenue splits are handled by Apiosk.
276
+
277
+ ## Available Tools
278
+
279
+ Static tools:
280
+
281
+ - `apiosk_help`
282
+ - `apiosk_payment_guide` — buyer + provider guide for paying through and publishing on the gateway
283
+ - `apiosk_explore`
284
+ - `apiosk_search`
285
+ - `apiosk_get_api`
286
+ - `apiosk_execute`
287
+
288
+ Hosted remote MCP tools (in addition to dynamic per-API tools):
289
+
290
+ - Discovery / guidance: `apiosk_help`, `apiosk_payment_guide`, `apiosk_search`, `apiosk_explore`, `apiosk_get_api`, `apiosk_metadata`, `apiosk_execute`, `apiosk_health`
291
+ - Prepaid credits: `apiosk_buy_credits`, `apiosk_get_credits_status`
292
+ - Managed wallets: `apiosk_list_wallets`, `apiosk_create_wallet`, `apiosk_update_wallet`, `apiosk_delete_wallet`, `apiosk_get_wallet_activity`, `apiosk_create_wallet_connect_string`, `apiosk_list_wallet_api_keys`, `apiosk_create_wallet_api_key`, `apiosk_update_wallet_api_key`, `apiosk_delete_wallet_api_key`
293
+
294
+ Local wallet tools in stdio mode:
295
+
296
+ - `apiosk_get_started`
297
+ - `apiosk_wallet_list`
298
+ - `apiosk_wallet_create`
299
+ - `apiosk_configure`
300
+ - `apiosk_wallet_select`
301
+ - `apiosk_wallet_update`
302
+ - `apiosk_wallet_delete`
303
+ - `apiosk_wallet_reveal_secret`
304
+ - `apiosk_wallet_save_secret`
305
+
306
+ Publish tools in stdio mode:
307
+
308
+ - `apiosk_publish_api`
309
+ - `apiosk_list_my_apis`
310
+ - `apiosk_update_api`
311
+ - `apiosk_delete_api`
312
+
313
+ Optional dashboard-managed wallet tools:
314
+
315
+ - `apiosk_list_wallets`
316
+ - `apiosk_create_wallet`
317
+ - `apiosk_update_wallet`
318
+ - `apiosk_delete_wallet`
319
+ - `apiosk_get_wallet_activity`
320
+ - `apiosk_create_wallet_connect_string`
321
+ - `apiosk_list_wallet_api_keys`
322
+ - `apiosk_create_wallet_api_key`
323
+ - `apiosk_update_wallet_api_key`
324
+ - `apiosk_delete_wallet_api_key`
325
+
326
+ Dynamic tools:
327
+
328
+ - local stdio mode still generates one dynamic tool per active Apiosk API slug from listing metadata
329
+
330
+ ## Examples
331
+
332
+ ### Explore
333
+
334
+ ```json
335
+ {}
336
+ ```
337
+
338
+ ```json
339
+ { "listing_type": "dataset", "search": "weather", "limit": 5 }
340
+ ```
341
+
342
+ ### Search
343
+
344
+ ```json
345
+ { "search": "diff", "limit": 5 }
346
+ ```
347
+
348
+ Search, explore, and `apiosk_get_api` responses now embed a `payment` block that
349
+ tells the agent exactly how to settle a paid call given the current auth — so an
350
+ agent that finds, say, a weather API immediately knows whether it can pay and
351
+ what to do next.
352
+
353
+ ### Payment guide (buyer + provider)
354
+
355
+ ```json
356
+ {}
357
+ ```
358
+
359
+ ```json
360
+ { "role": "provider" }
361
+ ```
362
+
363
+ ```json
364
+ { "role": "buyer", "slug": "weather-now" }
365
+ ```
366
+
367
+ Returns a buyer guide (USDC/x402 or credits — tailored to the configured auth)
368
+ and a provider guide (how to publish an API and get paid). Pass `slug` to scope
369
+ buyer guidance to one listing, or `role` to pick a side.
370
+
371
+ ### Create a local wallet
372
+
373
+ ```json
374
+ { "label": "Claude wallet" }
375
+ ```
376
+
377
+ The create response includes:
378
+
379
+ - the wallet address
380
+ - Base funding instructions
381
+ - a QR image URL
382
+ - a terminal QR block when QR rendering is enabled
383
+ - a structured Apiosk control menu with wallet, funding, pay, publish, security, and local-data sections
384
+
385
+ ### Get started in one step
386
+
387
+ Create a local wallet automatically, discover the catalog, and run a test call:
388
+
389
+ ```json
390
+ {
391
+ "wallet_label": "Starter wallet",
392
+ "test_slug": "agent-json-diff",
393
+ "test_input": {
394
+ "before": { "ok": true },
395
+ "after": { "ok": false }
396
+ }
397
+ }
398
+ ```
399
+
400
+ Or save a dashboard-managed connect string locally and verify it:
401
+
402
+ ```json
403
+ {
404
+ "connect_string": "export APIO_GATEWAY_URL=https://gateway.apiosk.com\nexport APIO_CHAIN_ID=8453\nexport APIO_AGENT_WALLET_ADDRESS=0x...\nexport APIO_CONNECT_TOKEN=aw_...\nexport APIO_CONNECT_AUTHORIZATION=Bearer aw_...\nexport APIO_CONNECT_HEADER_NAME=X-Apiosk-Connect-Token",
405
+ "test_slug": "agent-json-diff",
406
+ "test_input": {
407
+ "before": { "ok": true },
408
+ "after": { "ok": false }
409
+ },
410
+ "create_wallet": false
411
+ }
412
+ ```
413
+
414
+ The connect string identifies the buyer's managed wallet and connect token. The
415
+ `APIO_WALLET_*` limits bound the USDC (x402) rail. The same connect token also
416
+ settles over prepaid credits when USDC is unavailable — the gateway picks the
417
+ rail per call. Call `apiosk_help` with `topic="rails"` for the full settlement
418
+ model.
419
+
420
+ ### Open the configure menu
421
+
422
+ ```json
423
+ { "section": "funding" }
424
+ ```
425
+
426
+ ```json
427
+ { "wallet_id": "...", "section": "funding", "funding_provider": "onramper" }
428
+ ```
429
+
430
+ ### Save a secret key backup
431
+
432
+ ```json
433
+ { "wallet_id": "..." }
434
+ ```
435
+
436
+ ### Publish an API
437
+
438
+ ```json
439
+ {
440
+ "name": "My Weather API",
441
+ "slug": "my-weather-api",
442
+ "endpoint_url": "https://example.com",
443
+ "price_usd": 0.01,
444
+ "description": "Real-time weather data",
445
+ "listing_group": "datasets"
446
+ }
447
+ ```
448
+
449
+ ### Generic execute
450
+
451
+ ```json
452
+ {
453
+ "slug": "agent-json-diff",
454
+ "input": {
455
+ "before": { "ok": true },
456
+ "after": { "ok": false }
457
+ }
458
+ }
459
+ ```
460
+
461
+ ### Dynamic tool call (local stdio only)
462
+
463
+ If the server lists a dynamic tool named `agent-json-diff`, call it directly:
464
+
465
+ ```json
466
+ {
467
+ "before": { "ok": true },
468
+ "after": { "ok": false }
469
+ }
470
+ ```
471
+
472
+ ## MacBook Air Test Script
473
+
474
+ Run the safe default suite from a repo checkout:
475
+
476
+ ```bash
477
+ cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
478
+ npm run test:macbook-air
479
+ ```
480
+
481
+ Default coverage:
482
+
483
+ - runs `npm test`
484
+ - runs the isolated fresh-environment smoke test
485
+ - starts a local HTTP MCP server in a temp `APIOSK_HOME`
486
+ - verifies `health`, `tools/list`, `apiosk_search`, `apiosk_explore`, and `apiosk_get_api`
487
+ - creates a wallet, checks funding QR/configure output, and verifies secret export plus `wallet.json` and `wallet.txt`
488
+ - verifies the hosted Fly deployment, OAuth metadata, protected-resource metadata, public discovery, and the unauthenticated OAuth challenge for protected tools
489
+
490
+ Useful options:
491
+
492
+ - `TARGET=local` to skip hosted checks
493
+ - `TARGET=hosted` to skip local checks
494
+ - `APIOSK_RUN_REMOTE_WALLET_TEST=1 APIOSK_MCP_BEARER_TOKEN=...` to verify an authenticated protected hosted call after the unauthenticated challenge check
495
+ - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_TEST_PRIVATE_KEY=0x...` to import a funded wallet and run a real paid execute test
496
+ - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_MCP_BEARER_TOKEN=... TARGET=hosted` to run a real paid execute test through the hosted OAuth path
497
+ - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_RUN_PUBLISH_TEST=1 APIOSK_TEST_PRIVATE_KEY=0x... TARGET=local` to also test publish, list, update, and delete with a temporary listing
498
+
499
+ Example funded run:
500
+
501
+ ```bash
502
+ cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
503
+ APIOSK_RUN_FUNDED_TESTS=1 \
504
+ APIOSK_TEST_PRIVATE_KEY=0x... \
505
+ npm run test:macbook-air
506
+ ```
507
+
508
+ ## Live URL Test Script
509
+
510
+ Run a hosted-only test directly against the public MCP endpoint:
511
+
512
+ ```bash
513
+ cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
514
+ npm run test:live
515
+ ```
516
+
517
+ Default live coverage:
518
+
519
+ - checks `https://mcp.apiosk.com/health`
520
+ - verifies the hosted tool surface
521
+ - verifies `/.well-known/oauth-authorization-server`
522
+ - verifies `/.well-known/oauth-protected-resource/mcp`
523
+ - runs live `apiosk_explore`, `apiosk_metadata`, and `apiosk_health`
524
+ - verifies that an unauthenticated protected MCP tool call returns the expected OAuth `401` challenge
525
+
526
+ Optional live funded checks:
527
+
528
+ - `APIOSK_RUN_REMOTE_WALLET_TEST=1 APIOSK_MCP_BEARER_TOKEN=... npm run test:live`
529
+ - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_MCP_BEARER_TOKEN=... npm run test:live`
530
+
531
+ The live hosted suite no longer imports a private key into the hosted MCP. Protected live checks now rely on a real hosted OAuth bearer token, which matches the ChatGPT-style remote MCP flow.
532
+
533
+ ## Environment Variables
534
+
535
+ - `APIOSK_PRIVATE_KEY`: enables automatic x402 settlement and signed publish requests
536
+ - `APIOSK_CONNECT_TOKEN`: attach a dashboard-managed connect token
537
+ - `APIOSK_CONNECT_AUTHORIZATION`: attach a custom Authorization header
538
+ - `APIOSK_CONNECT_HEADER_NAME`: override the connect-token header name
539
+ - `APIOSK_WALLET_ADDRESS`: send a wallet address for wallet-aware flows
540
+ - `APIOSK_X_PAYMENT`: attach a pre-built x402 proof manually
541
+ - `APIOSK_GATEWAY`: override the gateway base URL
542
+ - `APIOSK_CONTROL_PLANE_URL`: override the MCP-owned control-plane API base URL used for account, credits, and managed-wallet routes. Defaults to `https://mcp.apiosk.com`
543
+ - `APIOSK_DASHBOARD_URL`: override the human-facing dashboard/app URL stored in local config and used in confirmation flows. Defaults to `https://dashboard.apiosk.com`
544
+ - `APIOSK_DASHBOARD_JWT` or `APIOSK_USER_JWT`: unlock dashboard wallet routes
545
+ - `APIOSK_ENABLE_LOCAL_WALLETS=true`: enable local wallet tools in HTTP server mode
546
+ - `APIOSK_MCP_OAUTH_SECRET` or `APIOSK_MCP_AUTH_SECRET`: signing secret for hosted OAuth codes, access tokens, and refresh tokens
547
+ - `APIOSK_MCP_BEARER_TOKEN`: optional hosted OAuth access token used by the live scripts for authenticated protected-tool checks
548
+ - `APIOSK_HOME`: override the default `~/.apiosk` directory
549
+ - `APIOSK_MCP_WALLET_STORE`: override the local wallet store path
550
+
551
+ ## Human-Funded Credits Flow
552
+
553
+ In the local stdio package, MCP can now help a human top up Apiosk credits and then let the agent spend those credits later:
554
+
555
+ 1. `apiosk_create_account` if the user needs a new Apiosk account
556
+ 2. `apiosk_sign_in` to store a local dashboard session token
557
+ 3. `apiosk_buy_credits` to create an Adyen checkout link
558
+ 4. `apiosk_get_credits_status` after payment to reconcile the top-up and confirm the balance
559
+
560
+ If signup does not return a session immediately, tell the user to confirm their email first and then call `apiosk_sign_in`.
561
+
562
+ These calls now target the MCP-owned control-plane surface by default:
563
+
564
+ - `https://mcp.apiosk.com/api/auth/mcp-sign-up`
565
+ - `https://mcp.apiosk.com/api/auth/mcp-sign-in`
566
+ - `https://mcp.apiosk.com/api/credits/topup`
567
+ - `https://mcp.apiosk.com/api/credits/reconcile`
568
+
569
+ ## Remote HTTP Server
570
+
571
+ The public HTTP deployment is safe-by-default: local wallet and publish tools are disabled unless `APIOSK_ENABLE_LOCAL_WALLETS=true` is set on that server.
572
+
573
+ Hosted OAuth metadata and authorization routes now live on the same host:
574
+
575
+ - `https://mcp.apiosk.com/.well-known/oauth-authorization-server`
576
+ - `https://mcp.apiosk.com/.well-known/oauth-protected-resource/mcp`
577
+ - `https://mcp.apiosk.com/authorize`
578
+ - `https://mcp.apiosk.com/token`
579
+ - `https://mcp.apiosk.com/register`
580
+
581
+ Test it:
582
+
583
+ ```bash
584
+ curl https://mcp.apiosk.com/health
585
+ ```
586
+
587
+ ```bash
588
+ curl https://mcp.apiosk.com/mcp \
589
+ -H "Content-Type: application/json" \
590
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
591
+ ```
592
+
593
+ ## Development
594
+
595
+ ```bash
596
+ npm install
597
+ npm run dev # HTTP server on :3000
598
+ node index.mjs # stdio mode with local wallet tools enabled
599
+ ```
600
+
601
+ Fresh-environment smoke test:
602
+
603
+ ```bash
604
+ cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
605
+ npm run smoke:new-env
606
+ ```
607
+
608
+ ## License
609
+
610
+ MIT