@solidnumber/cli 2.24.7 → 2.24.9
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/README.md +12 -3
- package/dist/commands/inbox.d.ts +9 -0
- package/dist/commands/inbox.d.ts.map +1 -1
- package/dist/commands/inbox.js +28 -13
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/keys.d.ts +9 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +88 -17
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/mcp.js +35 -4
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +3 -42
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/subscriptions.d.ts +4 -4
- package/dist/commands/subscriptions.js +50 -45
- package/dist/commands/subscriptions.js.map +1 -1
- package/dist/commands/ucp.d.ts +9 -1
- package/dist/commands/ucp.d.ts.map +1 -1
- package/dist/commands/ucp.js +71 -16
- package/dist/commands/ucp.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +114 -43
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/verbs.d.ts +14 -0
- package/dist/commands/verbs.d.ts.map +1 -1
- package/dist/commands/verbs.js +20 -19
- package/dist/commands/verbs.js.map +1 -1
- package/dist/lib/api-client.d.ts +5 -1
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +3 -1
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/error-codes.d.ts +6 -0
- package/dist/lib/error-codes.d.ts.map +1 -1
- package/dist/lib/error-codes.js +26 -4
- package/dist/lib/error-codes.js.map +1 -1
- package/dist/lib/mcp-client-config.d.ts +8 -2
- package/dist/lib/mcp-client-config.d.ts.map +1 -1
- package/dist/lib/mcp-client-config.js +8 -2
- package/dist/lib/mcp-client-config.js.map +1 -1
- package/dist/lib/mcp-freshness.d.ts +65 -0
- package/dist/lib/mcp-freshness.d.ts.map +1 -0
- package/dist/lib/mcp-freshness.js +239 -0
- package/dist/lib/mcp-freshness.js.map +1 -0
- package/dist/lib/mcp-key.d.ts +36 -0
- package/dist/lib/mcp-key.d.ts.map +1 -0
- package/dist/lib/mcp-key.js +122 -0
- package/dist/lib/mcp-key.js.map +1 -0
- package/dist/lib/mcp-providers.d.ts +15 -0
- package/dist/lib/mcp-providers.d.ts.map +1 -1
- package/dist/lib/mcp-providers.js +61 -8
- package/dist/lib/mcp-providers.js.map +1 -1
- package/dist/lib/skills/plugin.d.ts +1 -1
- package/dist/lib/skills/plugin.d.ts.map +1 -1
- package/dist/lib/skills/plugin.js +1 -1
- package/dist/lib/skills/plugin.js.map +1 -1
- package/package.json +2 -1
- package/platform-docs/llms.txt +3 -3
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.realIo = exports.MCP_LATEST_SPEC = exports.MCP_PACKAGE = void 0;
|
|
37
|
+
exports.classifySpec = classifySpec;
|
|
38
|
+
exports.refreshConfig = refreshConfig;
|
|
39
|
+
exports.latestMcpVersion = latestMcpVersion;
|
|
40
|
+
exports.refreshMcp = refreshMcp;
|
|
41
|
+
/**
|
|
42
|
+
* Keep the Solid# MCP server current — the half of `solid update` that is not
|
|
43
|
+
* the CLI.
|
|
44
|
+
*
|
|
45
|
+
* The MCP server is never "installed" by an update: a client config launches it
|
|
46
|
+
* with `npx -y <spec>`. Whether that is fresh depends entirely on the spec:
|
|
47
|
+
*
|
|
48
|
+
* @solidnumber/mcp@latest npx re-resolves on every launch → current
|
|
49
|
+
* @solidnumber/mcp npx reuses its cache from the first run → frozen
|
|
50
|
+
* @solidnumber/mcp@1.2.0 someone chose this version → left alone
|
|
51
|
+
*
|
|
52
|
+
* ⛔ Every config written before 2026-09-24 (CLI < 2.24.8) carries the bare
|
|
53
|
+
* spec, so those machines keep launching the MCP server from the day they set
|
|
54
|
+
* it up, and updating the CLI changed nothing about that. `solid update` now
|
|
55
|
+
* rewrites the bare spec to `@latest` — that one array element, nothing else —
|
|
56
|
+
* in every client config the CLI knows, including Claude Code's per-project
|
|
57
|
+
* servers inside ~/.claude.json.
|
|
58
|
+
*
|
|
59
|
+
* The MCP SDK ships INSIDE @solidnumber/mcp; it moves when we publish, never on
|
|
60
|
+
* a user's machine.
|
|
61
|
+
*
|
|
62
|
+
* The planning functions are pure (config object in, plan out). File and npm
|
|
63
|
+
* I/O sits behind an injectable `io` so tests never touch a real home dir.
|
|
64
|
+
*/
|
|
65
|
+
const fs = __importStar(require("fs"));
|
|
66
|
+
const child_process_1 = require("child_process");
|
|
67
|
+
const mcp_client_config_1 = require("./mcp-client-config");
|
|
68
|
+
exports.MCP_PACKAGE = '@solidnumber/mcp';
|
|
69
|
+
exports.MCP_LATEST_SPEC = `${exports.MCP_PACKAGE}@latest`;
|
|
70
|
+
const MCP_REGISTRY = `https://registry.npmjs.org/${exports.MCP_PACKAGE}/latest`;
|
|
71
|
+
/** What an npx argument says about @solidnumber/mcp, or null if it is not that package. */
|
|
72
|
+
function classifySpec(arg) {
|
|
73
|
+
if (typeof arg !== 'string')
|
|
74
|
+
return null;
|
|
75
|
+
if (arg === exports.MCP_PACKAGE)
|
|
76
|
+
return 'bare';
|
|
77
|
+
if (!arg.startsWith(`${exports.MCP_PACKAGE}@`))
|
|
78
|
+
return null;
|
|
79
|
+
return arg === exports.MCP_LATEST_SPEC ? 'latest' : 'pinned';
|
|
80
|
+
}
|
|
81
|
+
/** Every mcpServers map in a client config: top level, and Claude Code's per-project maps. */
|
|
82
|
+
function serverMaps(cfg) {
|
|
83
|
+
const maps = [];
|
|
84
|
+
const top = cfg.mcpServers;
|
|
85
|
+
if (top && typeof top === 'object')
|
|
86
|
+
maps.push({ scope: 'mcpServers', servers: top });
|
|
87
|
+
const projects = cfg.projects;
|
|
88
|
+
if (projects && typeof projects === 'object') {
|
|
89
|
+
for (const [dir, proj] of Object.entries(projects)) {
|
|
90
|
+
const servers = proj?.mcpServers;
|
|
91
|
+
if (servers && typeof servers === 'object') {
|
|
92
|
+
maps.push({ scope: `projects[${dir}].mcpServers`, servers: servers });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return maps;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Rewrite every bare `@solidnumber/mcp` launch spec to `@latest`. Pure: returns
|
|
100
|
+
* a deep copy plus what it found; the input is not mutated. Matches on the
|
|
101
|
+
* PACKAGE, never the server's name, and changes only that one argument.
|
|
102
|
+
*/
|
|
103
|
+
function refreshConfig(cfg) {
|
|
104
|
+
const config = JSON.parse(JSON.stringify(cfg));
|
|
105
|
+
const findings = [];
|
|
106
|
+
let changed = false;
|
|
107
|
+
for (const { scope, servers } of serverMaps(config)) {
|
|
108
|
+
for (const [server, entry] of Object.entries(servers)) {
|
|
109
|
+
const args = entry?.args;
|
|
110
|
+
if (!Array.isArray(args))
|
|
111
|
+
continue;
|
|
112
|
+
args.forEach((arg, i) => {
|
|
113
|
+
const kind = classifySpec(arg);
|
|
114
|
+
if (!kind)
|
|
115
|
+
return;
|
|
116
|
+
findings.push({ scope, server, spec: String(arg), kind });
|
|
117
|
+
if (kind === 'bare') {
|
|
118
|
+
args[i] = exports.MCP_LATEST_SPEC;
|
|
119
|
+
changed = true;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { config, findings, changed };
|
|
125
|
+
}
|
|
126
|
+
exports.realIo = {
|
|
127
|
+
readFile(p) {
|
|
128
|
+
try {
|
|
129
|
+
return fs.existsSync(p) ? fs.readFileSync(p, 'utf-8') : null;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
writeFile(p, body) {
|
|
136
|
+
fs.writeFileSync(p, body);
|
|
137
|
+
},
|
|
138
|
+
globalMcpVersion() {
|
|
139
|
+
try {
|
|
140
|
+
const out = (0, child_process_1.spawnSync)('npm', ['ls', '-g', exports.MCP_PACKAGE, '--depth=0', '--json'], {
|
|
141
|
+
encoding: 'utf8',
|
|
142
|
+
timeout: 20_000,
|
|
143
|
+
});
|
|
144
|
+
const deps = JSON.parse(out.stdout || '{}')
|
|
145
|
+
.dependencies;
|
|
146
|
+
return deps?.[exports.MCP_PACKAGE]?.version ?? null;
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
upgradeGlobalMcp() {
|
|
153
|
+
const r = (0, child_process_1.spawnSync)('npm', ['install', '-g', exports.MCP_LATEST_SPEC], { stdio: 'inherit' });
|
|
154
|
+
return r.status === 0;
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
/** Newest published @solidnumber/mcp, or null. Never throws. */
|
|
158
|
+
async function latestMcpVersion(fetchImpl = fetch) {
|
|
159
|
+
try {
|
|
160
|
+
const res = await fetchImpl(MCP_REGISTRY, { headers: { accept: 'application/json' } });
|
|
161
|
+
if (!res.ok)
|
|
162
|
+
return null;
|
|
163
|
+
const body = (await res.json());
|
|
164
|
+
return typeof body.version === 'string' ? body.version : null;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function isNewer(current, candidate) {
|
|
171
|
+
const parts = (v) => v.split('-')[0].split('.').map((n) => parseInt(n, 10) || 0);
|
|
172
|
+
const [a, b] = [parts(current), parts(candidate)];
|
|
173
|
+
for (let i = 0; i < 3; i += 1) {
|
|
174
|
+
if ((b[i] ?? 0) > (a[i] ?? 0))
|
|
175
|
+
return true;
|
|
176
|
+
if ((b[i] ?? 0) < (a[i] ?? 0))
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Bring every Solid# MCP launch on this machine to the current release.
|
|
183
|
+
* `apply: false` reports what it would do and changes nothing.
|
|
184
|
+
*/
|
|
185
|
+
async function refreshMcp(opts) {
|
|
186
|
+
const io = opts.io ?? exports.realIo;
|
|
187
|
+
const latest = await latestMcpVersion(opts.fetchImpl);
|
|
188
|
+
const clients = [];
|
|
189
|
+
const pinned = [];
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
for (const client of mcp_client_config_1.SUPPORTED_CLIENTS) {
|
|
192
|
+
const p = (0, mcp_client_config_1.configPathForClient)(client, opts.homeDir ? { homeDir: opts.homeDir } : {});
|
|
193
|
+
if (seen.has(p))
|
|
194
|
+
continue;
|
|
195
|
+
seen.add(p);
|
|
196
|
+
const raw = io.readFile(p);
|
|
197
|
+
if (raw === null)
|
|
198
|
+
continue; // client not on this machine
|
|
199
|
+
let cfg;
|
|
200
|
+
try {
|
|
201
|
+
cfg = JSON.parse(raw);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
clients.push({ client, path: p, status: 'unreadable', findings: [] });
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const { config, findings, changed } = refreshConfig(cfg);
|
|
208
|
+
if (!findings.length)
|
|
209
|
+
continue; // Solid# is not wired in this client
|
|
210
|
+
for (const f of findings)
|
|
211
|
+
if (f.kind === 'pinned')
|
|
212
|
+
pinned.push({ ...f, client });
|
|
213
|
+
if (!changed) {
|
|
214
|
+
clients.push({ client, path: p, status: 'current', findings });
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!opts.apply) {
|
|
218
|
+
clients.push({ client, path: p, status: 'would_rewrite', findings });
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
io.writeFile(p, JSON.stringify(config, null, 2) + '\n');
|
|
223
|
+
clients.push({ client, path: p, status: 'rewritten', findings });
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
clients.push({ client, path: p, status: 'write_failed', findings, error: err.message });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const installed = io.globalMcpVersion();
|
|
230
|
+
let action = 'none';
|
|
231
|
+
if (installed && latest && isNewer(installed, latest)) {
|
|
232
|
+
if (!opts.apply)
|
|
233
|
+
action = 'would_upgrade';
|
|
234
|
+
else
|
|
235
|
+
action = io.upgradeGlobalMcp() ? 'upgraded' : 'upgrade_failed';
|
|
236
|
+
}
|
|
237
|
+
return { latest, clients, global: { installed, action }, pinned };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=mcp-freshness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-freshness.js","sourceRoot":"","sources":["../../src/lib/mcp-freshness.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,oCAKC;AAqCD,sCAwBC;AA4CD,4CASC;AAiCD,gCAoDC;AAhPD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uCAAyB;AACzB,iDAA0C;AAE1C,2DAAwF;AAE3E,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,eAAe,GAAG,GAAG,mBAAW,SAAS,CAAC;AACvD,MAAM,YAAY,GAAG,8BAA8B,mBAAW,SAAS,CAAC;AAIxE,2FAA2F;AAC3F,SAAgB,YAAY,CAAC,GAAY;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,GAAG,KAAK,mBAAW;QAAE,OAAO,MAAM,CAAC;IACvC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,mBAAW,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,OAAO,GAAG,KAAK,uBAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC;AAeD,8FAA8F;AAC9F,SAAS,UAAU,CAAC,GAA4B;IAC9C,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC;IAC3B,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,GAA8B,EAAE,C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EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAG,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QACrG,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxC,IAAI,MAAM,GAA2C,MAAM,CAAC;IAC5D,IAAI,SAAS,IAAI,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,GAAG,eAAe,CAAC;;YACrC,MAAM,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACtE,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const MCP_KEY_NAME = "mcp-server (auto-provisioned by solid setup)";
|
|
2
|
+
export declare function defaultMcpKeyFile(): string;
|
|
3
|
+
export declare function readMcpKey(keyFile: string): string | null;
|
|
4
|
+
export declare function writeMcpKey(keyFile: string, key: string): void;
|
|
5
|
+
export interface KeyApi {
|
|
6
|
+
apiKeyList(): Promise<{
|
|
7
|
+
data: {
|
|
8
|
+
api_keys?: Array<{
|
|
9
|
+
key_prefix: string;
|
|
10
|
+
is_active?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
available_scopes?: string[];
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
apiKeyCreate(name: string, scopes: string[]): Promise<{
|
|
16
|
+
data: {
|
|
17
|
+
key?: string;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** True when `key` matches an active key in `keys` (list prefixes end in "..."). */
|
|
22
|
+
export declare function keyIsListed(key: string, keys: Array<{
|
|
23
|
+
key_prefix: string;
|
|
24
|
+
is_active?: boolean;
|
|
25
|
+
}>): boolean;
|
|
26
|
+
export type McpKeySource = 'cached' | 'minted';
|
|
27
|
+
/**
|
|
28
|
+
* Reuse the cached key when it belongs to the current company and is active;
|
|
29
|
+
* otherwise mint one with every scope the company may grant. Returns null
|
|
30
|
+
* when no key can be had (not logged in, network, no scopes).
|
|
31
|
+
*/
|
|
32
|
+
export declare function getOrCreateMcpApiKey(api: KeyApi, keyFile?: string): Promise<{
|
|
33
|
+
key: string;
|
|
34
|
+
source: McpKeySource;
|
|
35
|
+
} | null>;
|
|
36
|
+
//# sourceMappingURL=mcp-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-key.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-key.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY,iDAAiD,CAAC;AAE3E,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMzD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAK9D;AAED,MAAM,WAAW,MAAM;IACrB,UAAU,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;gBAAE,UAAU,EAAE,MAAM,CAAC;gBAAC,SAAS,CAAC,EAAE,OAAO,CAAA;aAAE,CAAC,CAAC;YAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;IAChI,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CACnF;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,OAAO,CAM1G;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAA4B,GACpC,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG,IAAI,CAAC,CAsBvD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MCP_KEY_NAME = void 0;
|
|
37
|
+
exports.defaultMcpKeyFile = defaultMcpKeyFile;
|
|
38
|
+
exports.readMcpKey = readMcpKey;
|
|
39
|
+
exports.writeMcpKey = writeMcpKey;
|
|
40
|
+
exports.keyIsListed = keyIsListed;
|
|
41
|
+
exports.getOrCreateMcpApiKey = getOrCreateMcpApiKey;
|
|
42
|
+
/**
|
|
43
|
+
* The long-lived sk_ key an MCP client config should carry.
|
|
44
|
+
*
|
|
45
|
+
* ⛔ A session token is never the answer here. `solid mcp install` used to
|
|
46
|
+
* write the CLI's session access token into the client config; it expires,
|
|
47
|
+
* and the MCP server then fails with 401s long after install "succeeded".
|
|
48
|
+
* `solid setup` already minted an sk_ key for this; both paths now share it.
|
|
49
|
+
*
|
|
50
|
+
* The cached key (~/.solid/mcp-key) is reused ONLY if it still appears among
|
|
51
|
+
* the current company's active keys. A key cached before `solid company
|
|
52
|
+
* switch` belongs to the old company, and wiring it in again is how a client
|
|
53
|
+
* ends up on a different tenant from the CLI (the `conflict` verdict in
|
|
54
|
+
* `solid mcp doctor`).
|
|
55
|
+
*/
|
|
56
|
+
const fs = __importStar(require("fs"));
|
|
57
|
+
const os = __importStar(require("os"));
|
|
58
|
+
const path = __importStar(require("path"));
|
|
59
|
+
exports.MCP_KEY_NAME = 'mcp-server (auto-provisioned by solid setup)';
|
|
60
|
+
function defaultMcpKeyFile() {
|
|
61
|
+
return path.join(os.homedir(), '.solid', 'mcp-key');
|
|
62
|
+
}
|
|
63
|
+
function readMcpKey(keyFile) {
|
|
64
|
+
try {
|
|
65
|
+
if (!fs.existsSync(keyFile))
|
|
66
|
+
return null;
|
|
67
|
+
const key = fs.readFileSync(keyFile, 'utf-8').trim();
|
|
68
|
+
return key.startsWith('sk_') ? key : null;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function writeMcpKey(keyFile, key) {
|
|
75
|
+
try {
|
|
76
|
+
fs.mkdirSync(path.dirname(keyFile), { recursive: true });
|
|
77
|
+
fs.writeFileSync(keyFile, key, { mode: 0o600 });
|
|
78
|
+
}
|
|
79
|
+
catch { /* best-effort */ }
|
|
80
|
+
}
|
|
81
|
+
/** True when `key` matches an active key in `keys` (list prefixes end in "..."). */
|
|
82
|
+
function keyIsListed(key, keys) {
|
|
83
|
+
return keys.some((k) => {
|
|
84
|
+
if (k.is_active === false)
|
|
85
|
+
return false;
|
|
86
|
+
const p = String(k.key_prefix || '').replace(/\.\.\.$/, '');
|
|
87
|
+
return p.length > 0 && key.startsWith(p);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Reuse the cached key when it belongs to the current company and is active;
|
|
92
|
+
* otherwise mint one with every scope the company may grant. Returns null
|
|
93
|
+
* when no key can be had (not logged in, network, no scopes).
|
|
94
|
+
*/
|
|
95
|
+
async function getOrCreateMcpApiKey(api, keyFile = defaultMcpKeyFile()) {
|
|
96
|
+
const cached = readMcpKey(keyFile);
|
|
97
|
+
let list;
|
|
98
|
+
try {
|
|
99
|
+
list = (await api.apiKeyList()).data;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Cannot verify. A cached key is still better than nothing; the doctor
|
|
103
|
+
// will say if it points somewhere else.
|
|
104
|
+
return cached ? { key: cached, source: 'cached' } : null;
|
|
105
|
+
}
|
|
106
|
+
if (cached && keyIsListed(cached, list.api_keys || []))
|
|
107
|
+
return { key: cached, source: 'cached' };
|
|
108
|
+
const scopes = list.available_scopes || [];
|
|
109
|
+
if (scopes.length === 0)
|
|
110
|
+
return null;
|
|
111
|
+
try {
|
|
112
|
+
const key = (await api.apiKeyCreate(exports.MCP_KEY_NAME, scopes)).data.key;
|
|
113
|
+
if (!key)
|
|
114
|
+
return null;
|
|
115
|
+
writeMcpKey(keyFile, key);
|
|
116
|
+
return { key, source: 'minted' };
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=mcp-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-key.js","sourceRoot":"","sources":["../../src/lib/mcp-key.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,8CAEC;AAED,gCAMC;AAED,kCAKC;AAQD,kCAMC;AASD,oDAyBC;AArFD;;;;;;;;;;;;;GAaG;AACH,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAEhB,QAAA,YAAY,GAAG,8CAA8C,CAAC;AAE3E,SAAgB,iBAAiB;IAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,UAAU,CAAC,OAAe;IACxC,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QACrD,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5C,CAAC;IAAC,MAAM,CA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CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IACD,IAAI,MAAM,IAAI,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAEjG,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC;IAC3C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,oBAAY,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACpE,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -149,6 +149,21 @@ export interface ProviderAssessment {
|
|
|
149
149
|
* on this machine, the agent used the other one.
|
|
150
150
|
*/
|
|
151
151
|
export declare function assessProviders(providers: SolidProvider[], sessionCompanyId?: number): ProviderAssessment;
|
|
152
|
+
/**
|
|
153
|
+
* The command that re-points ONE provider at this session's company, or null
|
|
154
|
+
* when no CLI command can (an account connector lives on claude.ai).
|
|
155
|
+
*
|
|
156
|
+
* ⛔ `solid mcp connect` is not it: it prints connection recipes and writes
|
|
157
|
+
* nothing. `solid mcp install <client>` rewrites that client's entry with a
|
|
158
|
+
* key for the session's company — the Claude Code user config is `vscode`
|
|
159
|
+
* (~/.claude.json).
|
|
160
|
+
*/
|
|
161
|
+
export declare function repointCommand(p: SolidProvider): string | null;
|
|
162
|
+
/**
|
|
163
|
+
* Every runnable command that moves this verdict toward `ok`, in order.
|
|
164
|
+
* Shared by the human renderer and `mcp doctor --json` so both say the same.
|
|
165
|
+
*/
|
|
166
|
+
export declare function verdictFixCommands(a: ProviderAssessment): string[];
|
|
152
167
|
/**
|
|
153
168
|
* Render a verdict as operator-readable lines.
|
|
154
169
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-providers.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,EACsE,KAAK,SAAS,EAC1F,MAAM,qBAAqB,CAAC;AAK7B,uEAAuE;AACvE,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,CAAC;AAEd,mCAAmC;AACnC,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OA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AE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,IAAI,GAAE,YAAiB,GACtB,KAAK,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB7D"}
|
|
@@ -78,6 +78,8 @@ exports.providersFromClaudeCli = providersFromClaudeCli;
|
|
|
78
78
|
exports.providersFromConfigFiles = providersFromConfigFiles;
|
|
79
79
|
exports.enumerateSolidProviders = enumerateSolidProviders;
|
|
80
80
|
exports.assessProviders = assessProviders;
|
|
81
|
+
exports.repointCommand = repointCommand;
|
|
82
|
+
exports.verdictFixCommands = verdictFixCommands;
|
|
81
83
|
exports.renderProviderVerdict = renderProviderVerdict;
|
|
82
84
|
exports.planDoctorFix = planDoctorFix;
|
|
83
85
|
exports.applyDoctorFix = applyDoctorFix;
|
|
@@ -381,6 +383,46 @@ function assessProviders(providers, sessionCompanyId) {
|
|
|
381
383
|
headline: `One Solid# connection, on company ${only.companyId}${only.companyName ? ` (${only.companyName})` : ''}.`,
|
|
382
384
|
};
|
|
383
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* The command that re-points ONE provider at this session's company, or null
|
|
388
|
+
* when no CLI command can (an account connector lives on claude.ai).
|
|
389
|
+
*
|
|
390
|
+
* ⛔ `solid mcp connect` is not it: it prints connection recipes and writes
|
|
391
|
+
* nothing. `solid mcp install <client>` rewrites that client's entry with a
|
|
392
|
+
* key for the session's company — the Claude Code user config is `vscode`
|
|
393
|
+
* (~/.claude.json).
|
|
394
|
+
*/
|
|
395
|
+
function repointCommand(p) {
|
|
396
|
+
if (p.scope === 'account' || !p.cliCanRepoint)
|
|
397
|
+
return null;
|
|
398
|
+
return p.client ? `solid mcp install ${p.client}` : 'solid mcp connect';
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Every runnable command that moves this verdict toward `ok`, in order.
|
|
402
|
+
* Shared by the human renderer and `mcp doctor --json` so both say the same.
|
|
403
|
+
*/
|
|
404
|
+
function verdictFixCommands(a) {
|
|
405
|
+
const cmds = [];
|
|
406
|
+
const add = (c) => { if (c && !cmds.includes(c))
|
|
407
|
+
cmds.push(c); };
|
|
408
|
+
if (a.verdict === 'conflict') {
|
|
409
|
+
const locals = a.active.filter((p) => p.scope !== 'account');
|
|
410
|
+
if (locals.length > 1)
|
|
411
|
+
add('solid mcp doctor --fix');
|
|
412
|
+
// Every local entry not proven on this session's company gets re-pointed.
|
|
413
|
+
for (const l of locals) {
|
|
414
|
+
if (l.companyId === null || (a.sessionCompanyId && l.companyId !== a.sessionCompanyId))
|
|
415
|
+
add(repointCommand(l));
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
else if (a.verdict === 'mismatch' || a.verdict === 'unverified') {
|
|
419
|
+
add(repointCommand(a.active[0]));
|
|
420
|
+
}
|
|
421
|
+
else if (a.verdict === 'none') {
|
|
422
|
+
add('solid mcp connect');
|
|
423
|
+
}
|
|
424
|
+
return cmds;
|
|
425
|
+
}
|
|
384
426
|
/**
|
|
385
427
|
* Render a verdict as operator-readable lines.
|
|
386
428
|
*
|
|
@@ -402,7 +444,10 @@ function renderProviderVerdict(a) {
|
|
|
402
444
|
const where = p.scope === 'account'
|
|
403
445
|
? chalk.dim('account connector — lives on claude.ai, not on this machine')
|
|
404
446
|
: chalk.dim(`${p.client ? `${p.client}: ` : ''}${p.configPath || p.scope}`);
|
|
405
|
-
|
|
447
|
+
const off = a.sessionCompanyId && p.companyId !== null && p.companyId !== a.sessionCompanyId
|
|
448
|
+
? chalk.red.bold(` ≠ this session (company ${a.sessionCompanyId})`)
|
|
449
|
+
: '';
|
|
450
|
+
L.push(` ${p.active ? chalk.green('●') : chalk.dim('○')} ${chalk.bold(p.name)} → ${who}${off}`);
|
|
406
451
|
L.push(` ${where}`);
|
|
407
452
|
if (p.unresolved)
|
|
408
453
|
L.push(` ${chalk.dim(p.unresolved)}`);
|
|
@@ -413,6 +458,8 @@ function renderProviderVerdict(a) {
|
|
|
413
458
|
// evidence, on the screen whose entire job is to be believed.
|
|
414
459
|
L.push(chalk.red.bold(` ✗ ${a.active.length} Solid# connections are active. Nothing decides which one the AI uses.`));
|
|
415
460
|
L.push('');
|
|
461
|
+
if (a.sessionCompanyId)
|
|
462
|
+
L.push(` ${chalk.dim('This CLI session:')} ${chalk.bold(`company ${a.sessionCompanyId}`)}`);
|
|
416
463
|
for (const p of a.active)
|
|
417
464
|
describe(p);
|
|
418
465
|
L.push('');
|
|
@@ -433,10 +480,15 @@ function renderProviderVerdict(a) {
|
|
|
433
480
|
const where = l.client ? `${l.client} (${l.configPath})` : l.name;
|
|
434
481
|
L.push(` ${chalk.dim('•')} ${chalk.bold(l.name)} in ${chalk.dim(where)}`);
|
|
435
482
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
483
|
+
const cmds = verdictFixCommands(a);
|
|
484
|
+
if (cmds.length) {
|
|
485
|
+
L.push('');
|
|
486
|
+
L.push(` ${chalk.bold('Run:')}`);
|
|
487
|
+
for (const c of cmds) {
|
|
488
|
+
const why = c === 'solid mcp doctor --fix'
|
|
489
|
+
? 'keeps one local entry, removes the rest (files backed up)'
|
|
490
|
+
: c.startsWith('solid mcp install ') ? `re-points that entry at company ${a.sessionCompanyId ?? 'of this session'}` : '';
|
|
491
|
+
L.push(` ${chalk.cyan(c)}${why ? chalk.dim(` — ${why}`) : ''}`);
|
|
440
492
|
}
|
|
441
493
|
}
|
|
442
494
|
return L;
|
|
@@ -451,8 +503,9 @@ function renderProviderVerdict(a) {
|
|
|
451
503
|
for (const q of a.active)
|
|
452
504
|
describe(q);
|
|
453
505
|
L.push('');
|
|
454
|
-
|
|
455
|
-
|
|
506
|
+
const cmd = repointCommand(p);
|
|
507
|
+
L.push(cmd
|
|
508
|
+
? ` ${chalk.bold('Fix:')} ${chalk.cyan(cmd)}${chalk.dim(` — rewrites ${p.configPath || p.name} with a key for company ${a.sessionCompanyId}`)}`
|
|
456
509
|
: ` ${chalk.bold('Fix:')} re-authorize it in ${chalk.cyan('claude.ai → Settings → Connectors')} — this CLI cannot move it.`);
|
|
457
510
|
return L;
|
|
458
511
|
}
|
|
@@ -474,7 +527,7 @@ function renderProviderVerdict(a) {
|
|
|
474
527
|
L.push(` ${chalk.dim('then run')} ${chalk.cyan('solid mcp connect')}`);
|
|
475
528
|
}
|
|
476
529
|
else {
|
|
477
|
-
L.push(` ${chalk.bold('Fix:')} ${chalk.cyan('solid mcp connect')}`);
|
|
530
|
+
L.push(` ${chalk.bold('Fix:')} ${chalk.cyan(repointCommand(p) ?? 'solid mcp connect')}`);
|
|
478
531
|
}
|
|
479
532
|
return L;
|
|
480
533
|
}
|