@rel-time/mcp-server 1.2.5 → 1.2.6

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.
Files changed (2) hide show
  1. package/index.js +113 -22
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -56,7 +56,7 @@ let LAST_INVOICE_PACK = null;
56
56
 
57
57
  const SERVER_INFO = {
58
58
  name: "rel-time-mcp-server",
59
- version: "1.2.4",
59
+ version: "1.2.6",
60
60
  };
61
61
 
62
62
  /**
@@ -118,33 +118,55 @@ function buildPackSelectionPrompt(contextMessage) {
118
118
  status: "pack_selection_required",
119
119
  api_endpoint: API_BASE,
120
120
  important_instruction_for_ai_agent:
121
- "DO NOT tell the user to edit ~/.zshrc, .mcp.json, or restart Claude/Cursor! The MCP server manages and persists API keys automatically in ~/.reltime/api_key.json. Simply ask the user right here in chat which of the two Agent API Key packs below they want to provision (or if they already have a `rel_key_...` key to paste), then call `reltime_provision_agent_key` with `action: 'create_invoice'` and `pack: 'launch'` or `pack: 'standard'`.",
121
+ "DO NOT tell the user to edit ~/.zshrc, .mcp.json, or restart Claude/Cursor! The MCP server manages and persists API keys automatically in ~/.reltime/api_key.json. Simply ask the user right here in chat: (1) which of the 4 Rel-Time Tiers below they want to provision (`universal`, `launch`, `standard`, or `enterprise`), AND (2) whether they want to pay via **Bitcoin Lightning (`lightning`)** or **Stripe Card (`stripe`)** (or if they already have a `rel_key_...` key to paste). Then call `reltime_provision_agent_key` with `action: 'create_invoice'`, `pack`, and `payment_method`.",
122
122
  message:
123
123
  contextMessage ||
124
- "No Rel-Time API key is active yet. Ask the user which key pack they want to provision first:",
124
+ "No Rel-Time API key is active yet. Ask the user which tier and payment method (Lightning or Stripe) they want to provision:",
125
125
  available_packs: [
126
+ {
127
+ pack: "universal",
128
+ name: "1. Universal Anchor ($3 / anchor)",
129
+ price_usd: "$3.00 per credit",
130
+ credits: 1,
131
+ settlement_queue: "Priority 10-Minute Bitcoin Queue",
132
+ hashing_modes: "Standard Mode (Data Integrity + Biometric or Anonymous)",
133
+ payment_methods: ["lightning", "stripe"],
134
+ outputs: "64-Ray Sun-Stamp SVG + 1-Click Stamped Copy (.PDF/.PNG) + .JSON Doomsday Proof",
135
+ },
126
136
  {
127
137
  pack: "launch",
128
- name: "1. Agent Launch Pack ($5 / 50 Hashes)",
138
+ name: "2. Agent Launch Pack ($5 / 50 Hashes)",
129
139
  price_usd: "$5.00",
130
140
  credits: 50,
131
141
  settlement_queue: "Priority 10-Minute Bitcoin Queue",
132
142
  hashing_modes: "Standard Mode only (Data Integrity + Biometric or Anonymous)",
143
+ payment_methods: ["lightning", "stripe"],
133
144
  outputs: "64-Ray Sun-Stamp SVG + 1-Click Stamped Copy (.PDF/.PNG) + .JSON Doomsday Proof",
134
145
  },
135
146
  {
136
147
  pack: "standard",
137
- name: "2. Autonomous Agents ($50 / 500 Hashes)",
148
+ name: "3. Autonomous Agents ($50 / 500 Hashes)",
138
149
  price_usd: "$50.00",
139
150
  credits: 500,
140
151
  settlement_queue: "Dynamic 6-Hour Batch Queue",
141
152
  hashing_modes: "Temporal Mode (T_index sub-second VDF sequencing) + Standard Mode (Biometric or Anonymous)",
153
+ payment_methods: ["lightning", "stripe"],
142
154
  outputs:
143
155
  "64-Ray Sun-Stamp SVG + 1-Click Stamped Copy (.PDF/.PNG) + .JSON Doomsday Proof + Reloadable anytime (+500 credits / $50)",
144
156
  },
157
+ {
158
+ pack: "enterprise",
159
+ name: "4. Rel-Time Superhighway ($600 / 5,000 Hashes)",
160
+ price_usd: "$600.00",
161
+ credits: 5000,
162
+ settlement_queue: "Priority 10-Minute Bitcoin Queue",
163
+ hashing_modes: "Temporal Mode (T_index) + Standard Mode + Bulk Folder & Superhighway Dashboard",
164
+ payment_methods: ["lightning", "stripe"],
165
+ outputs: "64-Ray Sun-Stamp SVG + 1-Click Stamped Copy (.PDF/.PNG) + Certificate, HTML & .JSON Proof",
166
+ },
145
167
  ],
146
168
  next_step:
147
- "Ask the user: 'Would you like to start with the **Agent Launch Pack ($5 / 50 Hashes · 10-Min Queue · Standard Mode)** or the **Autonomous Agents Pack ($50 / 500 Hashes · 6-Hr Queue · Standard + Temporal Mode)**?' Once they answer, call `reltime_provision_agent_key({ action: 'create_invoice', pack: 'launch' | 'standard' })`.",
169
+ "Ask the user which tier (`universal` $3, `launch` $5/50, `standard` $50/500, or `enterprise` $600/5,000) and which payment method (`lightning` or `stripe`) they prefer, then call `reltime_provision_agent_key({ action: 'create_invoice', pack, payment_method })`.",
148
170
  };
149
171
  }
150
172
 
@@ -602,7 +624,7 @@ const TOOLS = [
602
624
  {
603
625
  name: "reltime_account_status",
604
626
  description:
605
- "Checks the remaining Hash Credits, tier, and lifetime usage of the configured Rel-Time API key (`GET /api/v1/account`). If no API key is configured yet, returns the two available Agent API Key packs (`launch` $5/50 hashes vs `standard` $50/500 hashes) so you can ask the user which pack they want to provision in chat (without needing any .zshrc or config edits).",
627
+ "Checks the remaining Hash Credits, tier, and lifetime usage of the configured Rel-Time API key (`GET /api/v1/account`). If no API key is configured yet, returns the 4 available Rel-Time Tiers (`universal` $3, `launch` $5/50, `standard` $50/500, `enterprise` $600/5,000) and payment options (`lightning` or `stripe`) so you can ask the user which tier they want to provision in chat.",
606
628
  inputSchema: {
607
629
  type: "object",
608
630
  properties: {
@@ -617,7 +639,7 @@ const TOOLS = [
617
639
  {
618
640
  name: "reltime_provision_agent_key",
619
641
  description:
620
- "Self-onboarding & Top-Up for Autonomous AI Agents via Bitcoin Lightning (`POST /v1/agent/invoice` & `POST /v1/agent/claim`). IMPORTANT:\n1. Before calling `create_invoice` for a new key, ALWAYS ask the user which pack they want first:\n - **Agent Launch Pack (`pack: 'launch'`, $5 / 50 Hashes):** Priority 10-Minute Bitcoin Queue · Standard Mode only (Data Integrity + Biometric or Anonymous) · Includes Sun-Stamp, 1-Click Stamped Copy (.PDF/.PNG), and .JSON Doomsday Proof.\n - **Autonomous Agents (`pack: 'standard'`, $50 / 500 Hashes):** Dynamic 6-Hour Batch Queue · Supports both Temporal Mode (`T_index` sub-second sequencing) and Standard Mode · Reloadable anytime (+500 credits / $50) with zero key rotation.\n2. When `create_invoice` returns, ALWAYS present BOTH the scannable QR code image (by calling Read on `qr_code_png_path` so the image renders inline in chat!) AND the full, un-truncated `ln_invoice` (`bolt11`) string in a copyable code block on the VERY FIRST try!",
642
+ "Self-onboarding & Top-Up for all 4 Rel-Time Tiers via EITHER Bitcoin Lightning OR Stripe Card Checkout (`POST /v1/agent/invoice` & `POST /v1/agent/claim`). IMPORTANT:\n1. Before calling `create_invoice` for a new key, ask the user which tier AND payment method (`lightning` or `stripe`) they want:\n - **Universal Anchor (`pack: 'universal'`, $3 / anchor):** Priority 10-Minute Bitcoin Queue · Standard Mode (Biometric or Anonymous) · Supports `quantity` (default 1).\n - **Agent Launch Pack (`pack: 'launch'`, $5 / 50 Hashes):** Priority 10-Minute Bitcoin Queue · Standard Mode · Includes Sun-Stamp, 1-Click Stamped Copy (.PDF/.PNG), and .JSON Doomsday Proof.\n - **Autonomous Agents (`pack: 'standard'`, $50 / 500 Hashes):** Dynamic 6-Hour Batch Queue · Supports both Temporal Mode (`T_index` sub-second sequencing) and Standard Mode · Reloadable anytime (+500 credits / $50) with zero key rotation.\n - **Rel-Time Superhighway (`pack: 'enterprise'`, $600 / 5,000 Hashes):** Priority 10-Minute Bitcoin Queue · Supports Temporal Mode (`T_index`) & Standard Mode + Bulk Folder.\n2. When `create_invoice` returns:\n - For **Lightning**: ALWAYS present BOTH the scannable QR code image (by calling Read on `qr_code_png_path`) AND the full, un-truncated `ln_invoice` (`bolt11`) string in a copyable code block on the VERY FIRST try!\n - For **Stripe**: The Stripe Checkout page opens automatically in the user's browser; also present the clickable `checkout_url` link and QR code (`qr_code_png_path`). Once paid, call `claim_invoice` with `invoice_id` (`cs_...`) to activate and save the key.",
621
643
  inputSchema: {
622
644
  type: "object",
623
645
  properties: {
@@ -625,27 +647,39 @@ const TOOLS = [
625
647
  type: "string",
626
648
  enum: ["create_invoice", "claim_invoice"],
627
649
  description:
628
- "'create_invoice' generates a BOLT11 Lightning invoice; 'claim_invoice' exchanges a paid invoice_id for a new API key or reloads an existing API key.",
650
+ "'create_invoice' generates a Lightning BOLT11 invoice or Stripe Checkout Session; 'claim_invoice' exchanges a paid Lightning invoice_id or Stripe session_id ('cs_...') for a new API key or reloads an existing API key.",
629
651
  },
630
652
  pack: {
631
653
  type: "string",
632
- enum: ["launch", "standard"],
654
+ enum: ["universal", "launch", "standard", "enterprise"],
633
655
  description:
634
- "Which key pack the user selected: 'launch' (Agent Launch Pack — $5 for 50 Hash Credits, 10-Min Queue, Standard Mode only) or 'standard' (Autonomous Agents — $50 for 500 Hash Credits, 6-Hr Queue, Temporal & Standard Modes, reloadable). If omitted on 'create_invoice', the tool returns the two options so you can ask the user which pack they prefer.",
656
+ "Which tier the user selected: 'universal' ($3/anchor), 'launch' ($5 / 50 Hashes), 'standard' ($50 / 500 Hashes), or 'enterprise' ($600 / 5,000 Hashes — Superhighway). If omitted on 'create_invoice', returns the 4 tier options so you can ask the user.",
657
+ },
658
+ payment_method: {
659
+ type: "string",
660
+ enum: ["lightning", "stripe"],
661
+ description:
662
+ "Payment method: 'lightning' (Bitcoin Lightning BOLT11 invoice + QR code) or 'stripe' (Stripe Card Checkout URL + browser launch). Defaults to 'lightning'.",
663
+ },
664
+ quantity: {
665
+ type: "number",
666
+ description:
667
+ "Optional credit quantity when pack is 'universal' ($3.00 per credit, default 1).",
635
668
  },
636
669
  invoice_id: {
637
670
  type: "string",
638
- description: "Required when action is 'claim_invoice'.",
671
+ description:
672
+ "Required when action is 'claim_invoice'. Pass either the Strike Lightning `invoice_id` UUID or the Stripe Checkout `session_id` (`cs_...`).",
639
673
  },
640
674
  api_key: {
641
675
  type: "string",
642
676
  description:
643
- "Optional when action is 'claim_invoice': pass an existing `rel_key_agent_...` key (or omit to use RELTIME_API_KEY if reload_existing is true) to reload Hash Credits into that key without rotating it.",
677
+ "Optional: pass an existing `rel_key_...` key (or omit to use RELTIME_API_KEY if reload_existing is true) to reload Hash Credits into that key without rotating it.",
644
678
  },
645
679
  reload_existing: {
646
680
  type: "boolean",
647
681
  description:
648
- "If true during 'claim_invoice', reloads Hash Credits into the currently configured RELTIME_API_KEY (or passed `api_key`) instead of generating a new key.",
682
+ "If true, reloads Hash Credits into the currently configured RELTIME_API_KEY (or passed `api_key`) instead of generating a new key.",
649
683
  },
650
684
  },
651
685
  required: ["action"],
@@ -952,23 +986,80 @@ async function executeTool(name, args = {}) {
952
986
 
953
987
  if (name === "reltime_provision_agent_key") {
954
988
  if (args.action === "create_invoice") {
955
- if (args.pack !== "launch" && args.pack !== "standard") {
989
+ const validPacks = ["universal", "launch", "standard", "enterprise", "superhighway"];
990
+ const normalizedPack = (args.pack || "").trim().toLowerCase();
991
+ if (!validPacks.includes(normalizedPack)) {
956
992
  return buildPackSelectionPrompt(
957
- "Please ask the user which Rel-Time Agent API Key pack they would like to provision before generating the Lightning invoice:"
993
+ "Please ask the user which Rel-Time Tier (`universal` $3, `launch` $5/50, `standard` $50/500, or `enterprise` $600/5,000) and payment method (`lightning` or `stripe`) they would like to provision:"
958
994
  );
959
995
  }
960
996
 
961
- LAST_INVOICE_PACK = args.pack;
997
+ const finalPack = normalizedPack === "superhighway" ? "enterprise" : normalizedPack;
998
+ const paymentMethod = (args.payment_method || "lightning").trim().toLowerCase() === "stripe" ? "stripe" : "lightning";
999
+ const targetReloadKey = args.api_key || (args.reload_existing ? loadSavedApiKey() : "");
1000
+
1001
+ LAST_INVOICE_PACK = finalPack;
1002
+ const reqBody = {
1003
+ accept_terms: true,
1004
+ pack: finalPack,
1005
+ payment_method: paymentMethod,
1006
+ };
1007
+ if (args.quantity && Number(args.quantity) > 0) {
1008
+ reqBody.quantity = Math.max(1, Math.round(Number(args.quantity)));
1009
+ }
1010
+ if (targetReloadKey && targetReloadKey.trim()) {
1011
+ reqBody.api_key = targetReloadKey.trim();
1012
+ }
1013
+
962
1014
  const res = await fetch(`${API_BASE}/agent/invoice`, {
963
1015
  method: "POST",
964
1016
  headers: { "Content-Type": "application/json" },
965
- body: JSON.stringify({
966
- accept_terms: true,
967
- pack: args.pack,
968
- }),
1017
+ body: JSON.stringify(reqBody),
969
1018
  });
970
1019
  const data = await res.json();
1020
+ if (!res.ok) {
1021
+ throw new Error(`Rel-Time checkout error (${res.status}): ${JSON.stringify(data)}`);
1022
+ }
1023
+
1024
+ const checkoutUrl = data.checkout_url || data.url || "";
971
1025
  const bolt11 = data.ln_invoice || data.bolt11 || "";
1026
+
1027
+ if (paymentMethod === "stripe" && checkoutUrl) {
1028
+ try {
1029
+ openSystemBrowser(checkoutUrl);
1030
+ if (!fs.existsSync(PASSKEY_CONFIG_DIR)) {
1031
+ fs.mkdirSync(PASSKEY_CONFIG_DIR, { recursive: true, mode: 0o700 });
1032
+ }
1033
+ const qrPngBuffer = await QRCode.toBuffer(checkoutUrl, {
1034
+ type: "png",
1035
+ width: 560,
1036
+ margin: 2,
1037
+ errorCorrectionLevel: "M",
1038
+ });
1039
+ const homeQrPath = path.join(PASSKEY_CONFIG_DIR, "stripe-checkout-qr.png");
1040
+ fs.writeFileSync(homeQrPath, qrPngBuffer);
1041
+ data.qr_code_png_path = homeQrPath;
1042
+ data._mcp_image_base64 = qrPngBuffer.toString("base64");
1043
+ } catch (qrErr) {
1044
+ data.qr_error = qrErr.message;
1045
+ }
1046
+ if (data.api_key && isValidApiKeyCandidate(data.api_key)) {
1047
+ // Pre-save the pending Stripe key so as soon as payment finishes it is ready
1048
+ CURRENT_API_KEY = data.api_key.trim();
1049
+ saveApiKeyConfig(CURRENT_API_KEY, finalPack);
1050
+ data.saved_to_config = API_KEY_CONFIG_PATH;
1051
+ }
1052
+ data.mandatory_first_reply_instructions =
1053
+ "CRITICAL INSTRUCTION FOR AI AGENT: The Stripe Checkout URL has been opened in the user's browser AND the pending API key has been saved to ~/.reltime/api_key.json. Show the user the clickable `checkout_url` link (`" +
1054
+ checkoutUrl +
1055
+ "`), the `invoice_id` (`" +
1056
+ (data.invoice_id || data.session_id) +
1057
+ "`), and tell them that once they finish paying on Stripe, you will call `reltime_provision_agent_key({ action: 'claim_invoice', invoice_id: '" +
1058
+ (data.invoice_id || data.session_id) +
1059
+ "' })` to activate the credits immediately!";
1060
+ return data;
1061
+ }
1062
+
972
1063
  if (bolt11) {
973
1064
  try {
974
1065
  if (!fs.existsSync(PASSKEY_CONFIG_DIR)) {
@@ -1006,7 +1097,7 @@ async function executeTool(name, args = {}) {
1006
1097
  const resolvedPack = args.pack || LAST_INVOICE_PACK || undefined;
1007
1098
  const claimPayload = {
1008
1099
  invoice_id: args.invoice_id,
1009
- pack: resolvedPack === "launch" ? "launch" : undefined,
1100
+ pack: resolvedPack,
1010
1101
  };
1011
1102
  const targetReloadKey = args.api_key || (args.reload_existing ? loadSavedApiKey() : "");
1012
1103
  if (targetReloadKey && targetReloadKey.trim()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rel-time/mcp-server",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "Official Model Context Protocol (MCP) server for Rel-Time (rel-time.com) — Zero-Knowledge Bitcoin & VDF Provenance, Local File Hashing, and Sun-Stamp Generation for Claude, Cursor, Windsurf, and Antigravity.",
5
5
  "main": "index.js",
6
6
  "bin": {