@agentwonderland/mcp 0.1.34 → 0.1.36

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.
@@ -94,9 +94,9 @@ export async function uploadLocalFiles(input) {
94
94
  throw new Error(`File not found at "${value}" (for input field "${key}"). ` +
95
95
  `This MCP server reads files from its own filesystem — if your client ` +
96
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.`);
97
+ `bytes aren't reachable here. Fix: call upload_file({ filename: "${basename(resolved)}" }) ` +
98
+ `to get a presigned upload URL, PUT the bytes to it (e.g. curl -T), then pass the ` +
99
+ `returned GET URL as "${key}" instead of the path.`);
100
100
  }
101
101
  try {
102
102
  const url = await uploadFile(value);
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ import { registerWalletTools } from "./tools/wallet.js";
12
12
  import { registerFavoriteTools } from "./tools/favorites.js";
13
13
  import { registerTipTools } from "./tools/tip.js";
14
14
  import { registerPassTools } from "./tools/passes.js";
15
+ import { registerUploadTools } from "./tools/upload.js";
16
+ import { registerProbeTools } from "./tools/probe.js";
15
17
  // ── Resources ────────────────────────────────────────────────────
16
18
  import { registerAgentResources } from "./resources/agents.js";
17
19
  import { registerWalletResources } from "./resources/wallet.js";
@@ -73,6 +75,8 @@ export async function startMcpServer() {
73
75
  registerFavoriteTools(server);
74
76
  registerTipTools(server);
75
77
  registerPassTools(server);
78
+ registerUploadTools(server);
79
+ registerProbeTools(server);
76
80
  // Register resources
77
81
  registerAgentResources(server);
78
82
  registerWalletResources(server);
@@ -8,3 +8,5 @@ export { registerWalletTools } from "./wallet.js";
8
8
  export { registerFavoriteTools } from "./favorites.js";
9
9
  export { registerTipTools } from "./tip.js";
10
10
  export { registerPassTools } from "./passes.js";
11
+ export { registerUploadTools } from "./upload.js";
12
+ export { registerProbeTools } from "./probe.js";
@@ -8,3 +8,5 @@ export { registerWalletTools } from "./wallet.js";
8
8
  export { registerFavoriteTools } from "./favorites.js";
9
9
  export { registerTipTools } from "./tip.js";
10
10
  export { registerPassTools } from "./passes.js";
11
+ export { registerUploadTools } from "./upload.js";
12
+ export { registerProbeTools } from "./probe.js";
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerProbeTools(server: McpServer): void;
@@ -0,0 +1,35 @@
1
+ function text(t) {
2
+ return { content: [{ type: "text", text: t }] };
3
+ }
4
+ export function registerProbeTools(server) {
5
+ server.tool("probe_roots", [
6
+ "Diagnostic tool: calls roots/list on the client and reports what filesystem roots the client exposes to the server.",
7
+ "We're using this to discover whether Claude Desktop surfaces attached files as MCP roots — if it does, we can read attachment bytes over the MCP transport without burning context or hitting the bash sandbox allowlist.",
8
+ "Returns the raw roots response (or the error, if roots/list is unsupported). Safe to call repeatedly; read-only.",
9
+ ].join(" "), {}, async () => {
10
+ const lines = ["=== roots/list probe ==="];
11
+ try {
12
+ const result = await server.server.listRoots();
13
+ lines.push(`status: ok`);
14
+ lines.push(`raw: ${JSON.stringify(result, null, 2)}`);
15
+ const roots = result.roots ?? [];
16
+ lines.push(`count: ${roots.length}`);
17
+ for (const r of roots) {
18
+ lines.push(` - ${r.name ?? "(unnamed)"}: ${r.uri}`);
19
+ }
20
+ }
21
+ catch (err) {
22
+ const e = err;
23
+ lines.push(`status: error`);
24
+ lines.push(`code: ${e.code ?? "?"}`);
25
+ lines.push(`message: ${e.message ?? String(err)}`);
26
+ if (e.data !== undefined)
27
+ lines.push(`data: ${JSON.stringify(e.data)}`);
28
+ lines.push("");
29
+ if (e.code === -32601) {
30
+ lines.push("(-32601 = Method not found — client didn't declare the roots capability.)");
31
+ }
32
+ }
33
+ return text(lines.join("\n"));
34
+ });
35
+ }
package/dist/tools/run.js CHANGED
@@ -85,7 +85,7 @@ function buildCreditPackOfferLines(agent) {
85
85
  ];
86
86
  }
87
87
  export function registerRunTools(server) {
88
- server.tool("run_agent", "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs before execution.", {
88
+ server.tool("run_agent", "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs before execution. If a file you need isn't on this MCP server's filesystem (e.g. a sandboxed /mnt/... attachment), call upload_file first to get a presigned upload URL, PUT the bytes to it, then pass the returned GET URL as input instead — that keeps the bytes out of the conversation context.", {
89
89
  agent_id: z.string().describe("Agent ID (UUID, slug, or name)"),
90
90
  input: z.record(z.unknown()).describe("Input payload for the agent"),
91
91
  pay_with: z.string().trim().min(1).optional().describe("Payment method — wallet ID, chain name (tempo, base, etc.), or 'card'. Auto-detected if omitted."),
@@ -105,7 +105,7 @@ function buildCreditPackSummary(agent) {
105
105
  ];
106
106
  }
107
107
  export function registerSolveTools(server) {
108
- server.tool("solve", "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input are auto-uploaded before execution.", {
108
+ server.tool("solve", "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input are auto-uploaded before execution. If a file you need isn't on this MCP server's filesystem (e.g. a sandboxed /mnt/... attachment), call upload_file first to get a presigned upload URL, PUT the bytes to it, then pass the returned GET URL as input instead.", {
109
109
  intent: z
110
110
  .string()
111
111
  .describe("What you want to accomplish (natural language)"),
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerUploadTools(server: McpServer): void;
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { apiPost } from "../core/api-client.js";
3
+ function text(t) {
4
+ return { content: [{ type: "text", text: t }] };
5
+ }
6
+ export function registerUploadTools(server) {
7
+ server.tool("upload_file", [
8
+ "Get a pair of presigned R2 URLs to upload a file without passing bytes through the conversation.",
9
+ "Use this when the file lives in a sandbox the MCP server can't read (e.g. Claude web /mnt/user-data/..., any hosted-agent environment).",
10
+ "Flow:",
11
+ " 1. Call this tool with the filename and content_type.",
12
+ " 2. PUT the file bytes to `upload_url` over HTTP (e.g. via bash curl). The bytes never touch the LLM context.",
13
+ " 3. Pass `get_url` as the input value when running an agent that needs a URL.",
14
+ "On Claude Desktop with real filesystem paths (/Users/... or ~/...), just pass the path to run_agent — it auto-uploads. Only reach for upload_file when auto-upload isn't possible.",
15
+ ].join("\n"), {
16
+ filename: z
17
+ .string()
18
+ .min(1)
19
+ .max(255)
20
+ .describe("Base filename, e.g. 'photo.jpg'. Path separators are stripped."),
21
+ content_type: z
22
+ .string()
23
+ .optional()
24
+ .describe("MIME type (e.g. 'image/jpeg'). Inferred from filename if omitted."),
25
+ }, async ({ filename, content_type }) => {
26
+ const result = await apiPost("/uploads/presign-put", {
27
+ filename,
28
+ content_type,
29
+ });
30
+ const lines = [
31
+ `Upload slot ready for ${filename} (${result.content_type}).`,
32
+ "",
33
+ `Upload URL (PUT, expires in ${Math.round(result.upload_expires_in / 60)}m):`,
34
+ result.upload_url,
35
+ "",
36
+ `Public URL to pass to run_agent (GET, expires in ${Math.round(result.get_expires_in / 3600)}h):`,
37
+ result.get_url,
38
+ "",
39
+ "Upload the file with:",
40
+ ` curl -X PUT -H "Content-Type: ${result.content_type}" --data-binary @<path-to-file> "${result.upload_url}"`,
41
+ "",
42
+ "Then pass the GET URL above as the input value (e.g. { image: \"<get_url>\" }).",
43
+ ];
44
+ return text(lines.join("\n"));
45
+ });
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -117,9 +117,9 @@ export async function uploadLocalFiles(
117
117
  `File not found at "${value}" (for input field "${key}"). ` +
118
118
  `This MCP server reads files from its own filesystem — if your client ` +
119
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.`,
120
+ `bytes aren't reachable here. Fix: call upload_file({ filename: "${basename(resolved)}" }) ` +
121
+ `to get a presigned upload URL, PUT the bytes to it (e.g. curl -T), then pass the ` +
122
+ `returned GET URL as "${key}" instead of the path.`,
123
123
  );
124
124
  }
125
125
 
package/src/index.ts CHANGED
@@ -14,6 +14,8 @@ import { registerWalletTools } from "./tools/wallet.js";
14
14
  import { registerFavoriteTools } from "./tools/favorites.js";
15
15
  import { registerTipTools } from "./tools/tip.js";
16
16
  import { registerPassTools } from "./tools/passes.js";
17
+ import { registerUploadTools } from "./tools/upload.js";
18
+ import { registerProbeTools } from "./tools/probe.js";
17
19
 
18
20
  // ── Resources ────────────────────────────────────────────────────
19
21
  import { registerAgentResources } from "./resources/agents.js";
@@ -82,6 +84,8 @@ export async function startMcpServer(): Promise<void> {
82
84
  registerFavoriteTools(server);
83
85
  registerTipTools(server);
84
86
  registerPassTools(server);
87
+ registerUploadTools(server);
88
+ registerProbeTools(server);
85
89
 
86
90
  // Register resources
87
91
  registerAgentResources(server);
@@ -8,3 +8,5 @@ export { registerWalletTools } from "./wallet.js";
8
8
  export { registerFavoriteTools } from "./favorites.js";
9
9
  export { registerTipTools } from "./tip.js";
10
10
  export { registerPassTools } from "./passes.js";
11
+ export { registerUploadTools } from "./upload.js";
12
+ export { registerProbeTools } from "./probe.js";
@@ -0,0 +1,41 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+
3
+ function text(t: string) {
4
+ return { content: [{ type: "text" as const, text: t }] };
5
+ }
6
+
7
+ export function registerProbeTools(server: McpServer) {
8
+ server.tool(
9
+ "probe_roots",
10
+ [
11
+ "Diagnostic tool: calls roots/list on the client and reports what filesystem roots the client exposes to the server.",
12
+ "We're using this to discover whether Claude Desktop surfaces attached files as MCP roots — if it does, we can read attachment bytes over the MCP transport without burning context or hitting the bash sandbox allowlist.",
13
+ "Returns the raw roots response (or the error, if roots/list is unsupported). Safe to call repeatedly; read-only.",
14
+ ].join(" "),
15
+ {},
16
+ async () => {
17
+ const lines: string[] = ["=== roots/list probe ==="];
18
+ try {
19
+ const result = await server.server.listRoots();
20
+ lines.push(`status: ok`);
21
+ lines.push(`raw: ${JSON.stringify(result, null, 2)}`);
22
+ const roots = (result as { roots?: Array<{ uri: string; name?: string }> }).roots ?? [];
23
+ lines.push(`count: ${roots.length}`);
24
+ for (const r of roots) {
25
+ lines.push(` - ${r.name ?? "(unnamed)"}: ${r.uri}`);
26
+ }
27
+ } catch (err) {
28
+ const e = err as { code?: number; message?: string; data?: unknown };
29
+ lines.push(`status: error`);
30
+ lines.push(`code: ${e.code ?? "?"}`);
31
+ lines.push(`message: ${e.message ?? String(err)}`);
32
+ if (e.data !== undefined) lines.push(`data: ${JSON.stringify(e.data)}`);
33
+ lines.push("");
34
+ if (e.code === -32601) {
35
+ lines.push("(-32601 = Method not found — client didn't declare the roots capability.)");
36
+ }
37
+ }
38
+ return text(lines.join("\n"));
39
+ },
40
+ );
41
+ }
package/src/tools/run.ts CHANGED
@@ -123,7 +123,7 @@ function buildCreditPackOfferLines(agent: AgentRecord): string[] {
123
123
  export function registerRunTools(server: McpServer): void {
124
124
  server.tool(
125
125
  "run_agent",
126
- "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs before execution.",
126
+ "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs before execution. If a file you need isn't on this MCP server's filesystem (e.g. a sandboxed /mnt/... attachment), call upload_file first to get a presigned upload URL, PUT the bytes to it, then pass the returned GET URL as input instead — that keeps the bytes out of the conversation context.",
127
127
  {
128
128
  agent_id: z.string().describe("Agent ID (UUID, slug, or name)"),
129
129
  input: z.record(z.unknown()).describe("Input payload for the agent"),
@@ -137,7 +137,7 @@ function buildCreditPackSummary(agent: AgentRecord): string[] {
137
137
  export function registerSolveTools(server: McpServer): void {
138
138
  server.tool(
139
139
  "solve",
140
- "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input are auto-uploaded before execution.",
140
+ "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input are auto-uploaded before execution. If a file you need isn't on this MCP server's filesystem (e.g. a sandboxed /mnt/... attachment), call upload_file first to get a presigned upload URL, PUT the bytes to it, then pass the returned GET URL as input instead.",
141
141
  {
142
142
  intent: z
143
143
  .string()
@@ -0,0 +1,65 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { apiPost } from "../core/api-client.js";
4
+
5
+ function text(t: string) {
6
+ return { content: [{ type: "text" as const, text: t }] };
7
+ }
8
+
9
+ interface PresignResponse {
10
+ upload_url: string;
11
+ get_url: string;
12
+ key: string;
13
+ content_type: string;
14
+ upload_expires_in: number;
15
+ get_expires_in: number;
16
+ }
17
+
18
+ export function registerUploadTools(server: McpServer) {
19
+ server.tool(
20
+ "upload_file",
21
+ [
22
+ "Get a pair of presigned R2 URLs to upload a file without passing bytes through the conversation.",
23
+ "Use this when the file lives in a sandbox the MCP server can't read (e.g. Claude web /mnt/user-data/..., any hosted-agent environment).",
24
+ "Flow:",
25
+ " 1. Call this tool with the filename and content_type.",
26
+ " 2. PUT the file bytes to `upload_url` over HTTP (e.g. via bash curl). The bytes never touch the LLM context.",
27
+ " 3. Pass `get_url` as the input value when running an agent that needs a URL.",
28
+ "On Claude Desktop with real filesystem paths (/Users/... or ~/...), just pass the path to run_agent — it auto-uploads. Only reach for upload_file when auto-upload isn't possible.",
29
+ ].join("\n"),
30
+ {
31
+ filename: z
32
+ .string()
33
+ .min(1)
34
+ .max(255)
35
+ .describe("Base filename, e.g. 'photo.jpg'. Path separators are stripped."),
36
+ content_type: z
37
+ .string()
38
+ .optional()
39
+ .describe("MIME type (e.g. 'image/jpeg'). Inferred from filename if omitted."),
40
+ },
41
+ async ({ filename, content_type }) => {
42
+ const result = await apiPost<PresignResponse>("/uploads/presign-put", {
43
+ filename,
44
+ content_type,
45
+ });
46
+
47
+ const lines = [
48
+ `Upload slot ready for ${filename} (${result.content_type}).`,
49
+ "",
50
+ `Upload URL (PUT, expires in ${Math.round(result.upload_expires_in / 60)}m):`,
51
+ result.upload_url,
52
+ "",
53
+ `Public URL to pass to run_agent (GET, expires in ${Math.round(result.get_expires_in / 3600)}h):`,
54
+ result.get_url,
55
+ "",
56
+ "Upload the file with:",
57
+ ` curl -X PUT -H "Content-Type: ${result.content_type}" --data-binary @<path-to-file> "${result.upload_url}"`,
58
+ "",
59
+ "Then pass the GET URL above as the input value (e.g. { image: \"<get_url>\" }).",
60
+ ];
61
+
62
+ return text(lines.join("\n"));
63
+ },
64
+ );
65
+ }