@candledottv/mcp 0.6.3 → 0.6.4

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/dist/index.js +40 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -104,6 +104,43 @@ function percentOfBalance(balanceRaw, percent) {
104
104
 
105
105
  // src/orchestrate.ts
106
106
  import { randomUUID } from "node:crypto";
107
+
108
+ // src/version.ts
109
+ var SERVER_VERSION = "0.6.4";
110
+
111
+ // src/update-notice.ts
112
+ var PLAIN_VERSION = /^\d+\.\d+\.\d+$/;
113
+ var latestSeen = null;
114
+ var warned = false;
115
+ function newer(a, b) {
116
+ const [a1 = 0, a2 = 0, a3 = 0] = a.split(".").map(Number);
117
+ const [b1 = 0, b2 = 0, b3 = 0] = b.split(".").map(Number);
118
+ return a1 !== b1 ? a1 > b1 : a2 !== b2 ? a2 > b2 : a3 > b3;
119
+ }
120
+ function noteVersionHeaders(res) {
121
+ const headers = res?.headers;
122
+ const value = typeof headers?.get === "function" ? headers.get("x-candle-mcp-latest") : null;
123
+ if (!value || !PLAIN_VERSION.test(value))
124
+ return;
125
+ if (latestSeen !== null && !newer(value, latestSeen))
126
+ return;
127
+ latestSeen = value;
128
+ if (!warned && newer(value, SERVER_VERSION) && !process.env.CANDLE_NO_UPDATE_NOTIFIER) {
129
+ warned = true;
130
+ console.error(`@candledottv/mcp ${value} is available (running ${SERVER_VERSION}). Update: npm install -g @candledottv/mcp@latest`);
131
+ }
132
+ }
133
+ function updateAvailable() {
134
+ if (latestSeen === null || !newer(latestSeen, SERVER_VERSION))
135
+ return null;
136
+ return {
137
+ current: SERVER_VERSION,
138
+ latest: latestSeen,
139
+ command: "npm install -g @candledottv/mcp@latest"
140
+ };
141
+ }
142
+
143
+ // src/orchestrate.ts
107
144
  function requireApiKey(cfg) {
108
145
  if (!cfg.apiKey) {
109
146
  throw new Error("CANDLE_AGENT_API_KEY is required for this tool. Set it in the environment or MCP client config.");
@@ -412,6 +449,7 @@ async function executionStatus(cfg, doFetch) {
412
449
  const apiKey = requireApiKey(cfg);
413
450
  const get = async (path) => {
414
451
  const res = await doFetch(`${base(cfg)}${path}`, { method: "GET", headers: headers(apiKey) });
452
+ noteVersionHeaders(res);
415
453
  const text = await res.text();
416
454
  let body;
417
455
  try {
@@ -437,6 +475,7 @@ async function executionStatus(cfg, doFetch) {
437
475
  success: true,
438
476
  ready: unreadable.length === 0 ? true : undefined,
439
477
  notice: tierBody?.maxExpired ? tierBody.maxExpiredNotice : undefined,
478
+ updateAvailable: updateAvailable() ?? undefined,
440
479
  unreadable: unreadable.length > 0 ? unreadable.map(([name]) => name) : undefined,
441
480
  wallets: wallets.body,
442
481
  tier: tier.body,
@@ -586,6 +625,7 @@ function buildRequest(name, args, cfg) {
586
625
  async function callAndRelay(name, args, cfg) {
587
626
  const { url, init } = buildRequest(name, args, cfg);
588
627
  const res = await fetch(url, init);
628
+ noteVersionHeaders(res);
589
629
  const text = await res.text();
590
630
  return {
591
631
  content: [{ type: "text", text }],
@@ -788,9 +828,6 @@ function registerTools(server, env = process.env) {
788
828
  });
789
829
  }
790
830
 
791
- // src/version.ts
792
- var SERVER_VERSION = "0.6.3";
793
-
794
831
  // src/server.ts
795
832
  function createCandleMcpServer(env = process.env) {
796
833
  const server = new McpServer({ name: "candle-mcp", version: SERVER_VERSION });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candledottv/mcp",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "MCP server for the Candle agent rail: launch tokens, read markets, report activity",
5
5
  "type": "module",
6
6
  "license": "MIT",