@vapi-network/mcp 0.2.3 → 0.3.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.
package/README.md CHANGED
@@ -1,355 +1,14 @@
1
- # vAPI Network
1
+ # `@vapi-network/mcp`
2
2
 
3
- **One wallet, every x402 API.** vAPI Network is an open-source, non-custodial
4
- TypeScript toolkit for discovering and paying x402 services from a CLI, MCP
5
- client, or your own code. Call works today. Tasks and Compute are next.
3
+ The stdio MCP server behind `vapi mcp`: namespaced tools that let an agent
4
+ search the vAPI catalogue, read a listing's request contract, pay an x402 API
5
+ from a local wallet, and read balances and receipts. It never creates, renames,
6
+ removes, backs up or exports a wallet, and no tool of its returns a recovery
7
+ phrase, a private key or a passphrase.
6
8
 
7
- Your key stays encrypted on your machine. vAPI Network applies spend policy
8
- before signing, sends payment directly to the service, and writes receipts to a
9
- local append-only ledger. It does not hold funds, proxy payments, or send
10
- telemetry off the machine by default.
9
+ One entry point, `@vapi-network/mcp`, exporting `createVapiServer`,
10
+ `startStdioServer`, `loadServerConfig`, `WalletSession` and the individual
11
+ `callService`, `inspectService`, `searchMarketplace` and `getWallet` tools.
11
12
 
