@agent-shield/mcp 0.1.0 → 0.2.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 (69) hide show
  1. package/README.md +2 -2
  2. package/dist/config.d.ts +18 -1
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js +57 -4
  5. package/dist/config.js.map +1 -1
  6. package/dist/errors.d.ts +1 -1
  7. package/dist/errors.d.ts.map +1 -1
  8. package/dist/errors.js +75 -3
  9. package/dist/errors.js.map +1 -1
  10. package/dist/index.js +228 -27
  11. package/dist/index.js.map +1 -1
  12. package/dist/resources/policy.js +5 -5
  13. package/dist/resources/policy.js.map +1 -1
  14. package/dist/resources/spending.d.ts.map +1 -1
  15. package/dist/resources/spending.js +6 -8
  16. package/dist/resources/spending.js.map +1 -1
  17. package/dist/tools/agent-transfer.d.ts +42 -0
  18. package/dist/tools/agent-transfer.d.ts.map +1 -0
  19. package/dist/tools/agent-transfer.js +52 -0
  20. package/dist/tools/agent-transfer.js.map +1 -0
  21. package/dist/tools/apply-pending-policy.d.ts +24 -0
  22. package/dist/tools/apply-pending-policy.d.ts.map +1 -0
  23. package/dist/tools/apply-pending-policy.js +34 -0
  24. package/dist/tools/apply-pending-policy.js.map +1 -0
  25. package/dist/tools/cancel-pending-policy.d.ts +24 -0
  26. package/dist/tools/cancel-pending-policy.d.ts.map +1 -0
  27. package/dist/tools/cancel-pending-policy.js +33 -0
  28. package/dist/tools/cancel-pending-policy.js.map +1 -0
  29. package/dist/tools/check-pending-policy.d.ts +24 -0
  30. package/dist/tools/check-pending-policy.d.ts.map +1 -0
  31. package/dist/tools/check-pending-policy.js +92 -0
  32. package/dist/tools/check-pending-policy.js.map +1 -0
  33. package/dist/tools/check-spending.js +2 -2
  34. package/dist/tools/check-spending.js.map +1 -1
  35. package/dist/tools/check-vault.d.ts.map +1 -1
  36. package/dist/tools/check-vault.js +30 -8
  37. package/dist/tools/check-vault.js.map +1 -1
  38. package/dist/tools/close-position.d.ts.map +1 -1
  39. package/dist/tools/close-position.js +4 -4
  40. package/dist/tools/close-position.js.map +1 -1
  41. package/dist/tools/create-vault.d.ts +24 -12
  42. package/dist/tools/create-vault.d.ts.map +1 -1
  43. package/dist/tools/create-vault.js +30 -7
  44. package/dist/tools/create-vault.js.map +1 -1
  45. package/dist/tools/index.d.ts +6 -0
  46. package/dist/tools/index.d.ts.map +1 -1
  47. package/dist/tools/index.js +26 -1
  48. package/dist/tools/index.js.map +1 -1
  49. package/dist/tools/open-position.d.ts.map +1 -1
  50. package/dist/tools/open-position.js +5 -7
  51. package/dist/tools/open-position.js.map +1 -1
  52. package/dist/tools/provision.d.ts +60 -0
  53. package/dist/tools/provision.d.ts.map +1 -0
  54. package/dist/tools/provision.js +85 -0
  55. package/dist/tools/provision.js.map +1 -0
  56. package/dist/tools/queue-policy-update.d.ts +84 -0
  57. package/dist/tools/queue-policy-update.d.ts.map +1 -0
  58. package/dist/tools/queue-policy-update.js +117 -0
  59. package/dist/tools/queue-policy-update.js.map +1 -0
  60. package/dist/tools/reactivate-vault.d.ts.map +1 -1
  61. package/dist/tools/reactivate-vault.js +1 -3
  62. package/dist/tools/reactivate-vault.js.map +1 -1
  63. package/dist/tools/update-policy.d.ts +24 -12
  64. package/dist/tools/update-policy.d.ts.map +1 -1
  65. package/dist/tools/update-policy.js +32 -9
  66. package/dist/tools/update-policy.js.map +1 -1
  67. package/dist/utils.d.ts.map +1 -1
  68. package/dist/utils.js.map +1 -1
  69. package/package.json +19 -9
package/README.md CHANGED
@@ -105,7 +105,7 @@ pnpm install
105
105
  # Build
106
106
  pnpm build
107
107
 
108
- # Run tests (78 tests)
108
+ # Run tests (82 tests)
109
109
  pnpm test
110
110
 
111
111
  # Smoke test
@@ -117,7 +117,7 @@ AGENTSHIELD_WALLET_PATH=~/.config/solana/id.json node dist/index.js
117
117
  - **Transport**: stdio only (local subprocess of the AI tool)
118
118
  - **Credentials**: Environment variables (keypair file paths)
119
119
  - **SDK**: Wraps `AgentShieldClient` from `@agent-shield/sdk` — every tool delegates to a client method
120
- - **Error handling**: All 28 Anchor error codes mapped to human-readable messages with actionable suggestions
120
+ - **Error handling**: All 37 Anchor error codes mapped to human-readable messages with actionable suggestions
121
121
 
122
122
  ## License
123
123
 
package/dist/config.d.ts CHANGED
@@ -1,12 +1,29 @@
1
1
  import { Keypair } from "@solana/web3.js";
2
2
  import { AgentShieldClient } from "@agent-shield/sdk";
3
+ /** Supported custody providers for MCP server. */
4
+ export type McpCustodyProvider = "crossmint" | "turnkey" | "privy";
3
5
  export interface McpConfig {
4
- walletPath: string;
6
+ /** Path to owner wallet keypair JSON. Not needed when using custody. */
7
+ walletPath?: string;
5
8
  rpcUrl: string;
6
9
  agentKeypairPath?: string;
10
+ /** TEE custody provider — when set, walletPath is not required. */
11
+ custodyProvider?: McpCustodyProvider;
12
+ /** Crossmint API key (when custodyProvider = "crossmint"). */
13
+ crossmintApiKey?: string;
14
+ /** Crossmint wallet locator (optional — creates new wallet if omitted). */
15
+ crossmintLocator?: string;
7
16
  }
8
17
  export declare function loadConfig(): McpConfig;
9
18
  export declare function loadKeypair(path: string): Keypair;
10
19
  export declare function createClient(config: McpConfig): AgentShieldClient;
20
+ /**
21
+ * Create a WalletLike from a TEE custody provider.
22
+ * Dynamically imports the provider adapter to avoid hard dependencies.
23
+ */
24
+ export declare function createCustodyWallet(config: McpConfig): Promise<{
25
+ publicKey: import("@solana/web3.js").PublicKey;
26
+ signTransaction: Function;
27
+ }>;
11
28
  export declare function loadAgentKeypair(config: McpConfig): Keypair;
12
29
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAiB,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,C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wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAQ3D"}
package/dist/config.js CHANGED
@@ -36,19 +36,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.loadConfig = loadConfig;
37
37
  exports.loadKeypair = loadKeypair;
38
38
  exports.createClient = createClient;
39
+ exports.createCustodyWallet = createCustodyWallet;
39
40
  exports.loadAgentKeypair = loadAgentKeypair;
40
41
  const web3_js_1 = require("@solana/web3.js");
41
42
  const anchor_1 = require("@coral-xyz/anchor");
42
43
  const sdk_1 = require("@agent-shield/sdk");
43
44
  const fs = __importStar(require("fs"));
44
45
  function loadConfig() {
46
+ const rpcUrl = process.env.AGENTSHIELD_RPC_URL || (0, web3_js_1.clusterApiUrl)("devnet");
47
+ const agentKeypairPath = process.env.AGENTSHIELD_AGENT_KEYPAIR_PATH || undefined;
48
+ const custodyProvider = process.env.AGENTSHIELD_CUSTODY;
49
+ if (custodyProvider) {
50
+ // TEE custody path — no wallet file needed
51
+ return {
52
+ rpcUrl,
53
+ agentKeypairPath,
54
+ custodyProvider,
55
+ crossmintApiKey: process.env.CROSSMINT_API_KEY || undefined,
56
+ crossmintLocator: process.env.CROSSMINT_WALLET_LOCATOR || undefined,
57
+ };
58
+ }
59
+ // Legacy path — keypair file required
45
60
  const walletPath = process.env.AGENTSHIELD_WALLET_PATH;
46
61
  if (!walletPath) {
47
- throw new Error("AGENTSHIELD_WALLET_PATH is required. " +
48
- "Set it to the path of your Solana keypair JSON file.");
62
+ throw new Error("AGENTSHIELD_WALLET_PATH is required (or set AGENTSHIELD_CUSTODY " +
63
+ "to a custody provider: crossmint, turnkey, privy). " +
64
+ "Set AGENTSHIELD_WALLET_PATH to the path of your Solana keypair JSON file.");
49
65
  }
50
- const rpcUrl = process.env.AGENTSHIELD_RPC_URL || (0, web3_js_1.clusterApiUrl)("devnet");
51
- const agentKeypairPath = process.env.AGENTSHIELD_AGENT_KEYPAIR_PATH || undefined;
52
66
  return { walletPath, rpcUrl, agentKeypairPath };
53
67
  }
