cyberdyne-mcp 0.7.0 → 0.7.2

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/bankr.js CHANGED
@@ -219,6 +219,13 @@ export async function bankrSiweProvision(opts = {}) {
219
219
  });
220
220
  if (!nonceRes.ok)
221
221
  throw new BankrApiError(nonceRes.status, "/cli/siwe/nonce", "nonce request failed");
222
+ // The nonce endpoint sets AWS load-balancer stickiness cookies (AWSALB…); the nonce is
223
+ // instance-local, so /cli/siwe/verify MUST carry them to reach the same backend — without
224
+ // this it intermittently fails "Nonce expired or already used" depending on LB routing.
225
+ const cookie = (typeof nonceRes.headers.getSetCookie === "function" ? nonceRes.headers.getSetCookie() : [])
226
+ .map((c) => c.split(";")[0])
227
+ .filter(Boolean)
228
+ .join("; ");
222
229
  const { nonce } = (await nonceRes.json());
223
230
  if (!nonce)
224
231
  throw new BankrApiError(200, "/cli/siwe/nonce", "no nonce in response");
@@ -239,7 +246,12 @@ export async function bankrSiweProvision(opts = {}) {
239
246
  const signature = await account.signMessage({ message });
240
247
  const verifyRes = await fetch(`${BANKR_API_URL}/cli/siwe/verify`, {
241
248
  method: "POST",
242
- headers: { "content-type": "application/json", accept: "application/json", "user-agent": "cyberdyne-mcp" },
249
+ headers: {
250
+ "content-type": "application/json",
251
+ accept: "application/json",
252
+ "user-agent": "cyberdyne-mcp",
253
+ ...(cookie ? { cookie } : {}),
254
+ },
243
255
  body: JSON.stringify({
244
256
  message,
245
257
  signature,
package/dist/onboard.js CHANGED
@@ -180,8 +180,9 @@ export async function onboard(env = process.env, opts = {}) {
180
180
  }
181
181
  }
182
182
  const jar = new Map();
183
- // 1. nonce
184
- const nonceRes = await fetch(`${apiUrl}/api/auth/siwe/nonce`, { headers: { accept: "application/json" } });
183
+ // 1. nonce — the platform binds the nonce to the signer address (hardening), so the
184
+ // nonce endpoint REQUIRES ?address=<wallet>; omitting it returns 400.
185
+ const nonceRes = await fetch(`${apiUrl}/api/auth/siwe/nonce?address=${address}`, { headers: { accept: "application/json" } });
185
186
  if (!nonceRes.ok)
186
187
  throw new Error(`GET /api/auth/siwe/nonce → ${nonceRes.status}`);
187
188
  collectCookies(nonceRes, jar); // carry siwe-nonce to verify
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdyne-mcp",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "mcpName": "io.github.Cyberdyne-OS/cyberdyne-mcp",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/bankr.ts CHANGED
@@ -275,6 +275,13 @@ export async function bankrSiweProvision(
275
275
  signal: AbortSignal.timeout(20_000),
276
276
  });
277
277
  if (!nonceRes.ok) throw new BankrApiError(nonceRes.status, "/cli/siwe/nonce", "nonce request failed");
278
+ // The nonce endpoint sets AWS load-balancer stickiness cookies (AWSALB…); the nonce is
279
+ // instance-local, so /cli/siwe/verify MUST carry them to reach the same backend — without
280
+ // this it intermittently fails "Nonce expired or already used" depending on LB routing.
281
+ const cookie = (typeof nonceRes.headers.getSetCookie === "function" ? nonceRes.headers.getSetCookie() : [])
282
+ .map((c) => c.split(";")[0])
283
+ .filter(Boolean)
284
+ .join("; ");
278
285
  const { nonce } = (await nonceRes.json()) as { nonce?: string };
279
286
  if (!nonce) throw new BankrApiError(200, "/cli/siwe/nonce", "no nonce in response");
280
287
 
@@ -296,7 +303,12 @@ export async function bankrSiweProvision(
296
303
 
297
304
  const verifyRes = await fetch(`${BANKR_API_URL}/cli/siwe/verify`, {
298
305
  method: "POST",
299
- headers: { "content-type": "application/json", accept: "application/json", "user-agent": "cyberdyne-mcp" },
306
+ headers: {
307
+ "content-type": "application/json",
308
+ accept: "application/json",
309
+ "user-agent": "cyberdyne-mcp",
310
+ ...(cookie ? { cookie } : {}),
311
+ },
300
312
  body: JSON.stringify({
301
313
  message,
302
314
  signature,
package/src/onboard.ts CHANGED
@@ -224,8 +224,9 @@ export async function onboard(
224
224
 
225
225
  const jar = new Map<string, string>();
226
226
 
227
- // 1. nonce
228
- const nonceRes = await fetch(`${apiUrl}/api/auth/siwe/nonce`, { headers: { accept: "application/json" } });
227
+ // 1. nonce — the platform binds the nonce to the signer address (hardening), so the
228
+ // nonce endpoint REQUIRES ?address=<wallet>; omitting it returns 400.
229
+ const nonceRes = await fetch(`${apiUrl}/api/auth/siwe/nonce?address=${address}`, { headers: { accept: "application/json" } });
229
230
  if (!nonceRes.ok) throw new Error(`GET /api/auth/siwe/nonce → ${nonceRes.status}`);
230
231
  collectCookies(nonceRes, jar); // carry siwe-nonce to verify
231
232
  const { nonce } = (await nonceRes.json()) as { nonce?: string };