12
- ## 60-second quickstart
13
-
14
- Install once, then every command is `vapi …`:
15
-
16
- ```bash
17
- npm i -g vapi-network
18
- vapi init # encrypted wallet + config under ~/.vapi (or $VAPI_HOME), prints the address
19
- ```
20
-
21
- Fund that address with `vapi fund` (card or Apple Pay via Coinbase Onramp) or by
22
- sending USDC on Base to it. Then:
23
-
24
- ```bash
25
- vapi fund # hosted onramp link, or direct-transfer instructions
26
- vapi search "weather" # every catalog, merged, with provenance
27
- vapi inspect <listing-ref> # request contract and the live 402 quote, before paying
28
- vapi pay <listing-ref> --max 0.02
29
- vapi balance
30
- vapi accounts # balances plus network-specific deposit guidance
31
- vapi receipts # one line per paid call: quote, settlement, latency
32
- vapi export-key # print the private key for this wallet, on stdout only
33
- ```
34
-
35
- `vapi search` tags each listing with its group — `[vapi]`, `[added]`,
36
- `[partner]`, or `[external]` — and prints the network fee already inside the
37
- price: vAPI and added APIs carry a 5% network fee inside the quoted price, while
38
- partner and external listings carry none. `vapi inspect` and `--json` return the
39
- same `group` and `fee` fields.
40
-
41
- No install? Prefix any command with `npx vapi-network`, for example `npx vapi-network init`.
42
- (`npx vapi` cannot work: the bare `vapi` name on npm belongs to an unrelated package.)
43
-
44
- ### Use it from an agent (MCP)
45
-
46
- Add this to Claude Desktop, Claude Code, or Cursor. The passphrase unlocks the local keystore; it never leaves the machine.
47
-
48
- ```json
49
- {
50
- "mcpServers": {
51
- "vapi": {
52
- "command": "npx",
53
- "args": ["-y", "vapi-network", "mcp"],
54
- "env": { "VAPI_KEYSTORE_PASSWORD": "your-passphrase" }
55
- }
56
- }
57
- }
58
- ```
59
-
60
- Tools: `call.search`, `call.inspect`, `call.pay`, `wallet.address`, `wallet.balance`,
61
- `wallet.accounts`, `wallet.fund`, `receipts.list`, `receipts.stats`, `support.report`. Spend caps
62
- default to $0.10 per call and $1.00 per day; the wallet checks both before it signs a payment.
63
-
64
- ## Sign-in with X
65
-
66
- x402 v2 services can require Sign-In-With-X (SIWX) before returning a price. When `call.pay` or
67
- `vapi pay` receives that challenge, vAPI checks that both the challenge domain and URI match the
68
- final resource origin, signs the canonical EIP-4361 message locally with EVM `personal_sign`, and
69
- retries once with `SIGN-IN-WITH-X`. The proof is never sent to a redirect or a different host.
70
-
71
- If the retry returns a normal 402 quote, the usual spend-policy and payment flow continues. If the
72
- resource is free after sign-in, the result has `outcome: "signed_in"` and the local receipt records
73
- `amountAtomic: "0"`.
74
-
75
- ## Fund the wallet
76
-
77
- ```bash
78
- vapi fund # ask the registry for a hosted onramp session
79
- vapi fund --amount 25 # prefill a US dollar amount
80
- vapi fund --json # stable machine-readable shape
81
- ```
82
-
83
- `vapi fund` POSTs `{ address, network: "base", asset: "USDC", fiatAmount }` to
84
- `<registry>/api/wallet/onramp-session` through the same guarded network client as
85
- every other command, prints the returned URL, and opens it in your default
86
- browser when you are on a terminal. The onramp is **Coinbase's**: Coinbase takes
87
- the card or Apple Pay payment and sends USDC straight to your local address.
88
- **vAPI never holds your funds**, never proxies the payment, and never sees your
89
- card details or your private key.
90
-
91
- When the registry replies `503 onramp_unavailable` — or cannot be reached at all
92
- — the command stays useful instead of failing: it prints your address and
93
-
94
- ```text
95
- Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.
96
- ```
97
-
98
- Either way it finishes by printing the current balance. MCP clients can use the
99
- `wallet.fund` tool, which returns the same `{ url }` or the same fallback text.
100
-
101
- ## Accounts and deposits
102
-
103
- `vapi accounts` lists one deposit account for every configured network, including its CAIP-2 ID,
104
- network name, address, atomic and formatted USDC balance, gas-token balance, and deposit guidance.
105
- Use `--json` for the stable `{ "accounts": [...] }` shape. `vapi init` prints the same account list
106
- after creating the encrypted keystore and configuration. MCP clients can use `wallet.accounts`.
107
-
108
- Base uses the wallet's EVM address and tells you to send USDC on Base. For Arc testnet, add the
109
- faucet URL or instructions to that network's `config.json` entry:
110
-
111
- ```json
112
- {
113
- "depositUrl": "https://your-arc-faucet.example",
114
- "depositInstructions": "Use the configured Arc testnet faucet, then send USDC to this address."
115
- }
116
- ```
117
-
118
- Account lookup dispatches by CAIP namespace: the EVM and Solana adapters use their corresponding
119
- local address and guarded RPC balance calls without coupling one wallet family to the other.
120
-
121
- ## Exporting the key
122
-
123
- The wallet is yours, so the key can leave on demand:
124
-
125
- ```bash
126
- vapi export-key # EVM key (eip155:8453) as 0x-prefixed hex
127
- vapi export-key --network solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d
128
- vapi export-key --json # { "network", "address", "privateKey" }
129
- ```
130
-
131
- The command asks for the keystore passphrase, prints a one-line warning on
132
- stderr, and writes the key alone on stdout so it can be piped into a password
133
- manager. Anyone holding that key can spend the wallet: never paste it into a
134
- website or a chat. Nothing else in vAPI ever logs it.
135
-
136
- ## Reporting a bug
137
-
138
- ```bash
139
- vapi report "the provider returned 402 twice"
140
- vapi report "the provider returned 402 twice" --include-addresses
141
- vapi report "the provider returned 402 twice" --send
142
- ```
143
-
144
- The command first writes `$VAPI_HOME/reports/<timestamp>.json`, then prints that path and a prefilled
145
- GitHub issue URL. Reports contain the message, client version, OS/Node information, and only the
146
- newest five receipt IDs. Wallet and payee addresses are included only with `--include-addresses`;
147
- amounts are never included. No report is uploaded unless `--send` is explicit. With `--send`, vAPI
148
- uses the guarded network client to POST the same JSON to the configured registry and prints the HTTP
149
- response code, including non-success responses such as 404. MCP clients can use `support.report`
150
- with the corresponding `includeAddresses` and `send` booleans.
151
-
152
- ## Networks
153
-
154
- | Network | x402 identifier | USDC | Gas / RPC notes |
155
- | -------------- | ----------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------ |
156
- | Base mainnet | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | ETH; defaults to `https://mainnet.base.org` |
157
- | Arc testnet | `eip155:5042002` | `0x3600000000000000000000000000000000000000` | USDC is also the gas token; set `ARC_TESTNET_RPC_URL` |
158
- | Solana mainnet | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | SOL; defaults to `https://api.mainnet-beta.solana.com` |
159
-
160
- The x402 reference packages shorten the Solana CAIP-2 reference to
161
- `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`; vAPI accepts that identifier as an
162
- alias while persisting the full genesis hash above. Arc mainnet is not enabled:
163
- **not yet — placeholder only.** Arc and the x402 packages do not publish a
164
- mainnet RPC plus canonical USDC, so the client deliberately carries only a
165
- non-routable code placeholder instead of guessing a production configuration.
166
-
167
- Create both local accounts during initialization:
168
-
169
- ```bash
170
- vapi init --networks base,solana
171
- ```
172
-
173
- Or add an Ed25519 account to an existing encrypted keystore:
174
-
175
- ```bash
176
- vapi accounts --enable solana
177
- ```
178
-
179
- Fund the printed Solana address with SPL USDC. Exact x402 payments use the
180
- facilitator advertised in the challenge as fee payer, so they do not consume the
181
- local SOL balance. `vapi sweep <solana-address> --network
182
- solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d` is a separate transaction
183
- and requires a small amount of SOL locally for fees and, when necessary,
184
- creation of the destination token account. The default public Solana RPC is
185
- rate-limited and has no availability guarantee; set `SOLANA_RPC_URL` to a
186
- trusted dedicated endpoint for regular use.
187
-
188
- ## Discovery sources
189
-
190
- Discovery is a plugin interface. The client can merge listings from multiple
191
- sources, de-duplicate them by resource URL, and retain each listing's
192
- provenance:
193
-
194
- - **vAPI Registry** is enabled by the default distribution, using
195
- `https://api.vapinetwork.ai/api/call/discovery` for discovery and
196
- `https://api.vapinetwork.ai/api/call/services` for service details. If the
197
- primary returns HTTP 404 or cannot be resolved, the client logs one notice
198
- and tries the fallbacks in `registryFallbacks`, using the same canonical
199
- paths; the default distribution no longer ships a distinct fallback host,
200
- because the `console.vapinetwork.ai` and `console-staging.vapinetwork.ai`
201
- hosts are retired. A `config.json` that still names them is repaired in
202
- memory on load and rewritten on disk by `vapi init`. The registry's historical `/api/marketplace/discovery`
203
- and `/api/network/services` paths still answer for one release and reply with
204
- `Deprecation: true` plus a `Link` header naming the successor; a base URL
205
- supplied on either of them is normalized to the canonical pair.
206
- - **Coinbase Bazaar** reads the public x402 v2
207
- `/discovery/resources` catalog exposed by a facilitator.
208
- - **Local file** reads a JSON array of listings for private or development
209
- catalogs.
210
- - **x402scan** is a deliberate stub for now. The source research documents its
211
- discovery convention, but not a stable public read API that this client can
212
- safely target.
213
-
214
- Use `@vapi-network/sources` to compose only the catalogs you trust. Network
215
- access is guarded against local and private destinations before a request is
216
- made.
217
-
218
- Set `VAPI_REGISTRY_URL` to replace the registry base; the client derives
219
- `/api/call/discovery` and `/api/call/services` beneath it. The existing
220
- `VAPI_MARKETPLACE_DISCOVERY_URL` and `VAPI_DISCOVERY_URL` variables can still
221
- override either full endpoint separately. Registry fallbacks are stored in
222
- `config.json` under `registryFallbacks`.
223
-
224
- ## Packages
225
-
226
- | Package | Purpose |
227
- | ----------------------- | ------------------------------------------------------------------------ |
228
- | `@vapi-network/core` | x402 protocol, wallet, spend policy, discovery merge, and receipts |
229
- | `@vapi-network/sources` | vAPI Registry, Coinbase Bazaar, local-file, and x402scan source adapters |
230
- | `@vapi-network/mcp` | stdio MCP server with namespaced payment tools |
231
- | `@vapi-network/cli` | `init`, discovery, payment, wallet, receipt, and MCP commands |
232
- | `vapi-network` | zero-dependency distribution with the `vapi` binary and defaults |
233
-
234
- Every npm tarball is bundled and has zero runtime dependencies. The scoped
235
- packages are useful for embedding; most users should start with
236
- `vapi-network`.
237
-
238
- ## SDK
239
-
240
- The core and source packages can be used without the CLI or MCP layer. See the
241
- runnable [SDK example](./examples/pay-with-sdk.ts) for discovery, policy
242
- validation, local signing, and direct x402 payment construction.
243
-
244
- Run it after initialization with `pnpm example:pay -- weather`.
245
-
246
- ## Local state and migration
247
-
248
- By default, local state lives in `~/.vapi/`:
249
-
250
- ```text
251
- config.json
252
- keystore.json
253
- receipts.jsonl
254
- spend-ledger.json
255
- reports/
256
- ```
257
-
258
- Set `VAPI_HOME` to use a different directory. On first use of the default home,
259
- the client copies an existing `~/.vapi/agent-cash/` configuration into
260
- `~/.vapi/` when it can do so without overwriting files, prints a migration
261
- notice, and leaves the old directory untouched.
262
-
263
- ## Metrics
264
-
265
- vAPI measures call and discovery health locally. Call receipts can include the
266
- listing name and provider host, policy decision, retry count, client version,
267
- outcome, total latency, and discovery, quote, signing, request, and settlement
268
- phase timings. Policy declines are recorded with the quoted amount but without
269
- a payer or transaction, so blocked spend remains visible without creating a
270
- payment authorization. Search events record the query, sources tried,
271
- per-source latency and result count, merged result count, and timestamp.
272
-
273
- Call receipts are appended to `$VAPI_HOME/receipts.jsonl`; search events are
274
- appended to `$VAPI_HOME/searches.jsonl`. Nothing in either ledger is uploaded,
275
- and vAPI sends no telemetry off the machine by default. The vAPI website can
276
- show public on-chain usage for a wallet address directly from the chain; that
277
- view does not require uploading these local files.
278
-
279
- Use `vapi stats --range 24h|7d|30d` for a human-readable summary or add `--json`
280
- for the stable `{ range, generatedAt, totals, outcomes, latency, topServices,
281
- search }` shape. `receipts.stats` exposes the same shape through MCP. Export raw
282
- receipts for spreadsheets and dashboards with:
283
-
284
- ```sh
285
- vapi receipts export --format json --range 30d
286
- vapi receipts export --format csv --range 30d
287
- ```
288
-
289
- ## Roadmap
290
-
291
- - A local gateway daemon (`vapi serve`) with per-key budgets
292
- - OpenTelemetry traces and metrics, with exporters enabled only by the user
293
- - `task.*` tools for posting, funding, delivering, and reviewing work
294
- - `compute.*` tools for discovering models and paying for inference
295
-
296
- Until the gateway lands, `vapi serve` and the provider-side `vapi publish`
297
- command exit with a preview message. Payments remain direct from the local
298
- wallet to each service.
299
-
300
- ## Development
301
-
302
- This is a pnpm workspace for Node.js 22 and pnpm 10.
303
-
304
- ```sh
305
- pnpm install
306
- pnpm lint
307
- pnpm typecheck
308
- pnpm test
309
- pnpm build
310
- pnpm pack:check
311
- ```
312
-
313
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow,
314
- [CHANGELOG.md](./CHANGELOG.md) for what shipped in each release, and
315
- [SECURITY.md](./SECURITY.md) for private vulnerability reports.
316
-
317
- CLI commands exit `0` on success, `1` on an operational failure, and `2` for
318
- invalid usage or an announced preview-only command. `--json` sends both success
319
- values and errors to stdout as one JSON value; `mcp --json` is accepted as a
320
- no-op because the stdio transport is already JSON-RPC.
321
-
322
- ## Publishing
323
-
324
- All five packages share one version and are published together. npm reads a
325
- package manifest before lifecycle hooks run, so the release is made from the
326
- generated `publish/` directories, never from the workspace package roots.
327
-
328
- First update every package to the same version and verify the exact tarballs:
329
-
330
- ```sh
331
- pnpm install --frozen-lockfile
332
- pnpm pack:check
333
- ```
334
-
335
- After reviewing the output, a maintainer with npm access runs these commands
336
- manually:
337
-
338
- ```sh
339
- npm login
340
- pnpm --dir packages/core publish:npm
341
- pnpm --dir packages/sources publish:npm
342
- pnpm --dir packages/mcp publish:npm
343
- pnpm --dir packages/cli publish:npm
344
- pnpm --dir packages/vapi-network publish:npm
345
- ```
346
-
347
- Each package's `publish:npm` script publishes its staged `./publish` directory
348
- to the `latest` npm tag. Every package also has a `publish:npm:next` script that
349
- publishes the same tarball to `next` instead, for preview builds. The manual
350
- release workflow verifies and prints these commands; it never receives npm
351
- credentials or publishes automatically.
352
-
353
- ## License
354
-
355
- Apache-2.0. See [LICENSE](./LICENSE).
13
+ See the [root README](https://github.com/vAPI-Network/vapi-network#readme) for
14
+ the editor configuration, the full tool table and the deprecated aliases.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { callService, createVapiServer, loadServerConfig, startStdioServer, type CallToolInput, type CallToolResult, type VapiServerOptions, } from "./server.js";
2
2
  export { inspectService, type InspectToolInput, type InspectToolResult } from "./tools/inspect.js";
3
3
  export { resolveServiceEndpoint, resolveServiceListing, searchMarketplace, type MarketplaceSearchInput, } from "./tools/search.js";
4
- export { getWallet, type WalletBalance } from "./tools/wallet.js";
4
+ export { getWallet, type WalletAddresses, type WalletBalance } from "./tools/wallet.js";
5
+ export { WalletSession, type SessionWallet, type SessionWalletInfo, type WalletSessionOptions, } from "./wallet-session.js";
5
6
  export { buildSIWxProof, parseSIWxResponse } from "./siwx.js";