@agentteams/cli 0.1.82 → 0.1.84
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/.eslintcache +1 -1
- package/README.md +4 -3
- package/dist/auth/activeCredential.d.ts +22 -0
- package/dist/auth/activeCredential.d.ts.map +1 -0
- package/dist/auth/activeCredential.js +25 -0
- package/dist/auth/activeCredential.js.map +1 -0
- package/dist/auth/credentialStore.d.ts +89 -0
- package/dist/auth/credentialStore.d.ts.map +1 -0
- package/dist/auth/credentialStore.js +254 -0
- package/dist/auth/credentialStore.js.map +1 -0
- package/dist/auth/personalTokenClient.d.ts +155 -0
- package/dist/auth/personalTokenClient.d.ts.map +1 -0
- package/dist/auth/personalTokenClient.js +312 -0
- package/dist/auth/personalTokenClient.js.map +1 -0
- package/dist/auth/personalTokenStore.d.ts +16 -0
- package/dist/auth/personalTokenStore.d.ts.map +1 -0
- package/dist/auth/personalTokenStore.js +27 -0
- package/dist/auth/personalTokenStore.js.map +1 -0
- package/dist/commands/agentConfig.d.ts.map +1 -1
- package/dist/commands/agentConfig.js +8 -6
- package/dist/commands/agentConfig.js.map +1 -1
- package/dist/commands/auth.d.ts +97 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +245 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +16 -2
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/convention.d.ts +11 -0
- package/dist/commands/convention.d.ts.map +1 -1
- package/dist/commands/convention.js +35 -11
- package/dist/commands/convention.js.map +1 -1
- package/dist/commands/dependency.d.ts.map +1 -1
- package/dist/commands/dependency.js +8 -6
- package/dist/commands/dependency.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +75 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +19 -14
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +18 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +114 -20
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +101 -15
- package/dist/index.js.map +1 -1
- package/dist/mcp/context.d.ts +15 -1
- package/dist/mcp/context.d.ts.map +1 -1
- package/dist/mcp/context.js +24 -5
- package/dist/mcp/context.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +5 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +25 -22
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp-registration/atomicWrite.d.ts +9 -3
- package/dist/mcp-registration/atomicWrite.d.ts.map +1 -1
- package/dist/mcp-registration/atomicWrite.js +58 -15
- package/dist/mcp-registration/atomicWrite.js.map +1 -1
- package/dist/mcp-registration/clients.d.ts.map +1 -1
- package/dist/mcp-registration/clients.js +1 -9
- package/dist/mcp-registration/clients.js.map +1 -1
- package/dist/mcp-registration/doctor.d.ts +38 -0
- package/dist/mcp-registration/doctor.d.ts.map +1 -0
- package/dist/mcp-registration/doctor.js +379 -0
- package/dist/mcp-registration/doctor.js.map +1 -0
- package/dist/mcp-registration/index.d.ts +7 -5
- package/dist/mcp-registration/index.d.ts.map +1 -1
- package/dist/mcp-registration/index.js +46 -21
- package/dist/mcp-registration/index.js.map +1 -1
- package/dist/mcp-registration/install.d.ts.map +1 -1
- package/dist/mcp-registration/install.js +12 -15
- package/dist/mcp-registration/install.js.map +1 -1
- package/dist/mcp-registration/render.d.ts +8 -6
- package/dist/mcp-registration/render.d.ts.map +1 -1
- package/dist/mcp-registration/render.js +15 -36
- package/dist/mcp-registration/render.js.map +1 -1
- package/dist/mcp-registration/serverSpec.d.ts +31 -18
- package/dist/mcp-registration/serverSpec.d.ts.map +1 -1
- package/dist/mcp-registration/serverSpec.js +36 -20
- package/dist/mcp-registration/serverSpec.js.map +1 -1
- package/dist/mcp-registration/types.d.ts +0 -3
- package/dist/mcp-registration/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/apiKeyInput.d.ts +16 -0
- package/dist/utils/apiKeyInput.d.ts.map +1 -0
- package/dist/utils/apiKeyInput.js +47 -0
- package/dist/utils/apiKeyInput.js.map +1 -0
- package/dist/utils/authServer.d.ts +39 -4
- package/dist/utils/authServer.d.ts.map +1 -1
- package/dist/utils/authServer.js +146 -62
- package/dist/utils/authServer.js.map +1 -1
- package/dist/utils/config.d.ts +121 -10
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +204 -5
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +16 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/httpClient.d.ts.map +1 -1
- package/dist/utils/httpClient.js +25 -0
- package/dist/utils/httpClient.js.map +1 -1
- package/dist/utils/initOutput.d.ts.map +1 -1
- package/dist/utils/initOutput.js +30 -0
- package/dist/utils/initOutput.js.map +1 -1
- package/package.json +1 -1
- package/web-compatibility.json +4 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
|
-
import { getConfigurationNotFoundMessage,
|
|
2
|
+
import { getConfigurationNotFoundMessage, loadConfigIdentity } from '../utils/config.js';
|
|
3
3
|
import { buildConfigOverrides } from '../utils/apiContext.js';
|
|
4
4
|
import { findClient, listClientIds } from './clients.js';
|
|
5
5
|
import { buildBatchPlan, installClient, resolveInstallExitCode, runBatchInstall } from './install.js';
|
|
@@ -7,23 +7,34 @@ import { renderConfigSnippet, renderVendorCommandLine } from './render.js';
|
|
|
7
7
|
import { buildServerSpec, MCP_SERVER_NAME } from './serverSpec.js';
|
|
8
8
|
export { MCP_CLIENTS, findClient, listClientIds } from './clients.js';
|
|
9
9
|
export { detectClients } from './detect.js';
|
|
10
|
+
export { runMcpDoctorCommand } from './doctor.js';
|
|
10
11
|
export { buildBatchPlan, installClient, resolveInstallExitCode, runBatchInstall } from './install.js';
|
|
11
|
-
export { renderConfigSnippet, renderVendorCommandLine,
|
|
12
|
-
export { buildServerSpec, MCP_SERVER_NAME
|
|
12
|
+
export { renderConfigSnippet, renderVendorCommandLine, redactKeyMaterial } from './render.js';
|
|
13
|
+
export { buildServerSpec, MCP_SERVER_NAME } from './serverSpec.js';
|
|
13
14
|
export * from './types.js';
|
|
14
15
|
const MCP_CLIENT_ID_LIST = listClientIds();
|
|
15
16
|
export { MCP_CLIENT_ID_LIST };
|
|
17
|
+
/**
|
|
18
|
+
* What goes into a client's config file.
|
|
19
|
+
*
|
|
20
|
+
* Registration uses identity only for command context and human-readable
|
|
21
|
+
* output. The generated server spec never receives these values:
|
|
22
|
+
* `agentteams mcp` resolves project identity and credentials at request time.
|
|
23
|
+
*/
|
|
16
24
|
function resolveCredentials(options, dependencies) {
|
|
17
25
|
if (dependencies?.credentials)
|
|
18
26
|
return dependencies.credentials;
|
|
19
|
-
const
|
|
20
|
-
|
|
27
|
+
const overrides = buildConfigOverrides(options);
|
|
28
|
+
const identity = loadConfigIdentity(overrides);
|
|
29
|
+
if (!identity)
|
|
21
30
|
throw new Error(getConfigurationNotFoundMessage());
|
|
31
|
+
// Identity only. Asking for a credential plan here would be dead work — the spec
|
|
32
|
+
// embeds nothing — and it would attach a side effect (the legacy `key_` warning)
|
|
33
|
+
// to `mcp config`, which renders a snippet and touches no file.
|
|
22
34
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
apiUrl: config.apiUrl,
|
|
35
|
+
projectId: identity.projectId,
|
|
36
|
+
teamId: identity.teamId,
|
|
37
|
+
apiUrl: identity.apiUrl,
|
|
27
38
|
};
|
|
28
39
|
}
|
|
29
40
|
function resolvePathContext(overrides) {
|
|
@@ -40,6 +51,18 @@ function parseScope(value) {
|
|
|
40
51
|
return value;
|
|
41
52
|
throw new Error(`Unsupported scope: ${String(value)}. Use "user" or "project".`);
|
|
42
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Say which runtime the entry will spawn, so the choice is never silent.
|
|
56
|
+
*
|
|
57
|
+
* The bare executable is the fast path; `npx` is what a machine without a global install
|
|
58
|
+
* gets. Either way the user sees the reason here instead of discovering it as a client-side
|
|
59
|
+
* "server failed to start" (or as an unexplained cold start on every request).
|
|
60
|
+
*/
|
|
61
|
+
function describeRuntime(spec) {
|
|
62
|
+
return spec.command === 'npx'
|
|
63
|
+
? 'No global `agentteams` was found on PATH, so the entry runs the published package with npx. Run `npm install -g @agentteams/cli` and re-register for a faster start.'
|
|
64
|
+
: 'The entry runs the globally installed `agentteams` executable.';
|
|
65
|
+
}
|
|
43
66
|
function parseClientId(value) {
|
|
44
67
|
const client = findClient(value);
|
|
45
68
|
if (!client) {
|
|
@@ -49,16 +72,16 @@ function parseClientId(value) {
|
|
|
49
72
|
}
|
|
50
73
|
/**
|
|
51
74
|
* `config` is the escape hatch: it renders the exact fragment each client
|
|
52
|
-
* expects and never touches a file, a vendor CLI or the network. The
|
|
53
|
-
*
|
|
54
|
-
*
|
|
75
|
+
* expects and never touches a file, a vendor CLI or the network. The spawned
|
|
76
|
+
* server resolves local project identity and credentials for itself, so the
|
|
77
|
+
* fragment is safe to paste without any environment values.
|
|
55
78
|
*/
|
|
56
79
|
export function runMcpConfigCommand(options, dependencies) {
|
|
57
80
|
const credentials = resolveCredentials(options, dependencies);
|
|
58
81
|
const context = resolvePathContext(dependencies?.context);
|
|
59
82
|
const scope = parseScope(options.scope);
|
|
60
83
|
const clientIds = options.client ? [parseClientId(options.client)] : MCP_CLIENT_ID_LIST;
|
|
61
|
-
const spec = buildServerSpec({
|
|
84
|
+
const spec = buildServerSpec({ serverEntry: options.serverEntry, context });
|
|
62
85
|
const sections = clientIds.map((clientId) => {
|
|
63
86
|
const client = findClient(clientId);
|
|
64
87
|
if (!client)
|
|
@@ -80,7 +103,8 @@ export function runMcpConfigCommand(options, dependencies) {
|
|
|
80
103
|
});
|
|
81
104
|
const lines = [
|
|
82
105
|
`AgentTeams MCP config (${scope} scope) — project ${credentials.projectId}, team ${credentials.teamId}`,
|
|
83
|
-
'
|
|
106
|
+
'No credentials or project binding are embedded. The MCP server resolves local configuration and the OS credential store at request time.',
|
|
107
|
+
describeRuntime(spec),
|
|
84
108
|
];
|
|
85
109
|
for (const section of sections) {
|
|
86
110
|
lines.push('');
|
|
@@ -115,7 +139,6 @@ function summarize(results) {
|
|
|
115
139
|
failed: results.filter((r) => r.outcome === 'FAILED').length,
|
|
116
140
|
};
|
|
117
141
|
}
|
|
118
|
-
const USER_SCOPE_BINDING_WARNING = 'Warning: a user-scope registration is machine-wide. If this client already has an "agentteams" server pointing at a different AgentTeams project, applying this plan re-points it.';
|
|
119
142
|
/**
|
|
120
143
|
* `install` has two modes:
|
|
121
144
|
* - `--client <id>`: apply a single client/scope (project scope allowed here).
|
|
@@ -141,9 +164,9 @@ export function runMcpInstallCommand(options, dependencies) {
|
|
|
141
164
|
const lines = [
|
|
142
165
|
`AgentTeams MCP install — ${client.label} (${scope} scope)`,
|
|
143
166
|
`Project ${credentials.projectId}, team ${credentials.teamId}`,
|
|
167
|
+
'The server entry contains no credentials or project binding; runtime resolution uses local configuration and the OS credential store.',
|
|
168
|
+
describeRuntime(buildServerSpec({ serverEntry: options.serverEntry, context })),
|
|
144
169
|
];
|
|
145
|
-
if (scope === 'user')
|
|
146
|
-
lines.push(USER_SCOPE_BINDING_WARNING);
|
|
147
170
|
lines.push(renderResultLine(result));
|
|
148
171
|
if (result.backupPath)
|
|
149
172
|
lines.push(`Backup: ${result.backupPath}`);
|
|
@@ -170,10 +193,10 @@ export function runMcpInstallCommand(options, dependencies) {
|
|
|
170
193
|
const lines = [
|
|
171
194
|
'AgentTeams MCP install — dry run (no files were changed)',
|
|
172
195
|
`Plan: register "${MCP_SERVER_NAME}" at ${scope} scope for project ${plan.binding.projectId}, team ${plan.binding.teamId}`,
|
|
196
|
+
'The server entries contain no credentials or project binding; runtime resolution uses local configuration and the OS credential store.',
|
|
197
|
+
describeRuntime(buildServerSpec({ serverEntry: options.serverEntry, context })),
|
|
173
198
|
'',
|
|
174
199
|
];
|
|
175
|
-
if (scope === 'user')
|
|
176
|
-
lines.splice(2, 0, USER_SCOPE_BINDING_WARNING);
|
|
177
200
|
for (const entry of plan.entries) {
|
|
178
201
|
lines.push(`- ${entry.clientId} [${entry.applicable ? 'will apply' : 'skip'}] ${formatDetectionEvidence(entry)}`);
|
|
179
202
|
lines.push(` target: ${entry.targetPath} via ${entry.strategy}`);
|
|
@@ -189,20 +212,22 @@ export function runMcpInstallCommand(options, dependencies) {
|
|
|
189
212
|
const { plan, results } = runBatchInstall({
|
|
190
213
|
context,
|
|
191
214
|
credentials,
|
|
215
|
+
scope,
|
|
192
216
|
serverEntry: options.serverEntry,
|
|
193
217
|
vendorRunner: dependencies?.vendorRunner,
|
|
194
218
|
detectionDependencies: dependencies?.detectionDependencies,
|
|
195
219
|
});
|
|
196
220
|
const summary = summarize(results);
|
|
197
221
|
const lines = [
|
|
198
|
-
`AgentTeams MCP install — applied at
|
|
222
|
+
`AgentTeams MCP install — applied at ${scope} scope for project ${plan.binding.projectId}, team ${plan.binding.teamId}`,
|
|
223
|
+
describeRuntime(buildServerSpec({ serverEntry: options.serverEntry, context })),
|
|
199
224
|
...results.map(renderResultLine),
|
|
200
225
|
'',
|
|
201
226
|
`Summary: ${summary.applied} registered, ${summary.skipped} skipped, ${summary.failed} failed.`,
|
|
202
227
|
];
|
|
203
228
|
return {
|
|
204
229
|
text: lines.join('\n'),
|
|
205
|
-
json: { scope
|
|
230
|
+
json: { scope, dryRun: false, plan, results, summary },
|
|
206
231
|
exitCode: resolveInstallExitCode(results),
|
|
207
232
|
};
|
|
208
233
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp-registration/index.ts"],"names":[],"mappings":"AAA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EAAE;QACtD,QAAQ,EAAE,sBAAsB,CAAC,OAAO,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,EAAsC,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC/G,OAAO,EAAoC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAyJD,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA6B1E;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACtC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;I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|
@@ -3,7 +3,7 @@ import { PROJECT_SCOPE_FILE_MODE, USER_SCOPE_FILE_MODE, writeConfigFileAtomicall
|
|
|
3
3
|
import { findClient, MCP_CLIENTS } from './clients.js';
|
|
4
4
|
import { detectClients } from './detect.js';
|
|
5
5
|
import { McpConfigParseError, upsertContainerEntry } from './jsonc.js';
|
|
6
|
-
import { buildEntryValue,
|
|
6
|
+
import { buildEntryValue, redactKeyMaterial, renderConfigSnippet, renderVendorCommandLine } from './render.js';
|
|
7
7
|
import { buildServerSpec, MCP_SERVER_NAME } from './serverSpec.js';
|
|
8
8
|
import { runVendorCommand } from './vendorCommand.js';
|
|
9
9
|
function firstLines(text, limit = 4) {
|
|
@@ -22,9 +22,8 @@ function installViaVendorCommand(options, configPath, manualSnippet) {
|
|
|
22
22
|
if (!vendor)
|
|
23
23
|
throw new Error(`No vendor command configured for ${client.id}/${scope}`);
|
|
24
24
|
const spec = buildServerSpec({
|
|
25
|
-
credentials: options.credentials,
|
|
26
|
-
secretMode: scope === 'user' ? 'literal' : 'reference',
|
|
27
25
|
serverEntry: options.serverEntry,
|
|
26
|
+
context: options.context,
|
|
28
27
|
});
|
|
29
28
|
const executable = client.executables[0];
|
|
30
29
|
const runner = options.vendorRunner ?? runVendorCommand;
|
|
@@ -38,9 +37,9 @@ function installViaVendorCommand(options, configPath, manualSnippet) {
|
|
|
38
37
|
manualSnippet,
|
|
39
38
|
};
|
|
40
39
|
}
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
const combined =
|
|
40
|
+
// Registration passes no credential, so there is no value of ours to redact — but a
|
|
41
|
+
// vendor CLI echoing its own argv/environment on failure can still surface a `key_`.
|
|
42
|
+
const combined = redactKeyMaterial(`${outcome.stdout}\n${outcome.stderr}`);
|
|
44
43
|
const alreadyRegistered = (vendor.alreadyRegisteredPatterns ?? []).some((pattern) => pattern.test(combined));
|
|
45
44
|
if (alreadyRegistered) {
|
|
46
45
|
return {
|
|
@@ -75,10 +74,8 @@ function installViaJsonMerge(options, configPath, manualSnippet) {
|
|
|
75
74
|
throw new Error(`No container key configured for ${client.id}/${scope}`);
|
|
76
75
|
const base = { clientId: client.id, scope, strategy: definition.strategy, configPath };
|
|
77
76
|
const spec = buildServerSpec({
|
|
78
|
-
credentials: options.credentials,
|
|
79
|
-
// Project files are committable, so they never receive a literal key.
|
|
80
|
-
secretMode: scope === 'user' ? 'literal' : 'reference',
|
|
81
77
|
serverEntry: options.serverEntry,
|
|
78
|
+
context: options.context,
|
|
82
79
|
});
|
|
83
80
|
let source = '';
|
|
84
81
|
if (existsSync(configPath)) {
|
|
@@ -99,7 +96,7 @@ function installViaJsonMerge(options, configPath, manualSnippet) {
|
|
|
99
96
|
edited = upsertContainerEntry(source, {
|
|
100
97
|
containerKey,
|
|
101
98
|
entryKey: serverName,
|
|
102
|
-
entryValue: buildEntryValue(definition.entryShape ?? 'plain', spec
|
|
99
|
+
entryValue: buildEntryValue(definition.entryShape ?? 'plain', spec),
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
catch (error) {
|
|
@@ -145,9 +142,8 @@ export function installClient(options) {
|
|
|
145
142
|
const definition = client.scopes[scope];
|
|
146
143
|
const configPath = definition.configPath(options.context);
|
|
147
144
|
const displaySpec = buildServerSpec({
|
|
148
|
-
credentials: options.credentials,
|
|
149
|
-
secretMode: 'reference',
|
|
150
145
|
serverEntry: options.serverEntry,
|
|
146
|
+
context: options.context,
|
|
151
147
|
});
|
|
152
148
|
const manualSnippet = renderConfigSnippet(client, scope, displaySpec, serverName);
|
|
153
149
|
if (definition.strategy === 'configOnly') {
|
|
@@ -208,7 +204,8 @@ export function buildBatchPlan(options) {
|
|
|
208
204
|
* the collected outcomes.
|
|
209
205
|
*/
|
|
210
206
|
export function runBatchInstall(options) {
|
|
211
|
-
const
|
|
207
|
+
const scope = options.scope ?? 'user';
|
|
208
|
+
const plan = buildBatchPlan({ ...options, scope });
|
|
212
209
|
const results = [];
|
|
213
210
|
for (const entry of plan.entries) {
|
|
214
211
|
const client = findClient(entry.clientId);
|
|
@@ -217,7 +214,7 @@ export function runBatchInstall(options) {
|
|
|
217
214
|
if (!entry.applicable) {
|
|
218
215
|
results.push({
|
|
219
216
|
clientId: entry.clientId,
|
|
220
|
-
scope:
|
|
217
|
+
scope: entry.scope,
|
|
221
218
|
strategy: entry.strategy,
|
|
222
219
|
configPath: entry.targetPath,
|
|
223
220
|
outcome: entry.strategy === 'configOnly' ? 'SKIPPED_CONFIG_ONLY' : 'SKIPPED_NOT_DETECTED',
|
|
@@ -227,7 +224,7 @@ export function runBatchInstall(options) {
|
|
|
227
224
|
}
|
|
228
225
|
results.push(installClient({
|
|
229
226
|
client,
|
|
230
|
-
scope:
|
|
227
|
+
scope: entry.scope,
|
|
231
228
|
credentials: options.credentials,
|
|
232
229
|
context: options.context,
|
|
233
230
|
serverEntry: options.serverEntry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/mcp-registration/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAA8B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/mcp-registration/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,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KAAK,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,sBAAsB;gBACzF,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,UAAU;aACnC,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CACV,aAAa,CAAC;YACZ,MAAM;YACN,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;SACnC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,sBAAsB,CAAC,OAAwB;IAC7D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { McpClientDefinition, McpEntryShape, McpScope,
|
|
1
|
+
import type { McpClientDefinition, McpEntryShape, McpScope, McpServerSpec } from './types.js';
|
|
2
2
|
/** Serialize the AgentTeams server entry in the shape the target client expects. */
|
|
3
|
-
export declare function buildEntryValue(shape: McpEntryShape, spec: McpServerSpec
|
|
3
|
+
export declare function buildEntryValue(shape: McpEntryShape, spec: McpServerSpec): Record<string, unknown>;
|
|
4
4
|
/**
|
|
5
5
|
* The copy-pasteable config fragment for one client/scope. This is the escape
|
|
6
6
|
* hatch every failure path points at, so it must be complete on its own: the
|
|
@@ -10,9 +10,11 @@ export declare function renderConfigSnippet(client: McpClientDefinition, scope:
|
|
|
10
10
|
/** The equivalent vendor command, for users who prefer to run it themselves. */
|
|
11
11
|
export declare function renderVendorCommandLine(client: McpClientDefinition, scope: McpScope, spec: McpServerSpec, serverName: string): string | null;
|
|
12
12
|
/**
|
|
13
|
-
* Strip
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Strip AgentTeams key material from vendor output before it reaches a terminal or a log.
|
|
14
|
+
*
|
|
15
|
+
* Registration itself no longer holds a credential — the server spec embeds nothing — so
|
|
16
|
+
* there is no value to pass in. What remains is that vendor CLIs echo their own argv and
|
|
17
|
+
* environment on failure, and that output can carry a `key_` this process never saw.
|
|
16
18
|
*/
|
|
17
|
-
export declare function
|
|
19
|
+
export declare function redactKeyMaterial(text: string): string;
|
|
18
20
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9F,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBlG;AAwBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,CAWR;AAED,gFAAgF;AAChF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAMf;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
import { CREDENTIAL_ENV_KEYS } from './serverSpec.js';
|
|
2
|
-
function referencedSpec(spec, reference) {
|
|
3
|
-
if (reference !== 'opencodeEnv')
|
|
4
|
-
return spec;
|
|
5
|
-
const apiKey = spec.env[CREDENTIAL_ENV_KEYS.apiKey];
|
|
6
|
-
if (apiKey !== `\${${CREDENTIAL_ENV_KEYS.apiKey}}`)
|
|
7
|
-
return spec;
|
|
8
|
-
return {
|
|
9
|
-
...spec,
|
|
10
|
-
env: { ...spec.env, [CREDENTIAL_ENV_KEYS.apiKey]: `{env:${CREDENTIAL_ENV_KEYS.apiKey}}` },
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
1
|
/** Serialize the AgentTeams server entry in the shape the target client expects. */
|
|
14
|
-
export function buildEntryValue(shape, spec
|
|
15
|
-
const clientSpec = referencedSpec(spec, reference);
|
|
2
|
+
export function buildEntryValue(shape, spec) {
|
|
16
3
|
if (shape === 'opencode') {
|
|
17
4
|
return {
|
|
18
5
|
type: 'local',
|
|
19
|
-
command: [
|
|
20
|
-
environment: { ...
|
|
6
|
+
command: [spec.command, ...spec.args],
|
|
7
|
+
environment: { ...spec.env },
|
|
21
8
|
enabled: true,
|
|
22
9
|
};
|
|
23
10
|
}
|
|
24
11
|
const entry = {};
|
|
25
12
|
if (shape === 'stdio')
|
|
26
13
|
entry.type = 'stdio';
|
|
27
|
-
entry.command =
|
|
28
|
-
entry.args = [...
|
|
29
|
-
entry.env = { ...
|
|
14
|
+
entry.command = spec.command;
|
|
15
|
+
entry.args = [...spec.args];
|
|
16
|
+
entry.env = { ...spec.env };
|
|
30
17
|
return entry;
|
|
31
18
|
}
|
|
32
19
|
function tomlString(value) {
|
|
@@ -38,11 +25,7 @@ function renderCodexToml(serverName, spec) {
|
|
|
38
25
|
`command = ${tomlString(spec.command)}`,
|
|
39
26
|
`args = [${spec.args.map(tomlString).join(', ')}]`,
|
|
40
27
|
];
|
|
41
|
-
const
|
|
42
|
-
if (apiKey === `\${${CREDENTIAL_ENV_KEYS.apiKey}}`) {
|
|
43
|
-
lines.push(`env_vars = [${tomlString(CREDENTIAL_ENV_KEYS.apiKey)}]`);
|
|
44
|
-
}
|
|
45
|
-
const envEntries = Object.entries(spec.env).filter(([key, value]) => key !== CREDENTIAL_ENV_KEYS.apiKey || value !== `\${${CREDENTIAL_ENV_KEYS.apiKey}}`);
|
|
28
|
+
const envEntries = Object.entries(spec.env);
|
|
46
29
|
if (envEntries.length > 0) {
|
|
47
30
|
lines.push('', `[mcp_servers.${serverName}.env]`);
|
|
48
31
|
for (const [key, value] of envEntries) {
|
|
@@ -62,7 +45,7 @@ export function renderConfigSnippet(client, scope, spec, serverName) {
|
|
|
62
45
|
return renderCodexToml(serverName, spec);
|
|
63
46
|
}
|
|
64
47
|
const containerKey = definition.containerKey;
|
|
65
|
-
const entry = buildEntryValue(definition.entryShape ?? 'plain', spec
|
|
48
|
+
const entry = buildEntryValue(definition.entryShape ?? 'plain', spec);
|
|
66
49
|
const document = containerKey ? { [containerKey]: { [serverName]: entry } } : { [serverName]: entry };
|
|
67
50
|
return JSON.stringify(document, null, 2);
|
|
68
51
|
}
|
|
@@ -75,17 +58,13 @@ export function renderVendorCommandLine(client, scope, spec, serverName) {
|
|
|
75
58
|
return [client.executables[0], ...args].join(' ');
|
|
76
59
|
}
|
|
77
60
|
/**
|
|
78
|
-
* Strip
|
|
79
|
-
*
|
|
80
|
-
*
|
|
61
|
+
* Strip AgentTeams key material from vendor output before it reaches a terminal or a log.
|
|
62
|
+
*
|
|
63
|
+
* Registration itself no longer holds a credential — the server spec embeds nothing — so
|
|
64
|
+
* there is no value to pass in. What remains is that vendor CLIs echo their own argv and
|
|
65
|
+
* environment on failure, and that output can carry a `key_` this process never saw.
|
|
81
66
|
*/
|
|
82
|
-
export function
|
|
83
|
-
|
|
84
|
-
for (const secret of secrets) {
|
|
85
|
-
if (!secret || secret.length < 4)
|
|
86
|
-
continue;
|
|
87
|
-
redacted = redacted.split(secret).join('***');
|
|
88
|
-
}
|
|
89
|
-
return redacted;
|
|
67
|
+
export function redactKeyMaterial(text) {
|
|
68
|
+
return text.replace(/(?<![A-Za-z0-9_-])key_[A-Za-z0-9][A-Za-z0-9_-]{7,}/g, '***');
|
|
90
69
|
}
|
|
91
70
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/mcp-registration/render.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,MAAM,UAAU,eAAe,CAAC,KAAoB,EAAE,IAAmB;IACvE,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;QACzB,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;YACrC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE;YAC5B,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAA4B,EAAE,CAAC;IAC1C,IAAI,KAAK,KAAK,OAAO;QAAE,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;IAC5C,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,CAAC,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC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YAAY,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC;IACtG,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,uBAAuB,CACrC,MAA2B,EAC3B,KAAe,EACf,IAAmB,EACnB,UAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,qDAAqD,EAAE,KAAK,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
import type { McpServerSpec } from './types.js';
|
|
1
|
+
import type { McpPathContext, McpServerSpec } from './types.js';
|
|
2
2
|
/** Server name registered in every client. Kept stable so re-runs update rather than duplicate. */
|
|
3
3
|
export declare const MCP_SERVER_NAME = "agentteams";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/** Published package the `npx` fallback runs. */
|
|
5
|
+
export declare const MCP_RUNTIME_PACKAGE = "@agentteams/cli";
|
|
6
|
+
/** Name of the globally installed executable, when there is one. */
|
|
7
|
+
export declare const MCP_GLOBAL_EXECUTABLE = "agentteams";
|
|
8
|
+
/**
|
|
9
|
+
* Project identity for command context and human-readable output only.
|
|
10
|
+
*
|
|
11
|
+
* There is no credential field on purpose: the generated server spec embeds nothing,
|
|
12
|
+
* and `agentteams mcp` resolves project config plus the OS credential store at request
|
|
13
|
+
* time. Re-adding one here would put a secret back into a client config file.
|
|
14
|
+
*/
|
|
10
15
|
export interface McpCredentials {
|
|
11
|
-
apiKey: string;
|
|
12
16
|
projectId: string;
|
|
13
17
|
teamId: string;
|
|
14
18
|
apiUrl: string;
|
|
15
19
|
}
|
|
16
|
-
/**
|
|
17
|
-
* `literal` writes the real API key into the client's own config file — only
|
|
18
|
-
* ever used for user-scope `install`, where the file lives outside the repo and
|
|
19
|
-
* is chmod 0600. Everything a human can read (`config` output, dry-run plans,
|
|
20
|
-
* project-scope files that get committed) uses `reference`. The renderer then
|
|
21
|
-
* converts that marker to each client's supported inheritance syntax.
|
|
22
|
-
*/
|
|
23
|
-
export type SecretMode = 'literal' | 'reference';
|
|
24
20
|
export interface BuildServerSpecOptions {
|
|
25
|
-
credentials: McpCredentials;
|
|
26
|
-
secretMode: SecretMode;
|
|
27
21
|
/** Absolute path to a local `cli/dist/index.js`; omit to use the published package. */
|
|
28
22
|
serverEntry?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Registration context. When present, the spec is chosen from what this machine can
|
|
25
|
+
* actually spawn; when absent, the global executable is assumed.
|
|
26
|
+
*/
|
|
27
|
+
context?: McpPathContext;
|
|
28
|
+
/** Injection seam so tests drive a fake PATH instead of the developer's machine. */
|
|
29
|
+
fileExists?: (path: string) => boolean;
|
|
29
30
|
}
|
|
31
|
+
/** Is a bare `agentteams` resolvable from this context's PATH? */
|
|
32
|
+
export declare function hasGlobalExecutable(context: McpPathContext, fileExists?: (path: string) => boolean): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* What the client will spawn.
|
|
35
|
+
*
|
|
36
|
+
* A bare `agentteams` is the fast path, but it is only correct when the package is
|
|
37
|
+
* installed globally *and* the client inherits a PATH that contains it — neither holds
|
|
38
|
+
* for `npx @agentteams/cli mcp install` or for a GUI-launched client that never sourced
|
|
39
|
+
* a login shell. Those failures surface as an opaque "server failed to start" inside the
|
|
40
|
+
* client, so when the executable is not resolvable the spec falls back to `npx`, which
|
|
41
|
+
* works in both cases.
|
|
42
|
+
*/
|
|
30
43
|
export declare function buildServerSpec(options: BuildServerSpecOptions): McpServerSpec;
|
|
31
44
|
//# sourceMappingURL=serverSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSpec.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"serverSpec.d.ts","sourceRoot":"","sources":["../../src/mcp-registration/serverSpec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,mGAAmG;AACnG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,oFAAoF;IACpF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAMD,kEAAkE;AAClE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,UAAU,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB,GACjD,OAAO,CAUT;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa,CAc9E"}
|
|
@@ -1,29 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { delimiter, isAbsolute, join, resolve } from 'node:path';
|
|
3
3
|
/** Server name registered in every client. Kept stable so re-runs update rather than duplicate. */
|
|
4
4
|
export const MCP_SERVER_NAME = 'agentteams';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (credentials.apiUrl && credentials.apiUrl !== DEFAULT_API_URL) {
|
|
21
|
-
env[CREDENTIAL_ENV_KEYS.apiUrl] = credentials.apiUrl;
|
|
5
|
+
/** Published package the `npx` fallback runs. */
|
|
6
|
+
export const MCP_RUNTIME_PACKAGE = '@agentteams/cli';
|
|
7
|
+
/** Name of the globally installed executable, when there is one. */
|
|
8
|
+
export const MCP_GLOBAL_EXECUTABLE = 'agentteams';
|
|
9
|
+
function executableSuffixes() {
|
|
10
|
+
return process.platform === 'win32' ? ['', '.cmd', '.exe', '.bat', '.ps1'] : [''];
|
|
11
|
+
}
|
|
12
|
+
/** Is a bare `agentteams` resolvable from this context's PATH? */
|
|
13
|
+
export function hasGlobalExecutable(context, fileExists = existsSync) {
|
|
14
|
+
const pathDirs = (context.env.PATH ?? '').split(delimiter).filter((entry) => entry.length > 0);
|
|
15
|
+
for (const directory of pathDirs) {
|
|
16
|
+
for (const suffix of executableSuffixes()) {
|
|
17
|
+
if (fileExists(join(directory, `${MCP_GLOBAL_EXECUTABLE}${suffix}`)))
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
22
20
|
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What the client will spawn.
|
|
25
|
+
*
|
|
26
|
+
* A bare `agentteams` is the fast path, but it is only correct when the package is
|
|
27
|
+
* installed globally *and* the client inherits a PATH that contains it — neither holds
|
|
28
|
+
* for `npx @agentteams/cli mcp install` or for a GUI-launched client that never sourced
|
|
29
|
+
* a login shell. Those failures surface as an opaque "server failed to start" inside the
|
|
30
|
+
* client, so when the executable is not resolvable the spec falls back to `npx`, which
|
|
31
|
+
* works in both cases.
|
|
32
|
+
*/
|
|
33
|
+
export function buildServerSpec(options) {
|
|
34
|
+
const { serverEntry } = options;
|
|
35
|
+
const env = {};
|
|
23
36
|
if (serverEntry) {
|
|
24
37
|
const entryPath = isAbsolute(serverEntry) ? serverEntry : resolve(serverEntry);
|
|
25
38
|
return { command: 'node', args: [entryPath, 'mcp'], env };
|
|
26
39
|
}
|
|
27
|
-
|
|
40
|
+
if (options.context && !hasGlobalExecutable(options.context, options.fileExists)) {
|
|
41
|
+
return { command: 'npx', args: ['-y', MCP_RUNTIME_PACKAGE, 'mcp'], env };
|
|
42
|
+
}
|
|
43
|
+
return { command: MCP_GLOBAL_EXECUTABLE, args: ['mcp'], env };
|
|
28
44
|
}
|
|
29
45
|
//# sourceMappingURL=serverSpec.js.map
|