@vapi-network/mcp 0.3.0 → 0.5.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/dist/server.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { type SecretStore, type VapiPaymentAccount, type VapiConfig, type WalletStore } from "@vapi-network/core";
2
2
  import { z } from "zod";
3
3
  import { callService, type CallToolInput, type CallToolResult } from "./tools/call.js";
4
+ import { type AuthAgentLinkOverrides } from "./tools/auth.js";
5
+ import { type RouterCoreOverrides } from "./tools/router.js";
4
6
  export { callService, type CallToolInput, type CallToolResult };
5
7
  export type VapiServerOptions = {
6
8
  /** The wallet unlocked before stdio was connected. */
@@ -20,6 +22,10 @@ export type VapiServerOptions = {
20
22
  passphrase?: (() => string | Promise<string>) | undefined;
21
23
  /** The OS secret store `vapi unlock` writes to; see `WalletSession`. */
22
24
  secretStore?: SecretStore | undefined;
25
+ /** Device-link functions and API base overridden by deterministic tests. */
26
+ agentLink?: AuthAgentLinkOverrides | undefined;
27
+ /** Core Router functions overridden by deterministic tests. */
28
+ router?: RouterCoreOverrides | undefined;
23
29
  };
24
30
  type ToolResult = {
25
31
  isError?: boolean;
@@ -33,6 +39,7 @@ type ToolDefinition<Shape extends z.ZodRawShape> = {
33
39
  description?: string;
34
40
  deprecatedReplacement?: string;
35
41
  inputSchema: Shape;
42
+ strictInput?: boolean;
36
43
  outputSchema?: z.ZodType;
37
44
  };
38
45
  type ListedTool = {
@@ -0,0 +1,81 @@
1
+ import type { SecretStore, WalletStore } from "@vapi-network/core";
2
+ import { pollDeviceLink, saveAgentLink, startDeviceLink } from "@vapi-network/core/agent-link";
3
+ import { z } from "zod";
4
+ import type { WalletSession } from "../wallet-session.js";
5
+ export declare const authStatusTool: {
6
+ description: string;
7
+ inputSchema: {
8
+ wallet: z.ZodOptional<z.ZodString>;
9
+ };
10
+ outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
+ linked: z.ZodLiteral<false>;
12
+ wallet: z.ZodString;
13
+ address: z.ZodString;
14
+ pending: z.ZodOptional<z.ZodObject<{
15
+ userCode: z.ZodString;
16
+ verificationUriComplete: z.ZodURL;
17
+ expiresAt: z.ZodISODateTime;
18
+ }, z.core.$strip>>;
19
+ lastError: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>, z.ZodObject<{
21
+ linked: z.ZodLiteral<true>;
22
+ owner: z.ZodString;
23
+ label: z.ZodString;
24
+ scopes: z.ZodArray<z.ZodString>;
25
+ linkedAt: z.ZodISODateTime;
26
+ router: z.ZodBoolean;
27
+ wallet: z.ZodString;
28
+ address: z.ZodString;
29
+ pending: z.ZodOptional<z.ZodObject<{
30
+ userCode: z.ZodString;
31
+ verificationUriComplete: z.ZodURL;
32
+ expiresAt: z.ZodISODateTime;
33
+ }, z.core.$strip>>;
34
+ lastError: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>], "linked">;
36
+ };
37
+ export declare const authLinkTool: {
38
+ description: string;
39
+ inputSchema: {
40
+ label: z.ZodOptional<z.ZodString>;
41
+ };
42
+ outputSchema: z.ZodObject<{
43
+ wallet: z.ZodString;
44
+ address: z.ZodString;
45
+ userCode: z.ZodString;
46
+ verificationUriComplete: z.ZodURL;
47
+ expiresAt: z.ZodISODateTime;
48
+ }, z.core.$strip>;
49
+ };
50
+ export type AuthAgentLinkOverrides = {
51
+ apiBase?: string | undefined;
52
+ startDeviceLink?: typeof startDeviceLink | undefined;
53
+ pollDeviceLink?: typeof pollDeviceLink | undefined;
54
+ saveAgentLink?: typeof saveAgentLink | undefined;
55
+ now?: (() => number) | undefined;
56
+ };
57
+ export type AuthToolsOptions = AuthAgentLinkOverrides & {
58
+ session: WalletSession;
59
+ secrets: SecretStore;
60
+ wallets?: WalletStore | undefined;
61
+ fetchImpl: typeof fetch;
62
+ apiBase: string;
63
+ };
64
+ type ToolResult = {
65
+ isError?: boolean;
66
+ structuredContent?: Record<string, unknown>;
67
+ content: Array<{
68
+ type: "text";
69
+ text: string;
70
+ }>;
71
+ };
72
+ /** One server instance's link state. No device code or token crosses the tool boundary. */
73
+ export declare function createAuthTools(options: AuthToolsOptions): {
74
+ link(input: {
75
+ label?: string;
76
+ }): Promise<ToolResult>;
77
+ status(input: {
78
+ wallet?: string;
79
+ }): Promise<ToolResult>;
80
+ };
81
+ export {};
@@ -1,4 +1,4 @@
1
- import { type LookupFn, type MarketplaceHit, type SpendCaps, type VapiPaymentAccount, type VapiConfig, type WalletName } from "@vapi-network/core";
1
+ import { type ListingVerification, type LookupFn, type MarketplaceHit, type SpendCaps, type VapiPaymentAccount, type VapiConfig, type WalletName } from "@vapi-network/core";
2
2
  export type CallToolInput = {
3
3
  id?: string;
4
4
  url?: string;
@@ -16,6 +16,7 @@ export type PossibleSettlement = {
16
16
  amountAtomic: string;
17
17
  payTo: string;
18
18
  payer: string;
19
+ paymentId?: string;
19
20
  authorizationNonce?: string;
20
21
  authorizationExpiresAt?: string;
21
22
  authorizationTransaction?: string;
@@ -43,6 +44,11 @@ export declare class VapiCallError extends Error {
43
44
  export type CallToolResult = {
44
45
  status: number;
45
46
  body: unknown;
47
+ /**
48
+ * How far the paid listing got through vAPI review. Absent when there was no
49
+ * listing to disclose — a call made against an explicit URL.
50
+ */
51
+ verification?: ListingVerification;
46
52
  outcome?: "signed_in";
47
53
  payment: null | {
48
54
  network: string;
@@ -1,4 +1,4 @@
1
- import { type DiscoveryEndpoint, type ListingFee, type ListingGroup, type VapiConfig } from "@vapi-network/core";
1
+ import { type DiscoveryEndpoint, type ListingConformance, type ListingFee, type ListingGroup, type ListingIdentity, type ListingLiveness, type ListingVerification, type VapiConfig } from "@vapi-network/core";
2
2
  export type InspectToolInput = {
3
3
  id: string;
4
4
  endpoint?: string;
@@ -9,6 +9,17 @@ export type InspectToolResult = Omit<Pick<DiscoveryEndpoint, "name" | "method" |
9
9
  /** Registry-owned listing disclosures; absent when the registry omits them. */
10
10
  group?: ListingGroup;
11
11
  fee?: ListingFee;
12
+ /**
13
+ * How far the listing got through vAPI review. Reads as `none` for a registry
14
+ * that predates the tier, and for every mirrored external row.
15
+ */
16
+ verification: ListingVerification;
17
+ /** Seven days of the registry's hourly re-probe; absent when it sends none. */
18
+ liveness?: ListingLiveness;
19
+ /** How closely the listing's 402 follows its declared x402 version. */
20
+ conformance?: ListingConformance;
21
+ /** ERC-8004 agent identity on Base, when the registry has read one. */
22
+ identity?: ListingIdentity;
12
23
  payment: DiscoveryEndpoint["payment"] | null;
13
24
  };
14
25
  export declare function inspectService(input: InspectToolInput, config: VapiConfig, fetchImpl?: typeof fetch): Promise<InspectToolResult>;
@@ -0,0 +1,135 @@
1
+ import type { SecretStore, VapiConfig, VapiPaymentAccount, WalletStore } from "@vapi-network/core";
2
+ import { buyRouterBalance, listRouterModels, ownerStake, routerChat, routerUsage } from "@vapi-network/core/router-client";
3
+ import { z } from "zod";
4
+ import type { WalletSession } from "../wallet-session.js";
5
+ declare const routerChatInputSchema: z.ZodObject<{
6
+ wallet: z.ZodOptional<z.ZodString>;
7
+ model: z.ZodString;
8
+ messages: z.ZodArray<z.ZodObject<{
9
+ role: z.ZodEnum<{
10
+ system: "system";
11
+ user: "user";
12
+ assistant: "assistant";
13
+ }>;
14
+ content: z.ZodString;
15
+ }, z.core.$strict>>;
16
+ max_tokens: z.ZodOptional<z.ZodNumber>;
17
+ }, z.core.$strict>;
18
+ declare const routerBuyInputSchema: z.ZodObject<{
19
+ wallet: z.ZodOptional<z.ZodString>;
20
+ usd: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<5>, z.ZodLiteral<20>, z.ZodLiteral<50>]>;
21
+ }, z.core.$strict>;
22
+ export declare const routerModelsTool: {
23
+ description: string;
24
+ inputSchema: {};
25
+ outputSchema: z.ZodObject<{
26
+ models: z.ZodArray<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ };
29
+ export declare const routerUsageTool: {
30
+ description: string;
31
+ inputSchema: {
32
+ wallet: z.ZodOptional<z.ZodString>;
33
+ };
34
+ outputSchema: z.ZodObject<{
35
+ stake: z.ZodObject<{
36
+ owner: z.ZodString;
37
+ stake: z.ZodString;
38
+ computeTodayUsd: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ compute: z.ZodObject<{
41
+ allowanceUsd: z.ZodNumber;
42
+ spentTodayUsd: z.ZodNumber;
43
+ remainingTodayUsd: z.ZodNumber;
44
+ resetsAt: z.ZodString;
45
+ ownerLimitUsd: z.ZodNumber;
46
+ ownerSpentUsd: z.ZodNumber;
47
+ }, z.core.$strip>;
48
+ balance: z.ZodNullable<z.ZodObject<{
49
+ purchasedUsd: z.ZodNumber;
50
+ spentUsd: z.ZodNumber;
51
+ remainingUsd: z.ZodNumber;
52
+ }, z.core.$strip>>;
53
+ }, z.core.$strip>;
54
+ };
55
+ export declare const routerChatTool: {
56
+ description: string;
57
+ inputSchema: {
58
+ wallet: z.ZodOptional<z.ZodString>;
59
+ model: z.ZodString;
60
+ messages: z.ZodArray<z.ZodObject<{
61
+ role: z.ZodEnum<{
62
+ system: "system";
63
+ user: "user";
64
+ assistant: "assistant";
65
+ }>;
66
+ content: z.ZodString;
67
+ }, z.core.$strict>>;
68
+ max_tokens: z.ZodOptional<z.ZodNumber>;
69
+ };
70
+ strictInput: boolean;
71
+ outputSchema: z.ZodObject<{
72
+ content: z.ZodNullable<z.ZodString>;
73
+ model: z.ZodString;
74
+ usage: z.ZodOptional<z.ZodObject<{
75
+ prompt_tokens: z.ZodNumber;
76
+ completion_tokens: z.ZodNumber;
77
+ total_tokens: z.ZodNumber;
78
+ }, z.core.$strip>>;
79
+ }, z.core.$strip>;
80
+ };
81
+ export declare const routerBuyTool: {
82
+ description: string;
83
+ inputSchema: {
84
+ wallet: z.ZodOptional<z.ZodString>;
85
+ usd: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<5>, z.ZodLiteral<20>, z.ZodLiteral<50>]>;
86
+ };
87
+ strictInput: boolean;
88
+ outputSchema: z.ZodObject<{
89
+ receipt: z.ZodObject<{
90
+ id: z.ZodString;
91
+ amountUsd: z.ZodNumber;
92
+ network: z.ZodString;
93
+ transaction: z.ZodOptional<z.ZodString>;
94
+ }, z.core.$strip>;
95
+ balance: z.ZodNullable<z.ZodObject<{
96
+ purchasedUsd: z.ZodNumber;
97
+ spentUsd: z.ZodNumber;
98
+ remainingUsd: z.ZodNumber;
99
+ }, z.core.$strip>>;
100
+ }, z.core.$strip>;
101
+ };
102
+ export type RouterCoreOverrides = {
103
+ listRouterModels?: typeof listRouterModels | undefined;
104
+ routerUsage?: typeof routerUsage | undefined;
105
+ routerChat?: typeof routerChat | undefined;
106
+ ownerStake?: typeof ownerStake | undefined;
107
+ buyRouterBalance?: typeof buyRouterBalance | undefined;
108
+ };
109
+ export type RouterToolsOptions = RouterCoreOverrides & {
110
+ session: WalletSession;
111
+ secrets: SecretStore;
112
+ wallets?: WalletStore | undefined;
113
+ fetchImpl: typeof fetch;
114
+ apiBase: string;
115
+ account: VapiPaymentAccount;
116
+ config: VapiConfig;
117
+ ledgerPath?: string | undefined;
118
+ receiptsPath?: string | undefined;
119
+ };
120
+ type ToolResult = {
121
+ structuredContent: Record<string, unknown>;
122
+ content: Array<{
123
+ type: "text";
124
+ text: string;
125
+ }>;
126
+ };
127
+ export declare function createRouterTools(options: RouterToolsOptions): {
128
+ models(input: Record<string, never>): Promise<ToolResult>;
129
+ usage(input: {
130
+ wallet?: string;
131
+ }): Promise<ToolResult>;
132
+ chat(input: z.infer<typeof routerChatInputSchema>): Promise<ToolResult>;
133
+ buy(input: z.infer<typeof routerBuyInputSchema>): Promise<ToolResult>;
134
+ };
135
+ export {};
package/dist/x402.d.ts CHANGED
@@ -13,7 +13,9 @@ export declare function buildX402Payment(args: {
13
13
  nowSeconds?: number;
14
14
  nonce?: Hex;
15
15
  fetchImpl?: typeof fetch;
16
+ paymentId?: string;
16
17
  }): Promise<{
17
18
  payload: X402PaymentPayload;
18
19
  headers: X402PaymentHeaders;
20
+ paymentId?: string;
19
21
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-network/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Local, non-custodial MCP server for discovering and paying x402 APIs",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {