@fidacy/mcp 0.1.23 → 0.1.25

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.js CHANGED
@@ -442,7 +442,7 @@ function resolveMandateRules(cfg) {
442
442
  }
443
443
 
444
444
  // src/telemetry.ts
445
- var CLIENT_VERSION = true ? "0.1.23" : "dev";
445
+ var CLIENT_VERSION = true ? "0.1.25" : "dev";
446
446
  function bandOf(amount) {
447
447
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
448
448
  if (amount < 10) return "lt10";
package/dist/index.js CHANGED
@@ -471,7 +471,7 @@ function resolveMandateRules(cfg) {
471
471
  }
472
472
 
473
473
  // src/telemetry.ts
474
- var CLIENT_VERSION = true ? "0.1.23" : "dev";
474
+ var CLIENT_VERSION = true ? "0.1.25" : "dev";
475
475
  function bandOf(amount) {
476
476
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
477
477
  if (amount < 10) return "lt10";
@@ -814,7 +814,7 @@ async function findArtifacts(sha2562, cfg) {
814
814
  }
815
815
 
816
816
  // src/provision.ts
817
- var CLIENT_VERSION2 = true ? "0.1.23" : "dev";
817
+ var CLIENT_VERSION2 = true ? "0.1.25" : "dev";
818
818
  function provisionEnabled() {
819
819
  const v = (process.env.FIDACY_DISABLE_PROVISION ?? "").trim().toLowerCase();
820
820
  return !(v === "1" || v === "true" || v === "yes");
@@ -897,7 +897,7 @@ function installAgeDays() {
897
897
  function decisionNudge(status, violatedRule, upgradeToolName) {
898
898
  const count = bumpDecisionCount();
899
899
  const url = claimUrl();
900
- const claimPath = url ? `open ${url} to see everything blocked on this install and claim it (free account, this history migrates)` : `call the ${upgradeToolName} tool (free account, this history migrates)`;
900
+ const claimPath = url ? `free account + free API key at ${url} (this install's history migrates)` : `call the ${upgradeToolName} tool (free account + free API key, this history migrates)`;
901
901
  if (status === "DENY" && violatedRule?.startsWith("duplicate_invoice") && nudgeOnce("bec_catch")) {
902
902
  return `That was a duplicate-invoice (BEC) catch, the #1 payment fraud. For your operator: ${claimPath}. On a hosted account every block like this is server-signed and anchored to Bitcoin: court-grade evidence.`;
903
903
  }
@@ -912,6 +912,19 @@ function decisionNudge(status, violatedRule, upgradeToolName) {
912
912
  }
913
913
  return null;
914
914
  }
915
+ function hostedWallCta(feature) {
916
+ const url = claimUrl();
917
+ const cta = url ? `open ${url} \u2014 free account, this install's history migrates` : `call the upgrade tool \u2014 free account, your history migrates`;
918
+ const noun = feature === "anchor" ? "Bitcoin-anchored proofs" : "server-signed verdicts";
919
+ if (nudgeOnce("hosted_wall")) {
920
+ return `You've used this install's free allowance for ${noun} \u2014 the proofs anyone can re-verify at fidacy.com/verify, court-grade, not a local-only check. Keep them flowing: for your operator, ${cta}.`;
921
+ }
922
+ return `Free allowance for ${noun} reached. For your operator: ${cta}.`;
923
+ }
924
+ function noKeyCta() {
925
+ const url = claimUrl();
926
+ return url ? `free in ~1 min for your operator: open ${url} (this install's history migrates), or set FIDACY_ENGINE_API_KEY if you already have one` : `free in ~1 min: call the upgrade tool (your history migrates), or set FIDACY_ENGINE_API_KEY if you already have one`;
927
+ }
915
928
  function weekOneBootNudge(upgradeToolName) {
916
929
  if (installAgeDays() >= 7 && nudgeOnce("week_1")) {
917
930
  const url = claimUrl();
@@ -924,7 +937,7 @@ function weekOneBootNudge(upgradeToolName) {
924
937
  var state = ensureState();
925
938
  var core = makeCore();
926
939
  var subject = process.env.FIDACY_SUBJECT ?? "agent:demo";
927
- var SERVER_VERSION = true ? "0.1.23" : "dev";
940
+ var SERVER_VERSION = true ? "0.1.25" : "dev";
928
941
  var server = new McpServer({ name: "fidacy", version: SERVER_VERSION });
929
942
  server.registerTool(
930
943
  "request_payment",
@@ -974,7 +987,11 @@ server.registerTool(
974
987
  async () => {
975
988
  const m = await core.getMandate(subject);
976
989
  const payload = { mandate: m, fidacyPublicKey: core.publicKey() };
977
- const text = JSON.stringify(payload, null, 2) + "\n\nThis mandate is local (free tier). Hosted mandates add team governance and server-signed verdicts \u2014 the upgrade tool starts a free account.";
990
+ const claim = process.env.FIDACY_ENGINE_API_KEY ? null : claimUrl();
991
+ const claimLine = claim ? `
992
+
993
+ For your operator: free account + free API key, and this install's history migrates: ${claim}` : "";
994
+ const text = JSON.stringify(payload, null, 2) + "\n\nThis mandate is local (free tier). Hosted mandates add team governance and server-signed verdicts; a free account starts it." + claimLine;
978
995
  return { content: [{ type: "text", text }], structuredContent: payload };
979
996
  }
980
997
  );
@@ -1013,12 +1030,7 @@ server.registerTool(
1013
1030
  const apiKey = (process.env.FIDACY_ENGINE_API_KEY ?? "").trim();
1014
1031
  if (!apiKey) {
1015
1032
  return {
1016
- content: [
1017
- {
1018
- type: "text",
1019
- text: "assess_action needs an engine key \u2014 free in about a minute: call the upgrade tool (your usage history migrates), or set FIDACY_ENGINE_API_KEY if you already have one."
1020
- }
1021
- ],
1033
+ content: [{ type: "text", text: `assess_action needs an engine key \u2014 ${noKeyCta()}.` }],
1022
1034
  isError: true
1023
1035
  };
1024
1036
  }
@@ -1033,6 +1045,9 @@ server.registerTool(
1033
1045
  };
1034
1046
  } catch (e) {
1035
1047
  if (e instanceof AssessError) {
1048
+ if (e.status === 402) {
1049
+ return { content: [{ type: "text", text: hostedWallCta("verdict") }], isError: true };
1050
+ }
1036
1051
  const reasons = e.rejection_reasons?.length ? " (" + e.rejection_reasons.map((x) => x.key).join(",") + ")" : "";
1037
1052
  return {
1038
1053
  content: [{ type: "text", text: `ASSESS ${e.status}: ${e.type}${reasons}` }],
@@ -1065,7 +1080,7 @@ server.registerTool(
1065
1080
  const apiKey = (process.env.FIDACY_ENGINE_API_KEY ?? "").trim();
1066
1081
  if (!apiKey) {
1067
1082
  return {
1068
- content: [{ type: "text", text: "anchor_artifact needs an engine key \u2014 free in about a minute: call the upgrade tool, or set FIDACY_ENGINE_API_KEY if you already have one." }],
1083
+ content: [{ type: "text", text: `anchor_artifact needs an engine key \u2014 ${noKeyCta()}.` }],
1069
1084
  isError: true
1070
1085
  };
1071
1086
  }
@@ -1094,6 +1109,9 @@ server.registerTool(
1094
1109
  };
1095
1110
  } catch (e) {
1096
1111
  if (e instanceof AssessError) {
1112
+ if (e.status === 402) {
1113
+ return { content: [{ type: "text", text: hostedWallCta("anchor") }], isError: true };
1114
+ }
1097
1115
  return { content: [{ type: "text", text: `ANCHOR ${e.status}: ${e.type}` }], isError: true };
1098
1116
  }
1099
1117
  return { content: [{ type: "text", text: "ANCHOR failed: unexpected error" }], isError: true };
@@ -1180,7 +1198,8 @@ async function main() {
1180
1198
  void flush();
1181
1199
  });
1182
1200
  void autoProvision();
1183
- const verdictHint = process.env.FIDACY_ENGINE_API_KEY ? "" : " Verdicts: provisioning a free anonymous key in the background; to use your own, set FIDACY_ENGINE_API_KEY (get one at app.fidacy.com).";
1201
+ const claim = claimUrl();
1202
+ const verdictHint = process.env.FIDACY_ENGINE_API_KEY ? "" : claim ? ` This install is anonymous. Free account + free API key, and it keeps every block made here: ${claim} (or set FIDACY_ENGINE_API_KEY if you already have one).` : " Verdicts: provisioning a free anonymous key in the background; to use your own, set FIDACY_ENGINE_API_KEY (get one at app.fidacy.com).";
1184
1203
  const tierHint = state.firstRun ? " First run: free local tier active (deny-unknown payee + cap). Add trusted payees in ~/.fidacy/config.json." : ` Tier: ${state.config.tier} (local-first).`;
1185
1204
  const weekNudge = weekOneBootNudge("upgrade") ?? "";
1186
1205
  console.error("[fidacy] @fidacy/mcp ready on stdio: signed verdict + payment firewall." + tierHint + verdictHint + weekNudge);
package/dist/lib.js CHANGED
@@ -594,7 +594,7 @@ function resolveMandateRules(cfg) {
594
594
  }
595
595
 
596
596
  // src/telemetry.ts
597
- var CLIENT_VERSION = true ? "0.1.23" : "dev";
597
+ var CLIENT_VERSION = true ? "0.1.25" : "dev";
598
598
  function bandOf(amount) {
599
599
  if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) return void 0;
600
600
  if (amount < 10) return "lt10";
@@ -771,7 +771,7 @@ function requestUpgrade() {
771
771
  }
772
772
 
773
773
  // src/provision.ts
774
- var CLIENT_VERSION2 = true ? "0.1.23" : "dev";
774
+ var CLIENT_VERSION2 = true ? "0.1.25" : "dev";
775
775
  function provisionEnabled() {
776
776
  const v = (process.env.FIDACY_DISABLE_PROVISION ?? "").trim().toLowerCase();
777
777
  return !(v === "1" || v === "true" || v === "yes");
@@ -842,7 +842,7 @@ function installAgeDays() {
842
842
  function decisionNudge(status, violatedRule, upgradeToolName) {
843
843
  const count = bumpDecisionCount();
844
844
  const url = claimUrl();
845
- const claimPath = url ? `open ${url} to see everything blocked on this install and claim it (free account, this history migrates)` : `call the ${upgradeToolName} tool (free account, this history migrates)`;
845
+ const claimPath = url ? `free account + free API key at ${url} (this install's history migrates)` : `call the ${upgradeToolName} tool (free account + free API key, this history migrates)`;
846
846
  if (status === "DENY" && violatedRule?.startsWith("duplicate_invoice") && nudgeOnce("bec_catch")) {
847
847
  return `That was a duplicate-invoice (BEC) catch, the #1 payment fraud. For your operator: ${claimPath}. On a hosted account every block like this is server-signed and anchored to Bitcoin: court-grade evidence.`;
848
848
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fidacy/mcp",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Fidacy action firewall for AI agents. Mandate-gated payment authorization as an MCP server.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://fidacy.com",