@apiosk/mcp 1.7.0 → 2.0.0

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 (100) hide show
  1. package/README.md +83 -612
  2. package/assets/brand/apiosk-a-20260921.png +0 -0
  3. package/assets/brand/apple-touch-icon.png +0 -0
  4. package/assets/brand/favicon-dark.ico +0 -0
  5. package/assets/brand/favicon-light.ico +0 -0
  6. package/assets/brand/favicon.ico +0 -0
  7. package/assets/brand/icon-192.png +0 -0
  8. package/assets/brand/icon-512.png +0 -0
  9. package/assets/brand/icon-maskable-512.png +0 -0
  10. package/assets/brand/inter-OFL.txt +93 -0
  11. package/assets/brand/inter-latin-400-normal.woff2 +0 -0
  12. package/assets/brand/inter-latin-500-normal.woff2 +0 -0
  13. package/assets/brand/inter-latin-600-normal.woff2 +0 -0
  14. package/assets/brand/mark-20260905-transparent.svg +1 -0
  15. package/assets/brand/mark-20260918.svg +1 -0
  16. package/assets/brand/mark-black-20260918.svg +1 -0
  17. package/assets/brand/mark-dark-20260905-transparent.png +0 -0
  18. package/assets/brand/mark-dark-20260918.png +0 -0
  19. package/assets/brand/mark-dark-96.png +0 -0
  20. package/assets/brand/mark-light-20260905-transparent.png +0 -0
  21. package/assets/brand/mark-light-20260918.png +0 -0
  22. package/assets/brand/mark-light-96.png +0 -0
  23. package/assets/brand/wordmark-black-320.png +0 -0
  24. package/assets/brand/wordmark-white-320.png +0 -0
  25. package/docs/branding.md +11 -0
  26. package/docs/marketplace-submission-2026-04-08.md +4 -0
  27. package/docs/marketplace-submission-2026-08-20.md +157 -0
  28. package/docs/openai-plugin-submission-2026-09-05.md +143 -0
  29. package/dxt.json +26 -22
  30. package/index.mjs +3 -1
  31. package/logo-optimized-light.png +0 -0
  32. package/package.json +14 -14
  33. package/plugin/apiosk/.codex-plugin/plugin.json +45 -0
  34. package/plugin/apiosk/.mcp.json +8 -0
  35. package/plugin/apiosk/assets/icon-dark.png +0 -0
  36. package/plugin/apiosk/assets/icon.png +0 -0
  37. package/plugin/apiosk/assets/icon.svg +1 -0
  38. package/plugin/apiosk/assets/logo.png +0 -0
  39. package/plugin/apiosk/skills/apiosk/SKILL.md +33 -0
  40. package/plugin/apiosk/skills/apiosk/agents/openai.yaml +12 -0
  41. package/server.json +58 -24
  42. package/server.mjs +136 -151
  43. package/src/approval-feedback.mjs +21 -0
  44. package/src/brand-routes.mjs +28 -0
  45. package/src/create-server.mjs +160 -46
  46. package/src/display-money.mjs +20 -0
  47. package/src/display-text.mjs +67 -0
  48. package/src/gateway-client.mjs +42 -0
  49. package/src/gateway-v2-ask.mjs +50 -0
  50. package/src/gateway-v2-card-account.mjs +23 -0
  51. package/src/gateway-v2-card-actions.mjs +67 -0
  52. package/src/gateway-v2-card-answer-text.mjs +130 -0
  53. package/src/gateway-v2-card-answer.mjs +68 -0
  54. package/src/gateway-v2-card-blocks.mjs +166 -0
  55. package/src/gateway-v2-card-body.mjs +259 -0
  56. package/src/gateway-v2-card-budget.mjs +21 -0
  57. package/src/gateway-v2-card-cbs.mjs +56 -0
  58. package/src/gateway-v2-card-choices.mjs +4 -0
  59. package/src/gateway-v2-card-clarification.mjs +25 -0
  60. package/src/gateway-v2-card-compact.mjs +34 -0
  61. package/src/gateway-v2-card-events.mjs +41 -0
  62. package/src/gateway-v2-card-presentation.mjs +125 -0
  63. package/src/gateway-v2-card-research.mjs +63 -0
  64. package/src/gateway-v2-card-result.mjs +32 -0
  65. package/src/gateway-v2-card-search.mjs +39 -0
  66. package/src/gateway-v2-card-sources.mjs +32 -0
  67. package/src/gateway-v2-card-style.mjs +76 -0
  68. package/src/gateway-v2-card-verdict.mjs +66 -0
  69. package/src/gateway-v2-card.mjs +91 -0
  70. package/src/gateway-v2-contracts.json +66 -0
  71. package/src/gateway-v2-instructions.md +113 -0
  72. package/src/gateway-v2-recovery.mjs +18 -0
  73. package/src/gateway-v2-report-links.mjs +14 -0
  74. package/src/gateway-v2-workflows.mjs +17 -0
  75. package/src/gateway-v2.mjs +179 -0
  76. package/src/oauth.mjs +402 -1949
  77. package/src/observability.mjs +19 -3
  78. package/src/result-presentation.mjs +9 -0
  79. package/src/runtime.mjs +24 -3670
  80. package/src/source-groups.mjs +91 -0
  81. package/src/source-value-format.mjs +25 -0
  82. package/src/tool-result.mjs +20 -0
  83. package/src/ui-bridge.mjs +185 -0
  84. package/src/well-known-routes.mjs +132 -0
  85. package/src/assets/wallet-accounts.mjs +0 -20513
  86. package/src/assets/walletconnect-provider.mjs +0 -6319
  87. package/src/discovery.mjs +0 -929
  88. package/src/external-fetch.mjs +0 -203
  89. package/src/funding-options.mjs +0 -255
  90. package/src/gateway-management.mjs +0 -107
  91. package/src/hosted-payment.mjs +0 -552
  92. package/src/hosted-wallets.mjs +0 -530
  93. package/src/listing-metadata.mjs +0 -287
  94. package/src/local-config.mjs +0 -256
  95. package/src/payment-guidance.mjs +0 -298
  96. package/src/publisher.mjs +0 -1288
  97. package/src/result-canvas.mjs +0 -16
  98. package/src/source-registry.mjs +0 -215
  99. package/src/wallet-store.mjs +0 -476
  100. package/src/x402-inspect.mjs +0 -361
