@agentwonderland/mcp 0.1.33 → 0.1.34
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/core/file-upload.js +8 -2
- package/package.json +1 -1
- package/src/core/file-upload.ts +10 -1
- package/test-x402-flow.mjs +0 -58
package/dist/core/file-upload.js
CHANGED
|
@@ -90,8 +90,14 @@ export async function uploadLocalFiles(input) {
|
|
|
90
90
|
if (!isLocalFilePath(value))
|
|
91
91
|
continue;
|
|
92
92
|
const resolved = resolvePath(value);
|
|
93
|
-
if (!existsSync(resolved))
|
|
94
|
-
|
|
93
|
+
if (!existsSync(resolved)) {
|
|
94
|
+
throw new Error(`File not found at "${value}" (for input field "${key}"). ` +
|
|
95
|
+
`This MCP server reads files from its own filesystem — if your client ` +
|
|
96
|
+
`sandboxes attachments (e.g. a web session with a /mnt/... path), the ` +
|
|
97
|
+
`bytes aren't reachable here. Fix: pass a public URL for "${key}", or ` +
|
|
98
|
+
`save the file to a real local path first (e.g. ~/Downloads/${basename(resolved)}) ` +
|
|
99
|
+
`and retry.`);
|
|
100
|
+
}
|
|
95
101
|
try {
|
|
96
102
|
const url = await uploadFile(value);
|
|
97
103
|
result[key] = url;
|
package/package.json
CHANGED
package/src/core/file-upload.ts
CHANGED
|
@@ -112,7 +112,16 @@ export async function uploadLocalFiles(
|
|
|
112
112
|
if (!isLocalFilePath(value)) continue;
|
|
113
113
|
|
|
114
114
|
const resolved = resolvePath(value);
|
|
115
|
-
if (!existsSync(resolved))
|
|
115
|
+
if (!existsSync(resolved)) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
`File not found at "${value}" (for input field "${key}"). ` +
|
|
118
|
+
`This MCP server reads files from its own filesystem — if your client ` +
|
|
119
|
+
`sandboxes attachments (e.g. a web session with a /mnt/... path), the ` +
|
|
120
|
+
`bytes aren't reachable here. Fix: pass a public URL for "${key}", or ` +
|
|
121
|
+
`save the file to a real local path first (e.g. ~/Downloads/${basename(resolved)}) ` +
|
|
122
|
+
`and retry.`,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
116
125
|
|
|
117
126
|
try {
|
|
118
127
|
const url = await uploadFile(value);
|
package/test-x402-flow.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// End-to-end x402 client test against prod Agent Wonderland on Base mainnet.
|
|
2
|
-
//
|
|
3
|
-
// 1. POST /x402/agents/:id/run (no PAYMENT header) → 402 with Stripe-issued payTo
|
|
4
|
-
// 2. Sign the payment authorization on Base mainnet with user's OWS-managed wallet
|
|
5
|
-
// 3. Retry with PAYMENT header → agent runs, USDC transferred to Stripe
|
|
6
|
-
//
|
|
7
|
-
// Then we inspect the resulting payment_attempt + transfer rows to confirm the
|
|
8
|
-
// Connect transfer is funded via source_transaction (same path MPP uses).
|
|
9
|
-
|
|
10
|
-
import { owsAccountFromWalletId } from "./src/core/ows-adapter.ts";
|
|
11
|
-
import { x402Client } from "@x402/core/client";
|
|
12
|
-
import { registerExactEvmScheme } from "@x402/evm/exact/client";
|
|
13
|
-
import { encodePaymentSignatureHeader } from "@x402/core/http";
|
|
14
|
-
|
|
15
|
-
const API = "https://api.agentwonderland.com";
|
|
16
|
-
const AGENT_SLUG = "diagram-renderer-qyf0";
|
|
17
|
-
const INPUT = { code: "graph TD; A-->B;", format: "png" };
|
|
18
|
-
const OWS_WALLET_ID = "9558b02c-93bf-480f-8708-5fe135bf53d9"; // from ~/.agentwonderland/config.json
|
|
19
|
-
|
|
20
|
-
// 1. Get the account
|
|
21
|
-
const account = await owsAccountFromWalletId(OWS_WALLET_ID);
|
|
22
|
-
console.log(`signer: ${account.address}`);
|
|
23
|
-
|
|
24
|
-
// 2. Fetch the 402 challenge
|
|
25
|
-
const first = await fetch(`${API}/x402/agents/${AGENT_SLUG}/run`, {
|
|
26
|
-
method: "POST",
|
|
27
|
-
headers: { "Content-Type": "application/json" },
|
|
28
|
-
body: JSON.stringify({ input: INPUT }),
|
|
29
|
-
});
|
|
30
|
-
console.log(`first response: ${first.status}`);
|
|
31
|
-
const paymentRequired = await first.json();
|
|
32
|
-
console.log("accepts[0].payTo:", paymentRequired.accepts?.[0]?.payTo);
|
|
33
|
-
console.log("payment_attempt_id:", paymentRequired.payment_attempt_id);
|
|
34
|
-
|
|
35
|
-
// 3. Build + sign the payment
|
|
36
|
-
const client = new x402Client();
|
|
37
|
-
registerExactEvmScheme(client, {
|
|
38
|
-
signer: account,
|
|
39
|
-
networks: ["eip155:8453"],
|
|
40
|
-
});
|
|
41
|
-
const paymentPayload = await client.createPaymentPayload(paymentRequired);
|
|
42
|
-
console.log("FULL payment payload:", JSON.stringify(paymentPayload, null, 2));
|
|
43
|
-
|
|
44
|
-
const paymentHeader = encodePaymentSignatureHeader(paymentPayload);
|
|
45
|
-
console.log("PAYMENT header length:", paymentHeader.length);
|
|
46
|
-
|
|
47
|
-
// 4. Retry with PAYMENT header
|
|
48
|
-
const second = await fetch(`${API}/x402/agents/${AGENT_SLUG}/run`, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
headers: {
|
|
51
|
-
"Content-Type": "application/json",
|
|
52
|
-
PAYMENT: paymentHeader,
|
|
53
|
-
},
|
|
54
|
-
body: JSON.stringify({ input: INPUT }),
|
|
55
|
-
});
|
|
56
|
-
console.log(`second response: ${second.status}`);
|
|
57
|
-
const body = await second.text();
|
|
58
|
-
console.log("body preview:", body.slice(0, 400));
|