@agentwonderland/mcp 0.1.56 → 0.1.58

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.
@@ -61,46 +61,6 @@ describe("api-client headers", () => {
61
61
  }),
62
62
  }));
63
63
  });
64
- it("labels playbook API calls with MCP surface, version, tool, and action headers", async () => {
65
- const fetchMock = vi.fn(async () => new Response(JSON.stringify({ ok: true }), {
66
- status: 200,
67
- headers: { "content-type": "application/json" },
68
- }));
69
- vi.stubGlobal("fetch", fetchMock);
70
- const { apiGet, apiPost } = await import("../api-client.js");
71
- await apiGet("/playbooks?limit=1");
72
- await apiGet("/playbooks/competitor-ads");
73
- await apiGet("/playbooks/competitor-ads/versions");
74
- await apiGet("/playbooks/competitor-ads/versions/1");
75
- await apiPost("/playbooks/competitor-ads/favorite", {});
76
- await apiPost("/playbooks/competitor-ads/feedback", { rating: 5 });
77
- await apiPost("/playbook-quotes", { slug: "competitor-ads", budget: 5 });
78
- await apiPost("/playbook-runs", { slug: "competitor-ads", budget: 5 });
79
- await apiGet("/playbook-runs/run-1");
80
- await apiPost("/playbook-runs/run-1/steps/ads", { status: "running" });
81
- const calls = fetchMock.mock.calls.map(([url, init]) => ({
82
- url: String(url).replace("https://api.agentwonderland.test", ""),
83
- headers: init.headers,
84
- }));
85
- for (const call of calls) {
86
- expect(call.headers).toMatchObject({
87
- "Content-Type": "application/json",
88
- Accept: "application/json",
89
- "X-AW-Surface": "mcp",
90
- "X-AW-MCP-Version": MCP_PACKAGE_VERSION,
91
- });
92
- }
93
- expect(calls[0]).toMatchObject({ url: "/playbooks?limit=1", headers: { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" } });
94
- expect(calls[1]).toMatchObject({ url: "/playbooks/competitor-ads", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
95
- expect(calls[2]).toMatchObject({ url: "/playbooks/competitor-ads/versions", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
96
- expect(calls[3]).toMatchObject({ url: "/playbooks/competitor-ads/versions/1", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
97
- expect(calls[4]).toMatchObject({ url: "/playbooks/competitor-ads/favorite", headers: { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" } });
98
- expect(calls[5]).toMatchObject({ url: "/playbooks/competitor-ads/feedback", headers: { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" } });
99
- expect(calls[6]).toMatchObject({ url: "/playbook-quotes", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" } });
100
- expect(calls[7]).toMatchObject({ url: "/playbook-runs", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
101
- expect(calls[8]).toMatchObject({ url: "/playbook-runs/run-1", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "poll" } });
102
- expect(calls[9]).toMatchObject({ url: "/playbook-runs/run-1/steps/ads", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
103
- });
104
64
  it("uses Link MPP pay with run-agent headers for an approved spend request", async () => {
105
65
  const { apiPostWithApprovedLinkSpendRequest } = await import("../api-client.js");
106
66
  await apiPostWithApprovedLinkSpendRequest("/agents/agent-1/run", { input: { text: "hello" } }, "lsrq_test_123");
@@ -26,24 +26,6 @@ function inferToolHeaders(path, method) {
26
26
  if (path.startsWith("/agents?") || path === "/agents" || path === "/agents/search") {
27
27
  return { "X-AW-MCP-Tool": "search_agents", "X-AW-MCP-Action": "search" };
28
28
  }
29
- if (path.startsWith("/playbooks?") || path === "/playbooks") {
30
- return { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" };
31
- }
32
- if (/^\/playbooks\/[^/]+(?:\/versions(?:\/[^/]+)?)?$/.test(path)) {
33
- return { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" };
34
- }
35
- if (/^\/playbooks\/[^/]+\/favorite$/.test(path)) {
36
- return { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" };
37
- }
38
- if (/^\/playbooks\/[^/]+\/feedback$/.test(path)) {
39
- return { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" };
40
- }
41
- if (path === "/playbook-quotes") {
42
- return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" };
43
- }
44
- if (path === "/playbook-runs" || path.startsWith("/playbook-runs/")) {
45
- return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": method === "GET" ? "poll" : "execute" };
46
- }
47
29
  if (/^\/agents\/[^/]+$/.test(path)) {
48
30
  return { "X-AW-MCP-Tool": "get_agent", "X-AW-MCP-Action": "view" };
49
31
  }
@@ -1 +1 @@
1
- export declare const MCP_PACKAGE_VERSION = "0.1.56";
1
+ export declare const MCP_PACKAGE_VERSION = "0.1.58";
@@ -1 +1 @@
1
- export const MCP_PACKAGE_VERSION = "0.1.56";
1
+ export const MCP_PACKAGE_VERSION = "0.1.58";
package/dist/index.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -94,50 +94,6 @@ describe("api-client headers", () => {
94
94
  );
95
95
  });
96
96
 
97
- it("labels playbook API calls with MCP surface, version, tool, and action headers", async () => {
98
- const fetchMock = vi.fn(async () => new Response(JSON.stringify({ ok: true }), {
99
- status: 200,
100
- headers: { "content-type": "application/json" },
101
- }));
102
- vi.stubGlobal("fetch", fetchMock);
103
- const { apiGet, apiPost } = await import("../api-client.js");
104
-
105
- await apiGet("/playbooks?limit=1");
106
- await apiGet("/playbooks/competitor-ads");
107
- await apiGet("/playbooks/competitor-ads/versions");
108
- await apiGet("/playbooks/competitor-ads/versions/1");
109
- await apiPost("/playbooks/competitor-ads/favorite", {});
110
- await apiPost("/playbooks/competitor-ads/feedback", { rating: 5 });
111
- await apiPost("/playbook-quotes", { slug: "competitor-ads", budget: 5 });
112
- await apiPost("/playbook-runs", { slug: "competitor-ads", budget: 5 });
113
- await apiGet("/playbook-runs/run-1");
114
- await apiPost("/playbook-runs/run-1/steps/ads", { status: "running" });
115
-
116
- const calls = (fetchMock.mock.calls as unknown as Array<[unknown, { headers?: unknown }]>).map(([url, init]) => ({
117
- url: String(url).replace("https://api.agentwonderland.test", ""),
118
- headers: init.headers as Record<string, string>,
119
- }));
120
-
121
- for (const call of calls) {
122
- expect(call.headers).toMatchObject({
123
- "Content-Type": "application/json",
124
- Accept: "application/json",
125
- "X-AW-Surface": "mcp",
126
- "X-AW-MCP-Version": MCP_PACKAGE_VERSION,
127
- });
128
- }
129
- expect(calls[0]).toMatchObject({ url: "/playbooks?limit=1", headers: { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" } });
130
- expect(calls[1]).toMatchObject({ url: "/playbooks/competitor-ads", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
131
- expect(calls[2]).toMatchObject({ url: "/playbooks/competitor-ads/versions", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
132
- expect(calls[3]).toMatchObject({ url: "/playbooks/competitor-ads/versions/1", headers: { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" } });
133
- expect(calls[4]).toMatchObject({ url: "/playbooks/competitor-ads/favorite", headers: { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" } });
134
- expect(calls[5]).toMatchObject({ url: "/playbooks/competitor-ads/feedback", headers: { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" } });
135
- expect(calls[6]).toMatchObject({ url: "/playbook-quotes", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" } });
136
- expect(calls[7]).toMatchObject({ url: "/playbook-runs", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
137
- expect(calls[8]).toMatchObject({ url: "/playbook-runs/run-1", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "poll" } });
138
- expect(calls[9]).toMatchObject({ url: "/playbook-runs/run-1/steps/ads", headers: { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "execute" } });
139
- });
140
-
141
97
  it("uses Link MPP pay with run-agent headers for an approved spend request", async () => {
142
98
  const { apiPostWithApprovedLinkSpendRequest } = await import("../api-client.js");
143
99
 
@@ -42,24 +42,6 @@ function inferToolHeaders(path: string, method: string): Record<string, string>
42
42
  if (path.startsWith("/agents?") || path === "/agents" || path === "/agents/search") {
43
43
  return { "X-AW-MCP-Tool": "search_agents", "X-AW-MCP-Action": "search" };
44
44
  }
45
- if (path.startsWith("/playbooks?") || path === "/playbooks") {
46
- return { "X-AW-MCP-Tool": "search_playbooks", "X-AW-MCP-Action": "search" };
47
- }
48
- if (/^\/playbooks\/[^/]+(?:\/versions(?:\/[^/]+)?)?$/.test(path)) {
49
- return { "X-AW-MCP-Tool": "get_playbook", "X-AW-MCP-Action": "view" };
50
- }
51
- if (/^\/playbooks\/[^/]+\/favorite$/.test(path)) {
52
- return { "X-AW-MCP-Tool": "favorite_playbook", "X-AW-MCP-Action": "favorite" };
53
- }
54
- if (/^\/playbooks\/[^/]+\/feedback$/.test(path)) {
55
- return { "X-AW-MCP-Tool": "rate_playbook", "X-AW-MCP-Action": "feedback" };
56
- }
57
- if (path === "/playbook-quotes") {
58
- return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": "quote" };
59
- }
60
- if (path === "/playbook-runs" || path.startsWith("/playbook-runs/")) {
61
- return { "X-AW-MCP-Tool": "run_playbook", "X-AW-MCP-Action": method === "GET" ? "poll" : "execute" };
62
- }
63
45
  if (/^\/agents\/[^/]+$/.test(path)) {
64
46
  return { "X-AW-MCP-Tool": "get_agent", "X-AW-MCP-Action": "view" };
65
47
  }
@@ -1 +1 @@
1
- export const MCP_PACKAGE_VERSION = "0.1.56";
1
+ export const MCP_PACKAGE_VERSION = "0.1.58";
@@ -1 +0,0 @@
1
- export {};