@agentwonderland/mcp 0.1.2 → 0.1.3

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,5 +1,5 @@
1
1
  /**
2
- * Shared display formatters for human-readable MCP and CLI output.
2
+ * Shared display formatters for human-readable MCP output.
3
3
  * Plain text only — no ANSI color codes.
4
4
  */
5
5
  export declare function stars(rating: number | null | undefined): string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared display formatters for human-readable MCP and CLI output.
2
+ * Shared display formatters for human-readable MCP output.
3
3
  * Plain text only — no ANSI color codes.
4
4
  */
5
5
  // ── Stars ────────────────────────────────────────────────────────
@@ -180,7 +180,7 @@ export function formatFeedbackSummary(stats) {
180
180
  }
181
181
  export function formatWalletStatus(info) {
182
182
  if (info.wallets.length === 0 && !info.card) {
183
- return "No payment methods configured.\nRun: aw wallet setup";
183
+ return "No payment methods configured.\nUse the wallet_setup tool to create or import a wallet.";
184
184
  }
185
185
  const lines = ["Payment methods:"];
186
186
  for (const w of info.wallets) {
@@ -5,7 +5,7 @@
5
5
  * any other viem-based flow can use OWS-managed keys transparently.
6
6
  *
7
7
  * The OWS SDK (`@open-wallet-standard/core`) is a NAPI native module.
8
- * ALL imports are dynamic so the CLI works without OWS installed.
8
+ * ALL imports are dynamic so the MCP server works without OWS installed.
9
9
  */
10
10
  import type { LocalAccount } from "viem/accounts";
11
11
  /**
@@ -5,17 +5,29 @@
5
5
  * any other viem-based flow can use OWS-managed keys transparently.
6
6
  *
7
7
  * The OWS SDK (`@open-wallet-standard/core`) is a NAPI native module.
8
- * ALL imports are dynamic so the CLI works without OWS installed.
8
+ * ALL imports are dynamic so the MCP server works without OWS installed.
9
9
  */
10
10
  // ── Helpers ──────────────────────────────────────────────────────
11
11
  const OWS_INSTALL_HINT = "OWS is not installed. Install with: npm install -g @open-wallet-standard/core";
12
12
  async function loadOws() {
13
+ // Try local/project resolution first
13
14
  try {
14
15
  // @ts-ignore — optional peer dep, dynamically imported
15
16
  return (await import("@open-wallet-standard/core"));
16
17
  }
17
18
  catch {
18
- throw new Error(OWS_INSTALL_HINT);
19
+ // Fallback: resolve from global npm prefix using createRequire
20
+ // (npx runs in an isolated context that can't see globally-installed native modules)
21
+ try {
22
+ const { execSync } = await import("node:child_process");
23
+ const { createRequire } = await import("node:module");
24
+ const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
25
+ const globalRequire = createRequire(globalRoot + "/");
26
+ return globalRequire("@open-wallet-standard/core");
27
+ }
28
+ catch {
29
+ throw new Error(OWS_INSTALL_HINT);
30
+ }
19
31
  }
20
32
  }
21
33
  function findEvmAccount(wallet) {
@@ -32,8 +44,7 @@ function findEvmAccount(wallet) {
32
44
  */
33
45
  export async function isOwsAvailable() {
34
46
  try {
35
- // @ts-ignore — optional peer dep, dynamically imported
36
- await import("@open-wallet-standard/core");
47
+ await loadOws();
37
48
  return true;
38
49
  }
39
50
  catch {
@@ -27,7 +27,7 @@ export declare function getConfiguredMethods(): string[];
27
27
  export declare function paymentMethodDisplayName(method: string): string;
28
28
  /**
29
29
  * Return the consumer's configured payment methods in registry API format.
30
- * Maps CLI method names (tempo, base, card) to registry identifiers
30
+ * Maps method names (tempo, base, card) to registry identifiers
31
31
  * (tempo_usdc, base_usdc, stripe_card).
32
32
  */
33
33
  export declare function getAcceptedPaymentMethods(): string[];
@@ -102,13 +102,13 @@ export async function getPaymentFetch(method) {
102
102
  fetchCache.set(ck, pf);
103
103
  return pf;
104
104
  }
105
- throw new Error('Payment method "card" is not configured. Run: aw wallet setup');
105
+ throw new Error('Payment method "card" is not configured. Use the wallet_setup tool to configure a wallet');
106
106
  }
107
107
  // Explicit method requested (wallet ID or chain name)
108
108
  if (method) {
109
109
  const resolved = resolveWalletAndChain(method);
110
110
  if (!resolved) {
111
- throw new Error(`Payment method "${method}" is not configured. Run: aw wallet setup`);
111
+ throw new Error(`Payment method "${method}" is not configured. Use the wallet_setup tool to configure a wallet`);
112
112
  }
113
113
  const ck = cacheKey(resolved.wallet.id, resolved.chain);
114
114
  if (fetchCache.has(ck))
@@ -118,7 +118,7 @@ export async function getPaymentFetch(method) {
118
118
  fetchCache.set(ck, pf);
119
119
  return pf;
120
120
  }
121
- throw new Error(`Payment method "${method}" is not configured. Run: aw wallet setup`);
121
+ throw new Error(`Payment method "${method}" is not configured. Use the wallet_setup tool to configure a wallet`);
122
122
  }
123
123
  // Auto-detect: try default wallet, then card
124
124
  const configured = getConfiguredMethods();
@@ -197,7 +197,7 @@ export function paymentMethodDisplayName(method) {
197
197
  }
198
198
  /**
199
199
  * Return the consumer's configured payment methods in registry API format.
200
- * Maps CLI method names (tempo, base, card) to registry identifiers
200
+ * Maps method names (tempo, base, card) to registry identifiers
201
201
  * (tempo_usdc, base_usdc, stripe_card).
202
202
  */
203
203
  export function getAcceptedPaymentMethods() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared display formatters for human-readable MCP and CLI output.
2
+ * Shared display formatters for human-readable MCP output.
3
3
  * Plain text only — no ANSI color codes.
4
4
  */
5
5
 
@@ -244,7 +244,7 @@ interface WalletInfo {
244
244
 
245
245
  export function formatWalletStatus(info: WalletInfo): string {
246
246
  if (info.wallets.length === 0 && !info.card) {
247
- return "No payment methods configured.\nRun: aw wallet setup";
247
+ return "No payment methods configured.\nUse the wallet_setup tool to create or import a wallet.";
248
248
  }
249
249
 
250
250
  const lines = ["Payment methods:"];
@@ -5,7 +5,7 @@
5
5
  * any other viem-based flow can use OWS-managed keys transparently.
6
6
  *
7
7
  * The OWS SDK (`@open-wallet-standard/core`) is a NAPI native module.
8
- * ALL imports are dynamic so the CLI works without OWS installed.
8
+ * ALL imports are dynamic so the MCP server works without OWS installed.
9
9
  */
10
10
 
11
11
  import type { LocalAccount } from "viem/accounts";
@@ -93,11 +93,22 @@ const OWS_INSTALL_HINT =
93
93
  "OWS is not installed. Install with: npm install -g @open-wallet-standard/core";
94
94
 
95
95
  async function loadOws(): Promise<OwsSdk> {
96
+ // Try local/project resolution first
96
97
  try {
97
98
  // @ts-ignore — optional peer dep, dynamically imported
98
99
  return (await import("@open-wallet-standard/core")) as unknown as OwsSdk;
99
100
  } catch {
100
- throw new Error(OWS_INSTALL_HINT);
101
+ // Fallback: resolve from global npm prefix using createRequire
102
+ // (npx runs in an isolated context that can't see globally-installed native modules)
103
+ try {
104
+ const { execSync } = await import("node:child_process");
105
+ const { createRequire } = await import("node:module");
106
+ const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
107
+ const globalRequire = createRequire(globalRoot + "/");
108
+ return globalRequire("@open-wallet-standard/core") as unknown as OwsSdk;
109
+ } catch {
110
+ throw new Error(OWS_INSTALL_HINT);
111
+ }
101
112
  }
102
113
  }
103
114
 
@@ -123,8 +134,7 @@ function findEvmAccount(
123
134
  */
124
135
  export async function isOwsAvailable(): Promise<boolean> {
125
136
  try {
126
- // @ts-ignore — optional peer dep, dynamically imported
127
- await import("@open-wallet-standard/core");
137
+ await loadOws();
128
138
  return true;
129
139
  } catch {
130
140
  return false;
@@ -121,14 +121,14 @@ export async function getPaymentFetch(method?: string): Promise<typeof fetch> {
121
121
  fetchCache.set(ck, pf);
122
122
  return pf;
123
123
  }
124
- throw new Error('Payment method "card" is not configured. Run: aw wallet setup');
124
+ throw new Error('Payment method "card" is not configured. Use the wallet_setup tool to configure a wallet');
125
125
  }
126
126
 
127
127
  // Explicit method requested (wallet ID or chain name)
128
128
  if (method) {
129
129
  const resolved = resolveWalletAndChain(method);
130
130
  if (!resolved) {
131
- throw new Error(`Payment method "${method}" is not configured. Run: aw wallet setup`);
131
+ throw new Error(`Payment method "${method}" is not configured. Use the wallet_setup tool to configure a wallet`);
132
132
  }
133
133
  const ck = cacheKey(resolved.wallet.id, resolved.chain);
134
134
  if (fetchCache.has(ck)) return fetchCache.get(ck)!;
@@ -137,7 +137,7 @@ export async function getPaymentFetch(method?: string): Promise<typeof fetch> {
137
137
  fetchCache.set(ck, pf);
138
138
  return pf;
139
139
  }
140
- throw new Error(`Payment method "${method}" is not configured. Run: aw wallet setup`);
140
+ throw new Error(`Payment method "${method}" is not configured. Use the wallet_setup tool to configure a wallet`);
141
141
  }
142
142
 
143
143
  // Auto-detect: try default wallet, then card
@@ -219,7 +219,7 @@ export function paymentMethodDisplayName(method: string): string {
219
219
 
220
220
  /**
221
221
  * Return the consumer's configured payment methods in registry API format.
222
- * Maps CLI method names (tempo, base, card) to registry identifiers
222
+ * Maps method names (tempo, base, card) to registry identifiers
223
223
  * (tempo_usdc, base_usdc, stripe_card).
224
224
  */
225
225
  export function getAcceptedPaymentMethods(): string[] {