@one-source/api-mcp 5.4.7 → 5.6.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.
@@ -1,54 +1,91 @@
1
1
  /**
2
- * 1s_payment_mode — view or switch the x402 payment scheme for this session.
2
+ * 1s_payment_mode — view or switch the payment rail + mode for this session.
3
+ *
4
+ * Two rails, each with two modes:
5
+ * - x402 (USDC on Base): x402-exact | x402-batch
6
+ * - MPP (Tempo USDC.e / pathUSD): mpp-charge | mpp-session
3
7
  */
4
8
  import { z } from 'zod';
5
- import { getPaymentModeInfo, setPaymentMode } from '../../x402.js';
9
+ import { getPaymentModeInfo, setPaymentMode } from '../../payment.js';
6
10
  function describe(mode, address) {
7
11
  const wallet = address ? ` Paying wallet: ${address}.` : '';
8
- if (mode === 'batch') {
9
- return (`Payment mode: batch (payment channel).${wallet} ` +
10
- 'The first paid call opens a channel with one on-chain deposit (price × deposit multiplier); ' +
11
- 'subsequent calls are signed off-chain as cumulative vouchers and settled together with a single claim. ' +
12
- 'Best for a burst of calls. Switching back to exact leaves any unspent channel balance locked until the on-chain withdraw delay (~1 day on mainnet).');
12
+ switch (mode) {
13
+ case 'x402-batch':
14
+ return (`Payment mode: x402-batch (payment channel on Base).${wallet} ` +
15
+ 'The first paid call opens a channel with one on-chain USDC deposit (price × deposit multiplier); ' +
16
+ 'subsequent calls are signed off-chain as cumulative vouchers and settled with a single claim. ' +
17
+ 'Best for a burst of calls. Switching away leaves any unspent channel balance locked until the on-chain withdraw delay (~1 day on mainnet) — use 1s_refund to reclaim it sooner.');
18
+ case 'mpp-charge':
19
+ return (`Payment mode: mpp-charge (per-call on Tempo).${wallet} ` +
20
+ 'Each paid call signs and settles one Tempo payment (USDC.e or pathUSD, per the gateway challenge). ' +
21
+ 'Switch to mpp-session for a voucher channel that is cheaper across many calls.');
22
+ case 'mpp-session':
23
+ return (`Payment mode: mpp-session (voucher channel on Tempo).${wallet} ` +
24
+ 'The first paid call opens a TIP-1034 channel on-chain (capped by MPP_MAX_DEPOSIT); ' +
25
+ 'subsequent calls are signed off-chain as cumulative vouchers. ' +
26
+ 'The unspent deposit is settled and reclaimed automatically when the server shuts down cleanly; ' +
27
+ 'a hard kill leaves it locked until reclaimed on-chain later.');
28
+ default:
29
+ return (`Payment mode: x402-exact (per-call on Base).${wallet} ` +
30
+ 'Each paid call signs and settles one USDC payment on Base. ' +
31
+ 'Switch to x402-batch (Base channel) or mpp-charge / mpp-session (Tempo) for cheaper bursts.');
13
32
  }
14
- return (`Payment mode: exact (per-call).${wallet} ` +
15
- 'Each paid call signs and settles one USDC payment on Base. ' +
16
- 'Switch to batch with { "mode": "batch" } to open a payment channel — cheaper for many calls in a session.');
17
33
  }
18
34
  export const tool = {
19
35
  name: '1s_payment_mode',
20
- description: 'View or switch how this session pays for x402 calls. ' +
21
- 'Two schemes: "exact" (default) signs one USDC payment per call; ' +
22
- '"batch" opens a payment channel — one on-chain deposit funds many off-chain calls, settled with a single claim (cheaper for a burst of calls, but locks the deposit residual until an on-chain withdraw delay). ' +
23
- 'Both use the same wallet. Call with no arguments to see the current mode. ' +
24
- 'Only applies when paying via x402 (X402_PRIVATE_KEY set); with an API key, calls are covered by your plan.',
36
+ description: 'View or switch how this session pays for metered calls. ' +
37
+ 'Two rails, each with two modes: x402-exact (per-call USDC on Base, default), ' +
38
+ 'x402-batch (Base payment channel — one deposit funds many off-chain calls), ' +
39
+ 'mpp-charge (per-call on Tempo, USDC.e/pathUSD), and mpp-session (Tempo voucher channel). ' +
40
+ 'Channel modes are cheaper for a burst of calls but lock a deposit until the channel is closed/refunded. ' +
41
+ 'Each rail uses its own wallet (X402_PRIVATE_KEY on Base / MPP_PRIVATE_KEY on Tempo). ' +
42
+ 'Call with no arguments to see the current mode and which modes are available. ' +
43
+ 'Only applies when paying via a wallet; with an API key, calls are covered by your plan.',
25
44
  category: 'chain',
26
45
  schema: {
27
46
  mode: z
28
- .enum(['exact', 'batch'])
47
+ .enum(['x402-exact', 'x402-batch', 'mpp-charge', 'mpp-session'])
29
48
  .optional()
30
- .describe('Payment scheme to switch to. Omit to report the current mode without changing it.'),
49
+ .describe('Payment rail + mode to switch to. Omit to report the current mode without changing it.'),
31
50
  },
32
51
  handler: async (input) => {
33
52
  const requested = input.mode;
34
53
  const before = getPaymentModeInfo();
35
54
  if (!before.enabled) {
36
- return ('x402 payment is not active in this session, so there is no payment scheme to switch. ' +
37
- 'Payment mode (exact vs batch) only applies when paying per-call via x402 set X402_PRIVATE_KEY to a funded Base wallet. ' +
38
- 'With an API key (ONESOURCE_API_KEY), calls are covered by your plan and no x402 payment is made.');
55
+ return ('No payment wallet is active in this session, so there is no payment mode to switch. ' +
56
+ 'Set X402_PRIVATE_KEY (a funded Base wallet) to pay via x402, or MPP_PRIVATE_KEY (a funded Tempo wallet) to pay via MPP. ' +
57
+ 'With an API key (ONESOURCE_API_KEY), calls are covered by your plan and no wallet payment is made.');
39
58
  }
40
59
  if (requested) {
41
- const applied = setPaymentMode(requested);
42
- if (requested === 'batch' && !before.batchAvailable) {
43
- return (`Batch mode is unavailable in this session — the channel scheme failed to initialise — so the mode stays "${applied}". ` +
44
- 'Check X402_RPC_URL, then restart the server.');
60
+ // Rail not enabled (its wallet key isn't set).
61
+ const railEnabled = requested.startsWith('x402-') ? before.x402.enabled : before.mpp.enabled;
62
+ if (!railEnabled) {
63
+ const envVar = requested.startsWith('x402-') ? 'X402_PRIVATE_KEY (funded Base wallet)' : 'MPP_PRIVATE_KEY (funded Tempo wallet)';
64
+ return (`Cannot switch to ${requested} — that rail is not active in this session. Set ${envVar} and restart. ` +
65
+ `Available modes right now: ${before.availableModes.join(', ')}.`);
45
66
  }
46
- if (applied === requested) {
47
- return `Switched to ${applied} mode. ${describe(applied, before.address)}`;
67
+ const applied = setPaymentMode(requested);
68
+ // Sub-mode unavailable (channel scheme failed to initialise).
69
+ if (applied !== requested) {
70
+ if (requested === 'x402-batch' && !before.x402.batchAvailable) {
71
+ return (`x402-batch is unavailable in this session — the channel scheme failed to initialise — so the mode stays "${applied}". ` +
72
+ 'Check X402_RPC_URL, then restart the server.');
73
+ }
74
+ if (requested === 'mpp-session' && !before.mpp.sessionAvailable) {
75
+ return (`mpp-session is unavailable in this session — the Tempo channel failed to initialise — so the mode stays "${applied}". ` +
76
+ 'Check MPP_RPC_URL, then restart the server.');
77
+ }
78
+ return `Could not switch to ${requested}; mode stays "${applied}". Available modes: ${before.availableModes.join(', ')}.`;
48
79
  }
80
+ const address = applied.startsWith('x402-') ? before.x402.address : before.mpp.address;
81
+ return `Switched to ${applied}. ${describe(applied, address)}`;
49
82
  }
50
83
  const info = getPaymentModeInfo();
51
- return describe(info.mode, info.address);
84
+ const address = info.mode.startsWith('x402-') ? info.x402.address : info.mpp.address;
85
+ return (`${describe(info.mode, address)} ` +
86
+ `Available modes: ${info.availableModes.join(', ')}.` +
87
+ (info.x402.enabled ? ` x402 wallet: ${info.x402.address}.` : '') +
88
+ (info.mpp.enabled ? ` MPP wallet: ${info.mpp.address}.` : ''));
52
89
  },
53
90
  };
54
91
  //# sourceMappingURL=payment-mode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"payment-mode.js","sourceRoot":"","sources":["../../../src/tools/chain/payment-mode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAC;AAErF,SAAS,QAAQ,CAAC,IAAiB,EAAE,OAAgB;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,mBAAmB,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,CACL,yCAAyC,MAAM,GAAG;YAClD,8FAA8F;YAC9F,yGAAyG;YACzG,qJAAqJ,CACtJ,CAAC;IACJ,CAAC;IACD,OAAO,CACL,kCAAkC,MAAM,GAAG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S,iBAAiB,OAAO,uBAAuB,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5H,CAAC;YACD,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;YACvF,OAAO,eAAe,OAAO,KAAK,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QACjE,CAAC;QAED,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QACrF,OAAO,CACL,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG;YAClC,oBAAoB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACrD,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAChE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9D,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -1,5 +1,9 @@
1
1
  /**
2
- * 1s_refund — reclaim unused x402 batch-channel escrow back to the payer wallet.
2
+ * 1s_refund — reclaim unused payment-channel deposit back to the payer wallet.
3
+ *
4
+ * Rail-neutral: covers x402 batch channels (USDC on Base) and MPP session
5
+ * channels (USDC.e / pathUSD on Tempo). Routes to whichever channel is live for
6
+ * this session, so the same tool reclaims either deposit.
3
7
  */
4
8
  import type { ToolDef } from '../../types.js';
5
9
  export declare const tool: ToolDef;
@@ -1 +1 @@
1
- {"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../src/tools/chain/refund.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,IAAI,EAAE,OAuBlB,CAAC"}
1
+ {"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../../src/tools/chain/refund.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAK9C,eAAO,MAAM,IAAI,EAAE,OAiClB,CAAC"}
@@ -1,23 +1,32 @@
1
- import { getPaymentModeInfo, refundBatchChannel } from '../../x402.js';
1
+ import { getPaymentModeInfo } from '../../payment.js';
2
+ import { refundBatchChannel } from '../../x402.js';
3
+ import { reclaimMppSession, isMppSessionOpen } from '../../mpp.js';
2
4
  export const tool = {
3
5
  name: '1s_refund',
4
- description: 'Refund unused balance from your x402 batch payment channel back to your wallet on Base. ' +
5
- 'Batch mode deposits enough USDC up front to cover many calls (price × deposit multiplier); ' +
6
- 'whatever you do not spend stays locked in the channel. ' +
7
- 'Call this when you are done making batch calls to get the leftover escrow back right away, ' +
8
- 'instead of waiting for the gateway\'s automatic idle refund. Refunds the full remaining balance. ' +
9
- 'Only relevant when paying via x402 in batch mode (X402_PRIVATE_KEY set); with an API key, calls are covered by your plan and there is nothing to refund.',
6
+ description: 'Reclaim the unused deposit from an open payment channel back to your wallet right away, ' +
7
+ 'instead of waiting for the channel to be closed or auto-refunded. ' +
8
+ 'Channel modes deposit funds up front to cover many calls; whatever you do not spend stays locked until reclaimed. ' +
9
+ 'Works for whichever channel is active this session: x402 batch (USDC on Base) or MPP session (USDC.e/pathUSD on Tempo). ' +
10
+ 'Call this when you are done making channel-mode calls. ' +
11
+ 'Not needed for per-call modes (x402-exact / mpp-charge) or API-key auth there is no channel deposit to reclaim.',
10
12
  category: 'chain',
11
13
  schema: {},
12
14
  handler: async () => {
13
15
  const info = getPaymentModeInfo();
14
- if (!info.enabled) {
15
- return ('x402 payment is not active in this session, so there is no channel balance to refund. ' +
16
- 'Refunds apply only when paying per-call via x402 (set X402_PRIVATE_KEY to a funded Base wallet). ' +
17
- 'With an API key (ONESOURCE_API_KEY), calls are covered by your plan and no x402 payment is made.');
16
+ // MPP session channel: reclaim when on the MPP rail, or whenever a Tempo
17
+ // channel is open (e.g. opened in mpp-session, then switched to mpp-charge).
18
+ if (info.mode.startsWith('mpp-') || isMppSessionOpen()) {
19
+ const res = await reclaimMppSession();
20
+ return res.message;
18
21
  }
19
- const res = await refundBatchChannel();
20
- return res.message;
22
+ // x402 batch channel.
23
+ if (info.x402.enabled) {
24
+ const res = await refundBatchChannel();
25
+ return res.message;
26
+ }
27
+ return ('No payment channel is active in this session, so there is nothing to reclaim. ' +
28
+ 'Channel deposits exist only in x402 batch mode (set X402_PRIVATE_KEY on Base) or MPP session mode (set MPP_PRIVATE_KEY on Tempo). ' +
29
+ 'With an API key, calls are covered by your plan — no channel deposit to reclaim.');
21
30
  },
22
31
  };
23
32
  //# sourceMappingURL=refund.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refund.js","sourceRoot":"","sources":["../../../src/tools/chain/refund.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,0FAA0F;QAC1F,6FAA6F;QAC7F,yDAAyD;QACzD,6FAA6F;QAC7F,mGAAmG;QACnG,0JAA0J;IAC5J,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,GAAG,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,CACnF,CAAC;IACJ,CAAC;CACF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  import { z } from 'zod';
5
5
  import type { OneSourceClient } from './client.js';
6
6
  /** Authentication method used for a session. */
7
- export type AuthMethod = 'api_key' | 'x402' | 'none';
7
+ export type AuthMethod = 'api_key' | 'x402' | 'mpp' | 'none';
8
8
  /**
9
9
  * API response envelope — discriminated union on the `error` field.
10
10
  * Moved here from client.ts to avoid circular imports with formatResponse.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAC/B;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC9D;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CA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AAM,CAoB5D"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@one-source/api-mcp",
3
- "version": "5.4.7",
3
+ "version": "5.6.0",
4
4
  "type": "module",
5
- "description": "MCP server for OneSource blockchain data — 27 named tools for balances, NFTs, transactions, events, live chain queries, and x402 payment-mode + refund control via x402",
5
+ "description": "MCP server for OneSource blockchain data — named tools for balances, NFTs, transactions, events, live chain queries, with x402 (USDC on Base) and MPP (Tempo) pay-per-call payment rails",
6
6
  "bin": {
7
7
  "onesource-api-mcp": "./dist/cli.js"
8
8
  },
@@ -29,6 +29,14 @@
29
29
  "types": "./dist/x402.d.ts",
30
30
  "default": "./dist/x402.js"
31
31
  },
32
+ "./mpp": {
33
+ "types": "./dist/mpp.d.ts",
34
+ "default": "./dist/mpp.js"
35
+ },
36
+ "./payment": {
37
+ "types": "./dist/payment.d.ts",
38
+ "default": "./dist/payment.js"
39
+ },
32
40
  "./types": {
33
41
  "types": "./dist/types.d.ts",
34
42
  "default": "./dist/types.js"
@@ -47,6 +55,8 @@
47
55
  "blockchain",
48
56
  "ethereum",
49
57
  "x402",
58
+ "mpp",
59
+ "tempo",
50
60
  "nft",
51
61
  "erc20",
52
62
  "transactions"
@@ -67,7 +77,8 @@
67
77
  "@modelcontextprotocol/sdk": "^1.27.1",
68
78
  "@x402/evm": "^2.14.0",
69
79
  "@x402/fetch": "^2.14.0",
70
- "viem": "^2.0.0",
80
+ "mppx": "^0.7.0",
81
+ "viem": "^2.51.0",
71
82
  "zod": "^3.24.0"
72
83
  },
73
84
  "devDependencies": {