@cubedot/cli 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +29 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -101,14 +101,16 @@ function writeMcpJson(cwd, mcpUrl, projectId, key) {
101
101
  } catch {
102
102
  }
103
103
  }
104
+ const mcpEndpoint = new URL(mcpUrl);
105
+ mcpEndpoint.searchParams.set("project", projectId);
104
106
  const config = {
105
107
  ...existing,
106
108
  mcpServers: {
107
109
  ...existing.mcpServers ?? {},
108
110
  cubedot: {
109
111
  type: "http",
110
- url: `${mcpUrl}?project=${encodeURIComponent(projectId)}`,
111
- headers: { "x-api-key": key }
112
+ url: mcpEndpoint.toString(),
113
+ headers: { Authorization: `ApiKey ${key}` }
112
114
  }
113
115
  }
114
116
  };
@@ -202,6 +204,23 @@ function writeHashes(cwd, hashes) {
202
204
  if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
203
205
  writeFileSync(join(dir, "hashes.json"), JSON.stringify(hashes, null, 2) + "\n", "utf8");
204
206
  }
207
+ function enableMcpServerInSettings(cwd, serverName = "cubedot") {
208
+ const dir = join(cwd, ".claude");
209
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
210
+ const path = join(dir, "settings.json");
211
+ let settings = {};
212
+ if (existsSync(path)) {
213
+ try {
214
+ settings = JSON.parse(readFileSync(path, "utf8"));
215
+ } catch {
216
+ }
217
+ }
218
+ const cur = Array.isArray(settings["enabledMcpjsonServers"]) ? settings["enabledMcpjsonServers"] : [];
219
+ if (!cur.includes(serverName)) {
220
+ settings["enabledMcpjsonServers"] = [...cur, serverName];
221
+ }
222
+ writeFileSync(path, JSON.stringify(settings, null, 2) + "\n", "utf8");
223
+ }
205
224
  function readLinks(cwd) {
206
225
  const path = join(cwd, ".cubedot", "links.json");
207
226
  if (!existsSync(path)) return {};
@@ -466,6 +485,7 @@ async function initCommand(opts) {
466
485
  await client.close();
467
486
  }
468
487
  writeMcpJson(cwd, mcpUrl, projectId, key);
488
+ enableMcpServerInSettings(cwd);
469
489
  writeCubedotConfig(cwd, {
470
490
  projectId,
471
491
  mcpUrl,
@@ -804,10 +824,12 @@ async function readKeyFromMcpJson(cwd) {
804
824
  throw new Error(".mcp.json not found. Run `cubedot init` first.");
805
825
  }
806
826
  const mcp = JSON.parse(readFileSync5(mcpPath, "utf8"));
807
- const key = mcp.mcpServers?.["cubedot"]?.headers?.["x-api-key"];
827
+ const headers = mcp.mcpServers?.["cubedot"]?.headers ?? {};
828
+ const authHeader = headers["Authorization"] ?? headers["authorization"] ?? "";
829
+ const key = authHeader.replace(/^ApiKey\s+/i, "").trim();
808
830
  if (!key) {
809
831
  throw new Error(
810
- ".mcp.json is missing the cubedot x-api-key. Re-run `cubedot init`."
832
+ ".mcp.json is missing the cubedot Authorization header. Re-run `cubedot init`."
811
833
  );
812
834
  }
813
835
  return key;
@@ -843,7 +865,9 @@ async function statusCommand() {
843
865
  } else {
844
866
  try {
845
867
  const mcp = JSON.parse(readFileSync6(mcpPath, "utf8"));
846
- const keyRaw = mcp.mcpServers?.["cubedot"]?.headers?.["x-api-key"] ?? "";
868
+ const headers = mcp.mcpServers?.["cubedot"]?.headers ?? {};
869
+ const authHeader = headers["Authorization"] ?? headers["authorization"] ?? "";
870
+ const keyRaw = authHeader.replace(/^ApiKey\s+/i, "").trim();
847
871
  const keyTail = keyRaw ? keyRaw.slice(-8) : "(empty)";
848
872
  console.log(pc3.green("\u2713") + ` .mcp.json \u2014 key tail: \u2026${keyTail}`);
849
873
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubedot/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Cubedot CLI — connect your repo to the Cubedot MCP and drive the build loop",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://cubedot.ai",