54
68
  function loadKeypair(path) {
@@ -60,11 +74,50 @@ function loadKeypair(path) {
60
74
  return web3_js_1.Keypair.fromSecretKey(secretKey);
61
75
  }
62
76
  function createClient(config) {
77
+ if (!config.walletPath) {
78
+ throw new Error("createClient requires walletPath. " +
79
+ "For custody-based wallets, use createCustodyClient() instead.");
80
+ }
63
81
  const keypair = loadKeypair(config.walletPath);
64
82
  const wallet = new anchor_1.Wallet(keypair);
65
83
  const connection = new web3_js_1.Connection(config.rpcUrl, "confirmed");
66
84
  return new sdk_1.AgentShieldClient(connection, wallet);
67
85
  }
86
+ /**
87
+ * Create a WalletLike from a TEE custody provider.
88
+ * Dynamically imports the provider adapter to avoid hard dependencies.
89
+ */
90
+ async function createCustodyWallet(config) {
91
+ switch (config.custodyProvider) {
92
+ case "crossmint": {
93
+ if (!config.crossmintApiKey) {
94
+ throw new Error("CROSSMINT_API_KEY is required when AGENTSHIELD_CUSTODY=crossmint.");
95
+ }
96
+ // Dynamic require to avoid hard dependency on custody adapter.
97
+ let mod;
98
+ try {
99
+ mod = require("@agent-shield/custody-crossmint");
100
+ }
101
+ catch {
102
+ throw new Error("@agent-shield/custody-crossmint is not installed. " +
103
+ "Run: npm install @agent-shield/custody-crossmint");
104
+ }
105
+ return mod.crossmint({
106
+ apiKey: config.crossmintApiKey,
107
+ locator: config.crossmintLocator,
108
+ });
109
+ }
110
+ case "turnkey":
111
+ throw new Error("Turnkey custody adapter is not yet available. " +
112
+ "Install @agent-shield/custody-turnkey when released.");
113
+ case "privy":
114
+ throw new Error("Privy custody adapter is not yet available. " +
115
+ "Install @agent-shield/custody-privy when released.");
116
+ default:
117
+ throw new Error(`Unknown custody provider '${config.custodyProvider}'. ` +
118
+ "Supported: crossmint, turnkey, privy.");
119
+ }
120
+ }
68
121
  function loadAgentKeypair(config) {
69
122
  if (!config.agentKeypairPath) {
70
123
  throw new Error("AGENTSHIELD_AGENT_KEYPAIR_PATH is required for agent-signed operations. " +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AAC,eAAe,EAAE,CAAC;QAC/B,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;YACJ,CAAC;YACD,+DAA+D;YAC/D,IAAI,GAAQ,CAAC;YACb,IAAI,CAAC;gBACH,GAAG,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;YACnD,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,oDAAoD;oBAClD,kDAAkD,CACrD,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,CAAC,SAAS,CAAC;gBACnB,MAAM,EAAE,MAAM,CAAC,eAAe;gBAC9B,OAAO,EAAE,MAAM,CAAC,gBAAgB;aACjC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,SAAS;YACZ,MAAM,IAAI,KAAK,CACb,gDAAgD;gBAC9C,sDAAsD,CACzD,CAAC;QACJ,KAAK,OAAO;YACV,MAAM,IAAI,KAAK,CACb,8CAA8C;gBAC5C,oDAAoD,CACvD,CAAC;QACJ;YACE,MAAM,IAAI,KAAK,CACb,6BAA6B,MAAM,CAAC,eAAe,KAAK;gBACtD,uCAAuC,CAC1C,CAAC;IACN,CAAC;AACH,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAiB;IAChD,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,0EAA0E;YACxE,6DAA6D,CAChE,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface ErrorInfo {
5
5
  suggestion: string;
6
6
  }
7
7
  /**
8
- * Maps all 28 AgentShield Anchor error codes (6000–6027) to
8
+ * Maps all 40 AgentShield Anchor error codes (6000–6039) to
9
9
  * human-readable messages with actionable suggestions for AI tools.
10
10
  */
11
11
  declare const ERROR_MAP: Record<number, ErrorInfo>;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAsMxC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CASnD;AA6BD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmClD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAiRxC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CASnD;AA6BD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmClD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/dist/errors.js CHANGED
@@ -4,7 +4,7 @@ exports.ERROR_MAP = void 0;
4
4
  exports.lookupError = lookupError;
5
5
  exports.formatError = formatError;
6
6
  /**
7
- * Maps all 28 AgentShield Anchor error codes (6000–6027) to
7
+ * Maps all 40 AgentShield Anchor error codes (6000–6039) to
8
8
  * human-readable messages with actionable suggestions for AI tools.
9
9
  */
10
10
  const ERROR_MAP = {
@@ -42,13 +42,13 @@ const ERROR_MAP = {
42
42
  code: 6005,
43
43
  name: "TransactionTooLarge",
44
44
  message: "Transaction exceeds maximum single transaction size",
45
- suggestion: "Reduce the amount or use shield_update_policy to increase maxTransactionSize.",
45
+ suggestion: "Reduce the amount or use shield_update_policy to increase maxTransactionSizeUsd.",
46
46
  },
47
47
  6006: {
48
48
  code: 6006,
49
49
  name: "DailyCapExceeded",
50
50
  message: "Daily spending cap would be exceeded",
51
- suggestion: "Wait for the 24h rolling window to reset, or use shield_update_policy to increase dailySpendingCap.",
51
+ suggestion: "Wait for the 24h rolling window to reset, or use shield_update_policy to increase dailySpendingCapUsd.",
52
52
  },
53
53
  6007: {
54
54
  code: 6007,
@@ -176,6 +176,78 @@ const ERROR_MAP = {
176
176
  message: "Arithmetic overflow",
177
177
  suggestion: "The amount is too large. Reduce the value and try again.",
178
178
  },
179
+ 6028: {
180
+ code: 6028,
181
+ name: "DelegationFailed",
182
+ message: "Token delegation approval failed",
183
+ suggestion: "The vault may not have sufficient token balance. Check vault balance and try again.",
184
+ },
185
+ 6029: {
186
+ code: 6029,
187
+ name: "RevocationFailed",
188
+ message: "Token delegation revocation failed",
189
+ suggestion: "The session may have already been finalized. Check session status.",
190
+ },
191
+ 6030: {
192
+ code: 6030,
193
+ name: "OracleFeedStale",
194
+ message: "Oracle feed value is too stale",
195
+ suggestion: "The oracle price data is outdated. Wait for a fresh price update and retry.",
196
+ },
197
+ 6031: {
198
+ code: 6031,
199
+ name: "OracleFeedInvalid",
200
+ message: "Cannot parse oracle feed data",
201
+ suggestion: "The oracle feed account data is malformed or the account key doesn't match the policy. Verify the oracle configuration.",
202
+ },
203
+ 6032: {
204
+ code: 6032,
205
+ name: "TokenSpendBlocked",
206
+ message: "Unpriced token cannot be spent (receive-only)",
207
+ suggestion: "This token is configured as receive-only and cannot be used for spending.",
208
+ },
209
+ 6033: {
210
+ code: 6033,
211
+ name: "InvalidTokenAccount",
212
+ message: "Token account does not belong to vault or has wrong mint",
213
+ suggestion: "Ensure the token account is owned by the vault PDA and matches the token mint.",
214
+ },
215
+ 6034: {
216
+ code: 6034,
217
+ name: "OracleAccountMissing",
218
+ message: "Oracle-priced token requires feed account in remaining_accounts",
219
+ suggestion: "Pass the oracle feed account when transacting with oracle-priced tokens. The SDK resolves this automatically.",
220
+ },
221
+ 6035: {
222
+ code: 6035,
223
+ name: "PerTokenCapExceeded",
224
+ message: "Per-token daily spending cap would be exceeded",
225
+ suggestion: "Wait for the 24h rolling window to reset, or use shield_update_policy to increase the per-token cap.",
226
+ },
227
+ 6036: {
228
+ code: 6036,
229
+ name: "PerTokenTxLimitExceeded",
230
+ message: "Per-token single transaction limit exceeded",
231
+ suggestion: "Reduce the amount or use shield_update_policy to increase the per-token transaction limit.",
232
+ },
233
+ 6037: {
234
+ code: 6037,
235
+ name: "OracleConfidenceTooWide",
236
+ message: "Oracle price confidence interval too wide",
237
+ suggestion: "The oracle price has high uncertainty (>10% confidence interval). Wait for more stable market conditions and retry.",
238
+ },
239
+ 6038: {
240
+ code: 6038,
241
+ name: "OracleUnsupportedType",
242
+ message: "Oracle account owner is not a recognized oracle program",
243
+ suggestion: "The oracle feed account must be owned by either Pyth Receiver or Switchboard On-Demand program. Check the policy configuration.",
244
+ },
245
+ 6039: {
246
+ code: 6039,
247
+ name: "OracleNotVerified",
248
+ message: "Pyth price update not fully verified by Wormhole",
249
+ suggestion: "The Pyth price update has not been verified by Wormhole guardians. Use a fully verified price feed.",
250
+ },
179
251
  };
180
252
  exports.ERROR_MAP = ERROR_MAP;
181
253
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAuNA,kCASC;AAgCD,kCAmCC;AA5RD;;;GAGG;AACH,MAAM,SAAS,GAA8B;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE,IAAI;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2FAA2F,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,UAAU,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACnC,CAAC"}
package/dist/index.js CHANGED
@@ -18,6 +18,12 @@ const reactivate_vault_1 = require("./tools/reactivate-vault");
18
18
  const execute_swap_1 = require("./tools/execute-swap");
19
19
  const open_position_1 = require("./tools/open-position");
20
20
  const close_position_1 = require("./tools/close-position");
21
+ const provision_1 = require("./tools/provision");
22
+ const queue_policy_update_1 = require("./tools/queue-policy-update");
23
+ const apply_pending_policy_1 = require("./tools/apply-pending-policy");
24
+ const cancel_pending_policy_1 = require("./tools/cancel-pending-policy");
25
+ const check_pending_policy_1 = require("./tools/check-pending-policy");
26
+ const agent_transfer_1 = require("./tools/agent-transfer");
21
27
  // Resources
22
28
  const policy_1 = require("./resources/policy");
23
29
  const spending_1 = require("./resources/spending");
@@ -58,9 +64,17 @@ async function main() {
58
64
  });
59
65
  // ── Read-Only Tools ──────────────────────────────────────────
60
66
  registerTool(server, "shield_check_vault", "Check the status and policy configuration of an AgentShield vault", {
61
- vault: zod_1.z.string().describe("Vault PDA address (base58). Provide this OR owner+vaultId."),
62
- owner: zod_1.z.string().optional().describe("Owner public key (base58). Used with vaultId."),
63
- vaultId: zod_1.z.string().optional().describe("Vault ID number. Used with owner."),
67
+ vault: zod_1.z
68
+ .string()
69
+ .describe("Vault PDA address (base58). Provide this OR owner+vaultId."),
70
+ owner: zod_1.z
71
+ .string()
72
+ .optional()
73
+ .describe("Owner public key (base58). Used with vaultId."),
74
+ vaultId: zod_1.z
75
+ .string()
76
+ .optional()
77
+ .describe("Vault ID number. Used with owner."),
64
78
  }, async (input) => ({
65
79
  content: [{ type: "text", text: await (0, check_vault_1.checkVault)(client, input) }],
66
80
  }));
@@ -69,17 +83,51 @@ async function main() {
69
83
  }, async (input) => ({
70
84
  content: [{ type: "text", text: await (0, check_spending_1.checkSpending)(client, input) }],
71
85
  }));
86
+ registerTool(server, "shield_check_pending_policy", "Check if a pending timelocked policy update exists for a vault", {
87
+ vault: zod_1.z.string().describe("Vault PDA address (base58)"),
88
+ }, async (input) => ({
89
+ content: [
90
+ { type: "text", text: await (0, check_pending_policy_1.checkPendingPolicy)(client, input) },
91
+ ],
92
+ }));
72
93
  // ── Owner-Signed Write Tools ────────────────────────────────
73
94
  registerTool(server, "shield_create_vault", "Create a new AgentShield vault with policy configuration", {
74
95
  vaultId: zod_1.z.string().describe("Unique vault ID number"),
75
- dailySpendingCap: zod_1.z.string().describe("Max daily spending in token base units"),
76
- maxTransactionSize: zod_1.z.string().describe("Max single transaction size in token base units"),
77
- allowedTokens: zod_1.z.array(zod_1.z.string()).describe("Allowed token mint addresses (base58). Max 10."),
78
- allowedProtocols: zod_1.z.array(zod_1.z.string()).describe("Allowed protocol program IDs (base58). Max 10."),
79
- maxLeverageBps: zod_1.z.number().describe("Max leverage in basis points (e.g. 30000 = 3x)"),
80
- maxConcurrentPositions: zod_1.z.number().describe("Max concurrent open positions"),
81
- feeDestination: zod_1.z.string().describe("Fee destination wallet address (base58). Immutable."),
82
- developerFeeRate: zod_1.z.number().optional().default(0).describe("Developer fee rate (max 50 = 0.5 BPS)"),
96
+ dailySpendingCapUsd: zod_1.z
97
+ .string()
98
+ .describe("Max daily spending in USD base units"),
99
+ maxTransactionSizeUsd: zod_1.z
100
+ .string()
101
+ .describe("Max single transaction size in USD base units"),
102
+ allowedTokens: zod_1.z
103
+ .array(zod_1.z.string())
104
+ .describe("Allowed token mint addresses (base58). Max 10."),
105
+ allowedProtocols: zod_1.z
106
+ .array(zod_1.z.string())
107
+ .describe("Allowed protocol program IDs (base58). Max 10."),
108
+ maxLeverageBps: zod_1.z
109
+ .number()
110
+ .describe("Max leverage in basis points (e.g. 30000 = 3x)"),
111
+ maxConcurrentPositions: zod_1.z
112
+ .number()
113
+ .describe("Max concurrent open positions"),
114
+ feeDestination: zod_1.z
115
+ .string()
116
+ .describe("Fee destination wallet address (base58). Immutable."),
117
+ developerFeeRate: zod_1.z
118
+ .number()
119
+ .optional()
120
+ .default(0)
121
+ .describe("Developer fee rate (max 50 = 0.5 BPS)"),
122
+ allowedDestinations: zod_1.z
123
+ .array(zod_1.z.string())
124
+ .optional()
125
+ .describe("Allowed destination addresses for agent transfers (base58). Max 10."),
126
+ timelockDuration: zod_1.z
127
+ .number()
128
+ .optional()
129
+ .default(0)
130
+ .describe("Timelock duration in seconds (0 = immediate policy updates)"),
83
131
  }, async (input) => ({
84
132
  content: [{ type: "text", text: await (0, create_vault_1.createVault)(client, input) }],
85
133
  }));
@@ -105,17 +153,104 @@ async function main() {
105
153
  }));
106
154
  registerTool(server, "shield_update_policy", "Update the policy configuration for a vault (owner-only)", {
107
155
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
108
- dailySpendingCap: zod_1.z.string().optional().describe("New daily spending cap"),
109
- maxTransactionSize: zod_1.z.string().optional().describe("New max transaction size"),
110
- allowedTokens: zod_1.z.array(zod_1.z.string()).optional().describe("New allowed token mints (base58)"),
111
- allowedProtocols: zod_1.z.array(zod_1.z.string()).optional().describe("New allowed protocols (base58)"),
156
+ dailySpendingCapUsd: zod_1.z
157
+ .string()
158
+ .optional()
159
+ .describe("New daily spending cap in USD"),
160
+ maxTransactionSizeUsd: zod_1.z
161
+ .string()
162
+ .optional()
163
+ .describe("New max transaction size in USD"),
164
+ allowedTokens: zod_1.z
165
+ .array(zod_1.z.string())
166
+ .optional()
167
+ .describe("New allowed token mints (base58)"),
168
+ allowedProtocols: zod_1.z
169
+ .array(zod_1.z.string())
170
+ .optional()
171
+ .describe("New allowed protocols (base58)"),
112
172
  maxLeverageBps: zod_1.z.number().optional().describe("New max leverage in BPS"),
113
- canOpenPositions: zod_1.z.boolean().optional().describe("Whether agent can open positions"),
114
- maxConcurrentPositions: zod_1.z.number().optional().describe("New max concurrent positions"),
115
- developerFeeRate: zod_1.z.number().optional().describe("New developer fee rate (max 50)"),
173
+ canOpenPositions: zod_1.z
174
+ .boolean()
175
+ .optional()
176
+ .describe("Whether agent can open positions"),
177
+ maxConcurrentPositions: zod_1.z
178
+ .number()
179
+ .optional()
180
+ .describe("New max concurrent positions"),
181
+ developerFeeRate: zod_1.z
182
+ .number()
183
+ .optional()
184
+ .describe("New developer fee rate (max 50)"),
185
+ allowedDestinations: zod_1.z
186
+ .array(zod_1.z.string())
187
+ .optional()
188
+ .describe("New allowed destinations (base58)"),
189
+ timelockDuration: zod_1.z
190
+ .number()
191
+ .optional()
192
+ .describe("New timelock duration in seconds"),
116
193
  }, async (input) => ({
117
194
  content: [{ type: "text", text: await (0, update_policy_1.updatePolicy)(client, input) }],
118
195
  }));
196
+ registerTool(server, "shield_queue_policy_update", "Queue a timelocked policy change (required when timelock_duration > 0)", {
197
+ vault: zod_1.z.string().describe("Vault PDA address (base58)"),
198
+ dailySpendingCapUsd: zod_1.z
199
+ .string()
200
+ .optional()
201
+ .describe("New daily spending cap in USD"),
202
+ maxTransactionSizeUsd: zod_1.z
203
+ .string()
204
+ .optional()
205
+ .describe("New max transaction size in USD"),
206
+ allowedTokens: zod_1.z
207
+ .array(zod_1.z.string())
208
+ .optional()
209
+ .describe("New allowed token mints (base58)"),
210
+ allowedProtocols: zod_1.z
211
+ .array(zod_1.z.string())
212
+ .optional()
213
+ .describe("New allowed protocols (base58)"),
214
+ allowedDestinations: zod_1.z
215
+ .array(zod_1.z.string())
216
+ .optional()
217
+ .describe("New allowed destinations (base58)"),
218
+ maxLeverageBps: zod_1.z.number().optional().describe("New max leverage in BPS"),
219
+ canOpenPositions: zod_1.z
220
+ .boolean()
221
+ .optional()
222
+ .describe("Whether agent can open positions"),
223
+ maxConcurrentPositions: zod_1.z
224
+ .number()
225
+ .optional()
226
+ .describe("New max concurrent positions"),
227
+ timelockDuration: zod_1.z
228
+ .number()
229
+ .optional()
230
+ .describe("New timelock duration in seconds"),
231
+ developerFeeRate: zod_1.z
232
+ .number()
233
+ .optional()
234
+ .describe("New developer fee rate (max 50)"),
235
+ }, async (input) => ({
236
+ content: [
237
+ { type: "text", text: await (0, queue_policy_update_1.queuePolicyUpdate)(client, input) },
238
+ ],
239
+ }));
240
+ registerTool(server, "shield_apply_pending_policy", "Apply a pending timelocked policy update after timelock expires", {
241
+ vault: zod_1.z.string().describe("Vault PDA address (base58)"),
242
+ }, async (input) => ({
243
+ content: [
244
+ { type: "text", text: await (0, apply_pending_policy_1.applyPendingPolicy)(client, input) },
245
+ ],
246
+ }));
247
+ registerTool(server, "shield_cancel_pending_policy", "Cancel a pending timelocked policy update before it takes effect", {
248
+ vault: zod_1.z.string().describe("Vault PDA address (base58)"),
249
+ }, async (input) => ({
250
+ content: [
251
+ { type: "text", text: await (0, cancel_pending_policy_1.cancelPendingPolicy)(client, input) },
252
+ ],
253
+ }));
119
254
  registerTool(server, "shield_revoke_agent", "Emergency kill switch — revokes agent and freezes vault immediately", {
120
255
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
121
256
  }, async (input) => ({
@@ -123,39 +258,105 @@ async function main() {
123
258
  }));
124
259
  registerTool(server, "shield_reactivate_vault", "Reactivate a frozen vault, optionally with a new agent", {
125
260
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
126
- newAgent: zod_1.z.string().optional().describe("Optional new agent public key (base58)"),
261
+ newAgent: zod_1.z
262
+ .string()
263
+ .optional()
264
+ .describe("Optional new agent public key (base58)"),
127
265
  }, async (input) => ({
128
266
  content: [{ type: "text", text: await (0, reactivate_vault_1.reactivateVault)(client, input) }],
129
267
  }));
130
268
  // ── Agent-Signed Tools ──────────────────────────────────────
269
+ registerTool(server, "shield_agent_transfer", "Transfer tokens from a vault to an allowed destination (agent-signed)", {
270
+ vault: zod_1.z.string().describe("Vault PDA address (base58)"),
271
+ destination: zod_1.z
272
+ .string()
273
+ .describe("Destination wallet address (base58). Must be in allowed_destinations if configured."),
274
+ mint: zod_1.z.string().describe("Token mint address (base58)"),
275
+ amount: zod_1.z.string().describe("Amount in token base units"),
276
+ }, async (input) => ({
277
+ content: [
278
+ { type: "text", text: await (0, agent_transfer_1.agentTransfer)(client, input) },
279
+ ],
280
+ }));
131
281
  registerTool(server, "shield_execute_swap", "Execute a Jupiter token swap through an AgentShield vault", {
132
282
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
133
283
  inputMint: zod_1.z.string().describe("Input token mint address (base58)"),
134
284
  outputMint: zod_1.z.string().describe("Output token mint address (base58)"),
135
285
  amount: zod_1.z.string().describe("Input amount in token base units"),
136
- slippageBps: zod_1.z.number().optional().default(50).describe("Slippage tolerance in BPS (default: 50)"),
286
+ slippageBps: zod_1.z
287
+ .number()
288
+ .optional()
289
+ .default(50)
290
+ .describe("Slippage tolerance in BPS (default: 50)"),
137
291
  }, async (input) => ({
138
- content: [{ type: "text", text: await (0, execute_swap_1.executeSwap)(client, config, input) }],
292
+ content: [
293
+ { type: "text", text: await (0, execute_swap_1.executeSwap)(client, config, input) },
294
+ ],
139
295
  }));
140
296
  registerTool(server, "shield_open_position", "Open a leveraged perpetual position via Flash Trade through a vault", {
141
297
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
142
298
  market: zod_1.z.string().describe("Market/pool name (e.g. 'SOL', 'ETH')"),
143
- collateralMint: zod_1.z.string().describe("Collateral token mint address (base58)"),
144
- collateralAmount: zod_1.z.string().describe("Collateral amount in token base units"),
299
+ collateralMint: zod_1.z
300
+ .string()
301
+ .describe("Collateral token mint address (base58)"),
302
+ collateralAmount: zod_1.z
303
+ .string()
304
+ .describe("Collateral amount in token base units"),
145
305
  sizeUsd: zod_1.z.string().describe("Position size in USD base units"),
146
306
  side: zod_1.z.enum(["long", "short"]).describe("Position side"),
147
- leverageBps: zod_1.z.number().describe("Leverage in basis points (e.g. 20000 = 2x)"),
307
+ leverageBps: zod_1.z
308
+ .number()
309
+ .describe("Leverage in basis points (e.g. 20000 = 2x)"),
148
310
  }, async (input) => ({
149
- content: [{ type: "text", text: await (0, open_position_1.openPosition)(client, config, input) }],
311
+ content: [
312
+ { type: "text", text: await (0, open_position_1.openPosition)(client, config, input) },
313
+ ],
150
314
  }));
151
315
  registerTool(server, "shield_close_position", "Close a leveraged perpetual position via Flash Trade through a vault", {
152
316
  vault: zod_1.z.string().describe("Vault PDA address (base58)"),
153
317
  market: zod_1.z.string().describe("Market/pool name (e.g. 'SOL', 'ETH')"),
154
318
  side: zod_1.z.enum(["long", "short"]).describe("Position side"),
155
319
  priceWithSlippage: zod_1.z.string().describe("Exit price in base units"),
156
- priceExponent: zod_1.z.number().optional().default(0).describe("Price exponent (default: 0)"),
320
+ priceExponent: zod_1.z
321
+ .number()
322
+ .optional()
323
+ .default(0)
324
+ .describe("Price exponent (default: 0)"),
325
+ }, async (input) => ({
326
+ content: [
327
+ { type: "text", text: await (0, close_position_1.closePosition)(client, config, input) },
328
+ ],
329
+ }));
330
+ // ── Platform Tools ─────────────────────────────────────────
331
+ registerTool(server, "shield_provision", "Generate a Solana Action URL (Blink) for one-click vault provisioning. The user clicks the link to approve — no agent signing needed.", {
332
+ platformUrl: zod_1.z
333
+ .string()
334
+ .optional()
335
+ .default("https://agent-middleware.vercel.app")
336
+ .describe("AgentShield Actions server URL"),
337
+ template: zod_1.z
338
+ .enum(["conservative", "moderate", "aggressive"])
339
+ .optional()
340
+ .default("conservative")
341
+ .describe("Policy template"),
342
+ dailyCap: zod_1.z
343
+ .number()
344
+ .optional()
345
+ .describe("Custom daily spending cap in USDC"),
346
+ agentPubkey: zod_1.z
347
+ .string()
348
+ .optional()
349
+ .describe("Agent public key (base58) to register in the vault"),
350
+ allowedProtocols: zod_1.z
351
+ .array(zod_1.z.string())
352
+ .optional()
353
+ .describe("Custom allowed protocol program IDs (base58)"),
354
+ maxLeverageBps: zod_1.z
355
+ .number()
356
+ .optional()
357
+ .describe("Custom max leverage in basis points"),
157
358
  }, async (input) => ({
158
- content: [{ type: "text", text: await (0, close_position_1.closePosition)(client, config, input) }],
359
+ content: [{ type: "text", text: await (0, provision_1.provision)(client, input) }],
159
360
  }));
160
361
  // ── MCP Resources ───────────────────────────────────────────
161
362
  server.resource("vault-policy", "shield://vault/{address}/policy", { description: "Current policy configuration for a vault" }, async (uri) => {