package/README.md CHANGED
@@ -5,140 +5,99 @@
5
5
 
6
6
  # Apiosk MCP Server
7
7
 
8
- **AI-native payments for tools and APIs.** Discover, pay for, execute, and publish monetized APIs directly from your agent, over USDC/x402 or prepaid credits, through the Model Context Protocol.
8
+ [![smithery badge](https://smithery.ai/badge/olivier-fovn/apiosk)](https://smithery.ai/servers/olivier-fovn/apiosk)
9
9
 
10
- `payments` · `finance` · `x402` · `commerce` · `crypto`
10
+ **Verifiable data for your chatbot.** Ask a data question, review one plan and
11
+ one total price ceiling, approve it within your connected account's spending
12
+ limits, and receive source-backed results. Resume without buying the same work
13
+ twice.
11
14
 
12
15
  [![MCP Registry](https://img.shields.io/badge/MCP_Registry-io.github.obcraft%2Fapiosk--mcp-2ea44f)](https://registry.modelcontextprotocol.io)
13
16
  [![npm](https://img.shields.io/npm/v/@apiosk/mcp?label=npm%20%40apiosk%2Fmcp)](https://www.npmjs.com/package/@apiosk/mcp)
14
17
  [![PyPI](https://img.shields.io/pypi/v/apiosk-mcp?label=PyPI%20apiosk-mcp)](https://pypi.org/project/apiosk-mcp/)
15
18
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](#license)
16
19
 
17
- Official MCP server for discovering, paying for, and publishing Apiosk APIs.
20
+ - **Hosted endpoint:** `https://mcp.apiosk.com/mcp` (streamable HTTP; the host signs in with OAuth when it connects).
21
+ - **Local stdio package:** `npx -y @apiosk/mcp` or `uvx apiosk-mcp`.
22
+ - **Apiosk app:** [app.apiosk.com](https://app.apiosk.com) — connections, spending limits, balance and approvals.
18
23
 
19
- - **Listed in the [official MCP Registry](https://registry.modelcontextprotocol.io)** as `io.github.obcraft/apiosk-mcp`.
20
- - **Hosted endpoint:** `https://mcp.apiosk.com/mcp` (streamable HTTP, OAuth-protected for paid tools).
21
- - **Local stdio package:** `npx -y @apiosk/mcp` or `uvx apiosk-mcp` for wallet + publish tools.
24
+ ## 2.0: one runtime, Gateway v2
22
25
 
23
- ## Quick Start
26
+ Every tool speaks the Gateway v2 agent contract at `https://gateway.apiosk.com`,
27
+ for the hosted server and for stdio alike. The eleven 1.x tools (the one-shot
28
+ offer, compare, plan and job tools) called the agent gateway's `/v1/ask`,
29
+ `/v1/select`, `/v1/run`, `/v1/plans` and `/v1/jobs` routes, which now answer
30
+ `410 moved_to_gateway_v2`. Sign-in still goes through the agent gateway's OAuth
31
+ endpoints.
24
32
 
25
- ### Package names
33
+ ## The tools
26
34
 
27
- The scoped npm package is the canonical client SDK package:
35
+ | Tool | What it does | Gateway v2 route | Spends |
36
+ | --- | --- | --- | --- |
37
+ | `apiosk_sources` | Browse published data sources by name, category, sector, tag or capability. Paginated with `next_offset`. | `GET /v2/sources` | no |
38
+ | `apiosk_discover` | Plan a NEW data question: one plan with `proposal.max_total_atomic` as the total price ceiling, or the clarification it needs. A fixed company or tender dossier can be started with `workflow` instead of `question`. | `POST /v2/discover`, `POST /v2/workflows/{slug}/start` | no |
39
+ | `apiosk_search` | Search sources the way the Ask page does, with a `parsed_request` capability object the chatbot fills in itself (the Ask parser's schema). Returns ranked sources per capability; each runnable candidate carries `endpoint.inputs`, the exact input keys for `apiosk_prepare`. | `POST /v2/ask-v2/search` | no |
40
+ | `apiosk_prepare` | Prepare one searched endpoint with its filled-in `input`: the same task, price ceiling and approval card as `apiosk_discover`. | `POST /v2/ask-v2/prepare` | no |
41
+ | `apiosk_execute` | Continue the same task with a returned `next_actions` entry: supply input, select an entity, run an approved step, cancel. | `POST /v2/execute` | only an approved step |
42
+ | `apiosk_status` | Read a task's saved results, actual charges and status. Free and read-only; used for follow-ups and recovery. | `GET /v2/tasks/{id}` | no |
43
+ | `apiosk_approve` | **App-only.** Called by the interactive card when the person clicks Approve; approves that exact ceiling within the connection's spending limits and starts server execution. Never invoked by the model. | `POST /v2/approve` | yes, within the approved ceiling |
28
44
 
29
- ```bash
30
- npm install @apiosk/mcp
31
- ```
45
+ ### Approval
32
46
 
33
- It exposes the same CLI binaries as the legacy package:
47
+ The task's `context_view.approval_mode` decides where a person approves:
34
48
 
35
- ```bash
36
- npx -y @apiosk/mcp
37
- apiosk-mcp
38
- apiosk-mcp-server
39
- apiosk
40
- ```
49
+ - `chatbot` — the interactive card shows the plan and total and an **Approve**
50
+ button. One click approves the whole request within the connected account's
51
+ spending limits; the server then runs every step and streams the result into
52
+ the card (`context_view.events_url`).
53
+ - `app` — the person approves at `proposal.approval_url` in the Apiosk app. The
54
+ server continues automatically after approval; read progress with
55
+ `apiosk_status`.
41
56
 
42
- The previous public package name, `apiosk-mcp-server`, remains supported as a
43
- compatibility install path for existing MCP client configs.
57
+ A chat message, a tool permission or `approved: true` is never an approval.
58
+ Loading a card or recovering a task never approves or buys.
44
59
 
45
- For MCP registry submission forms, use:
60
+ ### Recovery
46
61
 
47
- - npm Package: `@apiosk/mcp`
48
- - PyPI Package: `apiosk-mcp`
49
- - Short Description: `Discover, pay for, execute, and publish Apiosk APIs through MCP.`
62
+ Every response carries `state.state_ref`. If state is lost or a response was
63
+ interrupted, call `apiosk_status` with `{"task_ref": "<state_ref>"}`. It reads
64
+ only; it never parses, approves or buys.
50
65
 
51
- The PyPI package is a launcher for the canonical npm package, so `uvx
52
- apiosk-mcp` starts the same MCP server as `npx -y @apiosk/mcp`.
66
+ The complete host contract the tools follow is served as the MCP resource
67
+ `apiosk://v2/host-contract` and in the server instructions.
53
68
 
54
- ### Local stdio package
69
+ ## Quick start
55
70
 
56
71
  ```bash
57
72
  npx -y @apiosk/mcp
58
73
  ```
59
74
 
60
- Python/uv users can install through PyPI:
61
-
62
- ```bash
63
- uvx apiosk-mcp
64
- ```
65
-
66
- The PyPI launcher requires Node.js 20+ and `npx` on `PATH`. By default it runs
67
- `npx -y @apiosk/mcp@1.3.2`; set `APIOSK_MCP_NPM_PACKAGE=@apiosk/mcp@next` to
68
- override the npm package spec.
69
-
70
- ### Publishing packages
71
-
72
- From this `mcp/` directory:
73
-
74
- ```bash
75
- npm run pack:check
76
- npm publish --access public
77
- ```
78
-
79
- ```bash
80
- python3 -m pip install --upgrade build twine
81
- python3 -m build
82
- python3 -m twine upload dist/apiosk_mcp-1.3.2*
83
- ```
84
-
85
- After both uploads are live, the MCP registry package fields are:
86
-
87
- ```text
88
- npm Package: @apiosk/mcp
89
- PyPI Package: apiosk-mcp
90
- Short Description: Discover, pay for, execute, and publish Apiosk APIs through MCP.
91
- ```
75
+ The PyPI package is a launcher for it, so `uvx apiosk-mcp` starts the same
76
+ server. Both expose the same CLI binaries: `apiosk-mcp`, `apiosk-mcp-server`
77
+ and `apiosk`.
92
78
 
93
- ### With automatic x402 payments from an env wallet
79
+ For stdio, set `APIOSK_CONNECT_TOKEN` to an Apiosk agent token
80
+ (`apk_access_…` from a connection made in the Apiosk app, or a legacy
81
+ `apk_live_…` agent key). Every tool acts for that connected account; without a
82
+ token the tools answer `unauthorized`. The hosted server uses OAuth instead.
94
83
 
95
- ```bash
96
- APIOSK_PRIVATE_KEY=0x... npx -y @apiosk/mcp
97
- ```
84
+ ## Agent configuration
98
85
 
99
- ### With dashboard-managed access
86
+ ### Claude Code
100
87
 
101
88
  ```bash
102
- APIOSK_CONNECT_TOKEN=... npx -y @apiosk/mcp
103
- ```
104
-
105
- After the MCP server is installed in Claude, Codex, or another client, the fastest first-run path in local stdio mode is:
106
-
107
- ```json
108
- { "wallet_label": "My Apiosk wallet" }
89
+ claude mcp add --transport http apiosk https://mcp.apiosk.com/mcp
109
90
  ```
110
91
 
111
- 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.
112
-
113
- ## Local Wallet Mode
114
-
115
- The local stdio package exposes wallet tools that let Claude or Codex:
116
-
117
- - create or import a wallet
118
- - show the wallet address
119
- - select the active wallet used for paid calls
120
- - reveal or save the private key when the user explicitly asks
121
- - publish and manage APIs without opening the dashboard
122
-
123
- The active wallet is mirrored to:
124
-
125
- - `~/.apiosk/wallet.json`
126
- - `~/.apiosk/wallet.txt`
127
-
128
- so older Apiosk scripts can reuse it.
129
-
130
- ## Agent Configuration
131
-
132
- ### Claude Desktop
133
-
134
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
92
+ ### Claude Desktop, Cursor, Windsurf, Cline, Continue, Goose
135
93
 
136
94
  ```json
137
95
  {
138
96
  "mcpServers": {
139
97
  "apiosk": {
140
98
  "command": "npx",
141
- "args": ["-y", "@apiosk/mcp"]
99
+ "args": ["-y", "@apiosk/mcp"],
100
+ "env": { "APIOSK_CONNECT_TOKEN": "apk_access_…" }
142
101
  }
143
102
  }
144
103
  }
@@ -146,27 +105,6 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
146
105
 
147
106
  ### VS Code
148
107
 
149
- Add the server with the CLI:
150
-
151
- ```bash
152
- code --add-mcp '{"name":"apiosk","command":"npx","args":["-y","@apiosk/mcp"]}'
153
- ```
154
-
155
- Or create `.vscode/mcp.json` in your workspace (VS Code uses a `servers` key):
156
-
157
- ```json
158
- {
159
- "servers": {
160
- "apiosk": {
161
- "command": "npx",
162
- "args": ["-y", "@apiosk/mcp"]
163
- }
164
- }
165
- }
166
- ```
167
-
168
- To use the hosted endpoint instead of the local package:
169
-
170
108
  ```json
171
109
  {
172
110
  "servers": {
@@ -178,539 +116,72 @@ To use the hosted endpoint instead of the local package:
178
116
  }
179
117
  ```
180
118
 
181
- ### Cursor
182
-
183
- ```json
184
- {
185
- "mcpServers": {
186
- "apiosk": {
187
- "command": "npx",
188
- "args": ["-y", "@apiosk/mcp"]
189
- }
190
- }
191
- }
192
- ```
193
-
194
- ### Windsurf
195
-
196
- ```json
197
- {
198
- "mcpServers": {
199
- "apiosk": {
200
- "command": "npx",
201
- "args": ["-y", "@apiosk/mcp"]
202
- }
203
- }
204
- }
205
- ```
206
-
207
- ### Claude Code
208
-
209
- Remote HTTP:
210
-
211
- ```bash
212
- claude mcp add --transport http apiosk https://mcp.apiosk.com/mcp
213
- ```
214
-
215
- Local stdio:
216
-
217
- ```json
218
- {
219
- "mcpServers": {
220
- "apiosk": {
221
- "command": "npx",
222
- "args": ["-y", "@apiosk/mcp"]
223
- }
224
- }
225
- }
226
- ```
227
-
228
- ### Cline / Continue / Goose
229
-
230
- ```json
231
- {
232
- "mcpServers": {
233
- "apiosk": {
234
- "command": "npx",
235
- "args": ["-y", "@apiosk/mcp"]
236
- }
237
- }
238
- }
239
- ```
240
-
241
- ### Using a local checkout
242
-
243
- ```json
244
- {
245
- "mcpServers": {
246
- "apiosk": {
247
- "command": "node",
248
- "args": ["/full/path/to/apiosk-mcp/index.mjs"]
249
- }
250
- }
251
- }
252
- ```
253
-
254
119
  ### ChatGPT and other remote MCP apps
255
120
 
256
- Use the hosted MCP endpoint:
257
-
258
- ```text
259
- https://mcp.apiosk.com/mcp
260
- ```
261
-
262
- Protected tools on the hosted server use OAuth. The remote MCP surface is fully
263
- capable, discovery, payment guidance, generic **and** dynamic per-API
264
- execution, prepaid credits, and managed agent-wallet CRUD. Public tools
265
- (discovery + guidance) work before authorization; paid execution and managed
266
- tools require OAuth. Publishing stays local/portal-only because it needs a
267
- client-side signing key the hosted server never holds.
268
-
269
- ## Provider MCP Monetization
270
-
271
- If you own an MCP server and want to sell its tools through Apiosk, keep payment
272
- logic out of your MCP. Apiosk is the paid edge.
273
-
274
- Provider requirements:
121
+ Use `https://mcp.apiosk.com/mcp`. The host starts OAuth when it connects;
122
+ sign-in and spending limits live in the Apiosk app.
275
123
 
276
- - Host your MCP over HTTPS, for example `https://tools.example.com/mcp`.
277
- - Support normal MCP `initialize`, `tools/list`, and `tools/call`.
278
- - Keep tool names stable; imported tools become paid operation ids.
279
- - Provide useful descriptions and JSON schemas; these become buyer-facing
280
- discovery metadata.
281
- - Protect the provider MCP with bearer auth or another upstream secret, then
282
- configure Apiosk to inject that secret so buyers cannot bypass the gateway.
283
-
284
- Provider portal flow:
285
-
286
- 1. Open the provider portal and choose `Import MCP`.
287
- 2. Enter the MCP URL and optional bearer token.
288
- 3. Apiosk scans `tools/list` and creates one paid action per selected tool.
289
- 4. Review tool paths, schemas, descriptions, and per-call prices.
290
- 5. Publish the draft after linking a payout wallet.
291
-
292
- Buyer-facing surfaces after publish:
293
-
294
- - Hosted Apiosk MCP: `https://mcp.apiosk.com/mcp`
295
- - Catalog search: `https://gateway.apiosk.com/v1/apis?search=<slug>`
296
- - Metadata: `GET https://gateway.apiosk.com/<slug>/metadata`
297
- - Execution: `POST https://gateway.apiosk.com/<slug>/execute`
298
-
299
- The traffic path is:
300
-
301
- ```text
302
- buyer agent -> Apiosk MCP/gateway -> payment rail -> provider MCP tools/call
303
- ```
304
-
305
- The provider MCP should reject direct unauthenticated traffic, but it should not
306
- return `402 Payment Required` or inspect `X-Payment`. Payment challenges,
307
- credits, x402 proof verification, and revenue splits are handled by Apiosk.
308
-
309
- ## Publish Paid x402 Routes from a Coding Agent
310
-
311
- The hosted MCP doubles as a **publisher** for coding agents (Claude Code,
312
- Cursor, Codex, and friends): build an API, then publish it as a paid x402
313
- endpoint on the Apiosk gateway in one tool call.
314
-
315
- Authenticate with an Apiosk **provider API key** (`sk_live_…`, minted in the
316
- provider portal under Settings → API keys):
317
-
318
- ```json
319
- {
320
- "mcpServers": {
321
- "apiosk": {
322
- "url": "https://mcp.apiosk.com/mcp",
323
- "headers": {
324
- "Authorization": "Bearer sk_live_YOUR_PROVIDER_KEY"
325
- }
326
- }
327
- }
328
- }
329
- ```
330
-
331
- Tools:
332
-
333
- - `publish_x402_route`: create a paid route: name, `upstream_url`, `price`
334
- (USDC per call), `settlement_address`, optional `method`/`path`/schemas/tags.
335
- Returns the `paid_url` on `gateway.apiosk.com` plus the route's status.
336
- - `list_x402_routes`: all your routes with paid URLs, prices, and status.
337
- - `update_x402_route`: change price, description, upstream URL, schemas,
338
- settlement address, or status.
339
- - `unpublish_x402_route`: disable a route (reversible).
340
- - `test_x402_route`: fire an unpaid request at the paid URL and verify it
341
- returns `402 Payment Required` with a valid x402 `accepts[]` offer.
342
- - `generate_openapi_spec`: host an OpenAPI 3.1 spec for the route at
343
- `https://mcp.apiosk.com/openapi/<route_id>.json`.
344
- - `publish_project`: publish several routes of one project in a single call.
345
-
346
- Lifecycle: new routes land in Apiosk's operator review queue
347
- (`status: "pending_review"`). On approval they serve x402 payments, appear in
348
- `https://gateway.apiosk.com/.well-known/x402`, and are auto-indexed in the
349
- Coinbase x402 Bazaar. Settlement pays 98% of each call to your
350
- `settlement_address` (Apiosk keeps a 2% platform fee).
351
-
352
- Discovery endpoints for machines:
353
-
354
- - `https://mcp.apiosk.com/.well-known/apiosk-routes.json` (alias `/discovery`)
355
- , machine-readable index of every paid route on the gateway.
356
- - `https://mcp.apiosk.com/openapi/<route_id>.json`: per-route OpenAPI spec.
357
-
358
- Local stdio use: set `APIOSK_PROVIDER_TOKEN=sk_live_…` instead of the header.
359
- Hosted server operators must configure `APIOSK_SUPABASE_SERVICE_ROLE_KEY` (the
360
- tools verify provider keys and write listings through the gateway database).
361
-
362
- ## Available Tools
363
-
364
- Static tools:
365
-
366
- - `apiosk_help`
367
- - `apiosk_payment_guide`: buyer + provider guide for paying through and publishing on the gateway
368
- - `apiosk_explore`
369
- - `apiosk_search`
370
- - `apiosk_discover`
371
- - `apiosk_inspect_x402`
372
- - `apiosk_fetch_paid`
373
- - `apiosk_get_api`
374
- - `apiosk_execute`
375
-
376
- `apiosk_search` also returns matching x402 discovery sources in `sources`, even
377
- when the Apiosk API catalog has no listing with that name. Each source includes
378
- its direct REST/MCP endpoints and marks paid endpoints with
379
- `payment_required`, `price_usdc`, and `executable_via`. `apiosk_discover` can
380
- query the wired free sources directly; paid discovery sources such as x402scan
381
- and Apify are returned as `apiosk_inspect_x402` → `apiosk_fetch_paid` pointers
382
- and are never paid automatically.
383
-
384
- Hosted remote MCP tools (in addition to dynamic per-API tools):
385
-
386
- - Discovery / guidance: `apiosk_help`, `apiosk_payment_guide`, `apiosk_search`, `apiosk_explore`, `apiosk_discover`, `apiosk_inspect_x402`, `apiosk_get_api`, `apiosk_metadata`, `apiosk_execute`, `apiosk_health`
387
- - External paid fetch: `apiosk_fetch_paid` (OAuth/connect-token protected; requires explicit live-price confirmation)
388
- - Prepaid credits: `apiosk_buy_credits`, `apiosk_get_credits_status`
389
- - 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`
390
-
391
- Local wallet tools in stdio mode:
392
-
393
- - `apiosk_get_started`
394
- - `apiosk_wallet_list`
395
- - `apiosk_wallet_create`
396
- - `apiosk_configure`
397
- - `apiosk_wallet_select`
398
- - `apiosk_wallet_update`
399
- - `apiosk_wallet_delete`
400
- - `apiosk_wallet_reveal_secret`
401
- - `apiosk_wallet_save_secret`
402
-
403
- Publish tools in stdio mode:
404
-
405
- - `apiosk_publish_api`
406
- - `apiosk_list_my_apis`
407
- - `apiosk_update_api`
408
- - `apiosk_delete_api`
409
-
410
- x402 publisher tools (all modes, provider-token auth):
411
-
412
- - `publish_x402_route`
413
- - `list_x402_routes`
414
- - `update_x402_route`
415
- - `unpublish_x402_route`
416
- - `test_x402_route`
417
- - `generate_openapi_spec`
418
- - `publish_project`
419
-
420
- Optional dashboard-managed wallet tools:
421
-
422
- - `apiosk_list_wallets`
423
- - `apiosk_create_wallet`
424
- - `apiosk_update_wallet`
425
- - `apiosk_delete_wallet`
426
- - `apiosk_get_wallet_activity`
427
- - `apiosk_create_wallet_connect_string`
428
- - `apiosk_list_wallet_api_keys`
429
- - `apiosk_create_wallet_api_key`
430
- - `apiosk_update_wallet_api_key`
431
- - `apiosk_delete_wallet_api_key`
432
-
433
- Dynamic tools:
434
-
435
- - local stdio mode still generates one dynamic tool per active Apiosk API slug from listing metadata
124
+ The OpenAI plugin package lives in `plugin/apiosk`. It combines this MCP server
125
+ with the `apiosk` skill (`plugin/apiosk/skills/apiosk`).
436
126
 
437
127
  ## Examples
438
128
 
439
- ### Explore
440
-
441
- ```json
442
- {}
443
- ```
444
-
445
- ```json
446
- { "listing_type": "dataset", "search": "weather", "limit": 5 }
447
- ```
448
-
449
- ### Search
450
-
451
- ```json
452
- { "search": "diff", "limit": 5 }
453
- ```
454
-
455
- Search, explore, and `apiosk_get_api` responses now embed a `payment` block that
456
- tells the agent exactly how to settle a paid call given the current auth, so an
457
- agent that finds, say, a weather API immediately knows whether it can pay and
458
- what to do next.
459
-
460
- ### Payment guide (buyer + provider)
461
-
462
- ```json
463
- {}
464
- ```
465
-
466
- ```json
467
- { "role": "provider" }
468
- ```
469
-
470
- ```json
471
- { "role": "buyer", "slug": "weather-now" }
472
- ```
473
-
474
- Returns a buyer guide (USDC/x402 or credits, tailored to the configured auth)
475
- and a provider guide (how to publish an API and get paid). Pass `slug` to scope
476
- buyer guidance to one listing, or `role` to pick a side.
477
-
478
- ### Create a local wallet
479
-
480
- ```json
481
- { "label": "Claude wallet" }
482
- ```
483
-
484
- The create response includes:
485
-
486
- - the wallet address
487
- - Base funding instructions
488
- - a QR image URL
489
- - a terminal QR block when QR rendering is enabled
490
- - a structured Apiosk control menu with wallet, funding, pay, publish, security, and local-data sections
491
-
492
- ### Get started in one step
493
-
494
- Create a local wallet automatically, discover the catalog, and run a test call:
495
-
496
- ```json
497
- {
498
- "wallet_label": "Starter wallet",
499
- "test_slug": "agent-json-diff",
500
- "test_input": {
501
- "before": { "ok": true },
502
- "after": { "ok": false }
503
- }
504
- }
505
- ```
506
-
507
- Or save a dashboard-managed connect string locally and verify it:
508
-
509
- ```json
510
- {
511
- "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",
512
- "test_slug": "agent-json-diff",
513
- "test_input": {
514
- "before": { "ok": true },
515
- "after": { "ok": false }
516
- },
517
- "create_wallet": false
518
- }
519
- ```
520
-
521
- The connect string identifies the buyer's managed wallet and connect token. The
522
- `APIO_WALLET_*` limits bound the USDC (x402) rail. The same connect token also
523
- settles over prepaid credits when USDC is unavailable, the gateway picks the
524
- rail per call. Call `apiosk_help` with `topic="rails"` for the full settlement
525
- model.
526
-
527
- ### Open the configure menu
528
-
529
129
  ```json
530
- { "section": "funding" }
130
+ { "name": "apiosk_sources", "arguments": { "capability": "eu.company.profile" } }
531
131
  ```
532
132
 
533
133
  ```json
534
- { "wallet_id": "...", "section": "funding", "funding_provider": "onramper" }
535
- ```
536
-
537
- ### Save a secret key backup
538
-
539
- ```json
540
- { "wallet_id": "..." }
541
- ```
542
-
543
- ### Publish an API
544
-
545
- ```json
546
- {
547
- "name": "My Weather API",
548
- "slug": "my-weather-api",
549
- "endpoint_url": "https://example.com",
550
- "price_usd": 0.01,
551
- "description": "Real-time weather data",
552
- "listing_group": "datasets"
553
- }
134
+ { "name": "apiosk_discover", "arguments": { "question": "Latest filed annual accounts for Mollie B.V. from KVK" } }
554
135
  ```
555
136
 
556
- ### Generic execute
557
-
558
137
  ```json
559
- {
560
- "slug": "agent-json-diff",
561
- "input": {
562
- "before": { "ok": true },
563
- "after": { "ok": false }
564
- }
565
- }
138
+ { "name": "apiosk_execute", "arguments": { "action_id": "<next_actions[].action_id>", "state": { "…": "the newest state, unchanged" }, "input": { "value": "…" } } }
566
139
  ```
567
140
 
568
- ### Dynamic tool call (local stdio only)
569
-
570
- If the server lists a dynamic tool named `agent-json-diff`, call it directly:
571
-
572
141
  ```json
573
- {
574
- "before": { "ok": true },
575
- "after": { "ok": false }
576
- }
577
- ```
578
-
579
- ## MacBook Air Test Script
580
-
581
- Run the safe default suite from a repo checkout:
582
-
583
- ```bash
584
- cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
585
- npm run test:macbook-air
586
- ```
587
-
588
- Default coverage:
589
-
590
- - runs `npm test`
591
- - runs the isolated fresh-environment smoke test
592
- - starts a local HTTP MCP server in a temp `APIOSK_HOME`
593
- - verifies `health`, `tools/list`, `apiosk_search`, `apiosk_explore`, and `apiosk_get_api`
594
- - creates a wallet, checks funding QR/configure output, and verifies secret export plus `wallet.json` and `wallet.txt`
595
- - verifies the hosted Fly deployment, OAuth metadata, protected-resource metadata, public discovery, and the unauthenticated OAuth challenge for protected tools
596
-
597
- Useful options:
598
-
599
- - `TARGET=local` to skip hosted checks
600
- - `TARGET=hosted` to skip local checks
601
- - `APIOSK_RUN_REMOTE_WALLET_TEST=1 APIOSK_MCP_BEARER_TOKEN=...` to verify an authenticated protected hosted call after the unauthenticated challenge check
602
- - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_TEST_PRIVATE_KEY=0x...` to import a funded wallet and run a real paid execute test
603
- - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_MCP_BEARER_TOKEN=... TARGET=hosted` to run a real paid execute test through the hosted OAuth path
604
- - `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
605
-
606
- Example funded run:
607
-
608
- ```bash
609
- cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
610
- APIOSK_RUN_FUNDED_TESTS=1 \
611
- APIOSK_TEST_PRIVATE_KEY=0x... \
612
- npm run test:macbook-air
142
+ { "name": "apiosk_status", "arguments": { "task_ref": "<state.state_ref>" } }
613
143
  ```
614
144
 
615
- ## Live URL Test Script
616
-
617
- Run a hosted-only test directly against the public MCP endpoint:
618
-
619
- ```bash
620
- cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
621
- npm run test:live
622
- ```
623
-
624
- Default live coverage:
625
-
626
- - checks `https://mcp.apiosk.com/health`
627
- - verifies the hosted tool surface
628
- - verifies `/.well-known/oauth-authorization-server`
629
- - verifies `/.well-known/oauth-protected-resource/mcp`
630
- - runs live `apiosk_explore`, `apiosk_metadata`, and `apiosk_health`
631
- - verifies that an unauthenticated protected MCP tool call returns the expected OAuth `401` challenge
632
-
633
- Optional live funded checks:
634
-
635
- - `APIOSK_RUN_REMOTE_WALLET_TEST=1 APIOSK_MCP_BEARER_TOKEN=... npm run test:live`
636
- - `APIOSK_RUN_FUNDED_TESTS=1 APIOSK_MCP_BEARER_TOKEN=... npm run test:live`
145
+ ## Environment variables
637
146
 
638
- 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.
147
+ - `APIOSK_CONNECT_TOKEN` — stdio only: the Apiosk agent token sent as `Authorization: Bearer …` to Gateway v2. Hosted MCP obtains the token through OAuth.
148
+ - `APIOSK_GATEWAY_V2_URL` — the Gateway v2 origin. Defaults to `https://gateway.apiosk.com`; set only for a local (`http://127.0.0.1:…`) or staging gateway.
149
+ - `APIOSK_GATEWAY_URL` — the agent gateway used for hosted OAuth. Leave unset unless testing against staging.
150
+ - `APIOSK_MCP_OAUTH_SECRET` — signing secret for hosted OAuth codes, access tokens and refresh tokens.
151
+ - `APIOSK_MCP_PUBLIC_BASE_URL` — this server's own public URL.
639
152
 
640
- ## Environment Variables
153
+ This server holds no keys, prices nothing and moves no money: Gateway v2 plans,
154
+ prices, enforces the spending limits and executes.
641
155
 
642
- - `APIOSK_PRIVATE_KEY`: enables automatic x402 settlement and signed publish requests
643
- - `APIOSK_CONNECT_TOKEN`: attach a dashboard-managed connect token
644
- - `APIOSK_CONNECT_AUTHORIZATION`: attach a custom Authorization header
645
- - `APIOSK_CONNECT_HEADER_NAME`: override the connect-token header name
646
- - `APIOSK_WALLET_ADDRESS`: send a wallet address for wallet-aware flows
647
- - `APIOSK_X_PAYMENT`: attach a pre-built x402 proof manually
648
- - `APIOSK_GATEWAY`: override the gateway base URL
649
- - `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`
650
- - `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`
651
- - `APIOSK_DASHBOARD_JWT` or `APIOSK_USER_JWT`: unlock dashboard wallet routes
652
- - `APIOSK_ENABLE_LOCAL_WALLETS=true`: enable local wallet tools in HTTP server mode
653
- - `APIOSK_MCP_OAUTH_SECRET` or `APIOSK_MCP_AUTH_SECRET`: signing secret for hosted OAuth codes, access tokens, and refresh tokens
654
- - `APIOSK_MCP_BEARER_TOKEN`: optional hosted OAuth access token used by the live scripts for authenticated protected-tool checks
655
- - `APIOSK_HOME`: override the default `~/.apiosk` directory
656
- - `APIOSK_MCP_WALLET_STORE`: override the local wallet store path
156
+ ## Remote HTTP server
657
157
 
658
- ## Human-Funded Credits Flow
659
-
660
- In the local stdio package, MCP can now help a human top up Apiosk credits and then let the agent spend those credits later:
661
-
662
- 1. `apiosk_create_account` if the user needs a new Apiosk account
663
- 2. `apiosk_sign_in` to store a local dashboard session token
664
- 3. `apiosk_buy_credits` to create an Adyen checkout link
665
- 4. `apiosk_get_credits_status` after payment to reconcile the top-up and confirm the balance
666
-
667
- If signup does not return a session immediately, tell the user to confirm their email first and then call `apiosk_sign_in`.
668
-
669
- These calls now target the MCP-owned control-plane surface by default:
670
-
671
- - `https://mcp.apiosk.com/api/auth/mcp-sign-up`
672
- - `https://mcp.apiosk.com/api/auth/mcp-sign-in`
673
- - `https://mcp.apiosk.com/api/credits/topup`
674
- - `https://mcp.apiosk.com/api/credits/reconcile`
675
-
676
- ## Remote HTTP Server
677
-
678
- 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.
679
-
680
- Hosted OAuth metadata and authorization routes now live on the same host:
158
+ Hosted OAuth metadata and authorization routes live on the same host:
681
159
 
682
160
  - `https://mcp.apiosk.com/.well-known/oauth-authorization-server`
683
161
  - `https://mcp.apiosk.com/.well-known/oauth-protected-resource/mcp`
684
162
  - `https://mcp.apiosk.com/authorize`
685
163
  - `https://mcp.apiosk.com/token`
686
164
  - `https://mcp.apiosk.com/register`
687
-
688
- Test it:
165
+ - `https://mcp.apiosk.com/.well-known/mcp/server-card.json`
689
166
 
690
167
  ```bash
691
168
  curl https://mcp.apiosk.com/health
692
169
  ```
693
170
 
694
- ```bash
695
- curl https://mcp.apiosk.com/mcp \
696
- -H "Content-Type: application/json" \
697
- -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
698
- ```
699
-
700
171
  ## Development
701
172
 
702
173
  ```bash
703
174
  npm install
704
- npm run dev # HTTP server on :3000
705
- node index.mjs # stdio mode with local wallet tools enabled
175
+ npm test # node --test
176
+ npm run dev # HTTP server on :3000
177
+ node index.mjs # stdio
706
178
  ```
707
179
 
708
- Fresh-environment smoke test:
709
-
710
- ```bash
711
- cd /Users/olivierbrinkman/Development/Apiosk/subs/mcp
712
- npm run smoke:new-env
713
- ```
180
+ `test/surface.test.mjs` asserts the tool list by name and that the published
181
+ manifests (`dxt.json`, `server.json`, this file) and versions agree with it.
182
+ `src/gateway-v2-contracts.json` and `src/gateway-v2-instructions.md` are
183
+ generated from `gateway/contracts/` by `gateway/scripts/sync-contracts.mjs`; do
184
+ not edit them here.
714
185
 
715
186
  ## License
716
187