@agentwonderland/mcp 0.1.53 → 0.1.54

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.
@@ -56,4 +56,44 @@ describe("api-client headers", () => {
56
56
  }),
57
57
  }));
58
58
  });
59
+ it("labels playbook API calls with MCP surface, version, tool, and action headers", async () => {
60
+ const fetchMock = vi.fn(async () => new Response(JSON.stringify({ ok: true }), {
61
+ status: 200,
62
+ headers: { "content-type": "application/json" },
63
+ }));
64
+ vi.stubGlobal("fetch", fetchMock);
65
+ const { apiGet, apiPost } = await import("../api-client.js");
66
+ await apiGet("/playbooks?limit=1");
67
+ await apiGet("/playbooks/competitor-ads");
68
+ await apiGet("/playbooks/competitor-ads/versions");
69
+ await apiGet("/playbooks/competitor-ads/versions/1");
70
+ await apiPost("/playbooks/competitor-ads/favorite", {});
71
+ await apiPost("/playbooks/competitor-ads/feedback", { rating: 5 });
72
+ await apiPost("/playbook-quotes", { slug: "competitor-ads", budget: 5 });
73
+ await apiPost("/playbook-runs", { slug: "competitor-ads", budget: 5 });
74
+ await apiGet("/playbook-runs/run-1");
75
+ await apiPost("/playbook-runs/run-1/steps/ads", { status: "running" });
76
+ const calls = fetchMock.mock.calls.map(([url, init]) => ({
77
+ url: String(url).replace("https://api.agentwonderland.test", ""),
78
+ headers: init.headers,
79
+ }));
80
+ for (const call of calls) {
81
+ expect(call.headers).toMatchObject({
82
+ "Content-Type": "application/json",
83
+ Accept: "application/json",
84
+ "X-AW-Surface": "mcp",
85
+ "X-AW-MCP-Version": MCP_PACKAGE_VERSION,
86
+ });
87
+ }
88
+ expect(calls[0]).toMatchObject({ url: "/playbooks?limit=1", headers: { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" } });
89
+ expect(calls[1]).toMatchObject({ url: "/playbooks/competitor-ads", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
90
+ expect(calls[2]).toMatchObject({ url: "/playbooks/competitor-ads/versions", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
91
+ expect(calls[3]).toMatchObject({ url: "/playbooks/competitor-ads/versions/1", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
92
+ expect(calls[4]).toMatchObject({ url: "/playbooks/competitor-ads/favorite", headers: { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" } });
93
+ expect(calls[5]).toMatchObject({ url: "/playbooks/competitor-ads/feedback", headers: { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" } });
94
+ expect(calls[6]).toMatchObject({ url: "/playbook-quotes", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" } });
95
+ expect(calls[7]).toMatchObject({ url: "/playbook-runs", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
96
+ expect(calls[8]).toMatchObject({ url: "/playbook-runs/run-1", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "poll" } });
97
+ expect(calls[9]).toMatchObject({ url: "/playbook-runs/run-1/steps/ads", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
98
+ });
59
99
  });
@@ -23,6 +23,24 @@ function inferToolHeaders(path, method) {
23
23
  if (path.startsWith("/agents?") || path === "/agents" || path === "/agents/search") {
24
24
  return { "X-AW-MCP-Tool": "search_agents", "X-AW-MCP-Action": "search" };
25
25
  }
26
+ if (path.startsWith("/playbooks?") || path === "/playbooks") {
27
+ return { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" };
28
+ }
29
+ if (/^\/playbooks\/[^/]+(?:\/versions(?:\/[^/]+)?)?$/.test(path)) {
30
+ return { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" };
31
+ }
32
+ if (/^\/playbooks\/[^/]+\/favorite$/.test(path)) {
33
+ return { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" };
34
+ }
35
+ if (/^\/playbooks\/[^/]+\/feedback$/.test(path)) {
36
+ return { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" };
37
+ }
38
+ if (path === "/playbook-quotes") {
39
+ return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" };
40
+ }
41
+ if (path === "/playbook-runs" || path.startsWith("/playbook-runs/")) {
42
+ return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": method === "GET" ? "poll" : "execute" };
43
+ }
26
44
  if (/^\/agents\/[^/]+$/.test(path)) {
27
45
  return { "X-AW-MCP-Tool": "get_agent", "X-AW-MCP-Action": "view" };
28
46
  }
@@ -1 +1 @@
1
- export declare const MCP_PACKAGE_VERSION = "0.1.51";
1
+ export declare const MCP_PACKAGE_VERSION = "0.1.54";
@@ -1 +1 @@
1
- export const MCP_PACKAGE_VERSION = "0.1.51";
1
+ export const MCP_PACKAGE_VERSION = "0.1.54";
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { registerRebateTools } from "./tools/rebates.js";
16
16
  import { registerUploadTools } from "./tools/upload.js";
17
17
  import { registerProbeTools } from "./tools/probe.js";
18
18
  import { registerProviderTools } from "./tools/providers.js";
19
+ import { registerPlaybookTools } from "./tools/playbooks.js";
19
20
  // ── Resources ────────────────────────────────────────────────────
20
21
  import { registerAgentResources } from "./resources/agents.js";
21
22
  import { registerWalletResources } from "./resources/wallet.js";
@@ -41,16 +42,17 @@ export async function startMcpServer() {
41
42
  "WORKFLOW:",
42
43
  "1. solve(intent, input, budget) — one call: find best agent + pay + run. Use when the task is clear.",
43
44
  " OR: search_agents() → get_agent() to inspect schema → run_agent() with required fields.",
45
+ " For multi-agent workflows, use search_playbooks() → get_playbook() → run_playbook().",
44
46
  "2. If the agent returns status 'processing', poll with get_job(). Async runs resolve automatically.",
45
- "3. After a successful run, rate_agent() and optionally tip_agent() if the result was useful.",
47
+ "3. After a successful agent run, rate_agent() and optionally tip_agent() if the result was useful.",
48
+ " After a successful playbook run, offer favorite_playbook() or rate_playbook() using the returned run_id.",
46
49
  "4. Use list_jobs() to recover state across sessions (it checks every configured wallet).",
47
50
  "",
48
51
  "PAYMENT:",
49
- "- Supported payment methods: Link card/bank via @stripe/link-cli, Tempo USDC, Base USDC, and Solana USDC.",
50
- "- Link payments may ask the user to approve a spend request in Link before the first charge.",
52
+ "- Supported launch payment methods: Tempo USDC, Base USDC, and Solana USDC.",
51
53
  "- Tempo and Base share one EVM wallet key. Solana uses a separate ed25519 key. One OWS wallet can manage both.",
52
54
  "- If pay_with is omitted, the MCP auto-selects a compatible configured rail. Pass pay_with explicitly",
53
- " (tempo | base | solana | link | wallet-id) for deterministic behavior.",
55
+ " (tempo | base | solana | wallet-id) for deterministic behavior.",
54
56
  "- Payment is automatic: on a 402 challenge the MCP signs on-chain, submits, then retries. Failed runs are refunded.",
55
57
  "- If a specific rail fails, surface the real reason — do NOT silently retry with a different method.",
56
58
  "- Headless/automation: set wallet_set_policy() to cap max_per_tx and max_per_day so a runaway loop can't drain funds.",
@@ -66,7 +68,7 @@ export async function startMcpServer() {
66
68
  "WALLET HYGIENE:",
67
69
  "- wallet_status shows per-chain USDC balance and the active network (mainnet vs testnet).",
68
70
  "- rebate_status shows accrued, pending, paid, and blocked consumer rebates plus recent payout transactions.",
69
- "- To set up payments: wallet_setup({ action: \"start\" }). Link card/bank is recommended for most users.",
71
+ "- To set up payments: wallet_setup({ action: \"start\" }). Use Tempo, Base, or Solana USDC for launch runs.",
70
72
  "- To create or import a crypto wallet directly: wallet_setup({ action: \"create\" }) or { action: \"import\", key }.",
71
73
  "- NEVER delete or rotate keys programmatically. Direct users to edit ~/.agentwonderland/config.json or ~/.ows/ manually.",
72
74
  ].join("\n"),
@@ -86,6 +88,7 @@ export async function startMcpServer() {
86
88
  registerUploadTools(server);
87
89
  registerProbeTools(server);
88
90
  registerProviderTools(server);
91
+ registerPlaybookTools(server);
89
92
  // Register resources
90
93
  registerAgentResources(server);
91
94
  registerWalletResources(server);
@@ -0,0 +1 @@
1
+ export {};