@introspection-ai/recipes 0.13.0 → 0.14.1
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 +46 -57
- package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
- package/dist/agents.d.ts.map +1 -0
- package/dist/{agent-tool.js → agents.js} +1 -1
- package/dist/agents.js.map +1 -0
- package/dist/api/extensions.d.ts +3 -0
- package/dist/api/extensions.d.ts.map +1 -0
- package/dist/api/extensions.js +2 -0
- package/dist/api/extensions.js.map +1 -0
- package/dist/api/mcp.d.ts +4 -0
- package/dist/api/mcp.d.ts.map +1 -0
- package/dist/api/mcp.js +2 -0
- package/dist/api/mcp.js.map +1 -0
- package/dist/api/session.d.ts +3 -0
- package/dist/api/session.d.ts.map +1 -0
- package/dist/api/session.js +2 -0
- package/dist/api/session.js.map +1 -0
- package/dist/child-agent.d.ts +5 -4
- package/dist/child-agent.d.ts.map +1 -1
- package/dist/child-agent.js +26 -117
- package/dist/child-agent.js.map +1 -1
- package/dist/child-session.d.ts +23 -0
- package/dist/child-session.d.ts.map +1 -0
- package/dist/child-session.js +48 -0
- package/dist/child-session.js.map +1 -0
- package/dist/extensions.d.ts +29 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +119 -0
- package/dist/extensions.js.map +1 -0
- package/dist/index.d.ts +4 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -13
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +38 -5
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +92 -41
- package/dist/inspect.js.map +1 -1
- package/dist/interactions.d.ts +18 -2
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +41 -10
- package/dist/interactions.js.map +1 -1
- package/dist/mcp-catalog.d.ts +1 -0
- package/dist/mcp-catalog.d.ts.map +1 -1
- package/dist/mcp-catalog.js +14 -6
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
- package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
- package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
- package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
- package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
- package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
- package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
- package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
- package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
- package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
- package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
- package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
- package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
- package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
- package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
- package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
- package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
- package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
- package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
- package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
- package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
- package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
- package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
- package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
- package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
- package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
- package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
- package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
- package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
- package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
- package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
- package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
- package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
- package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
- package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
- package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
- package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
- package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
- package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
- package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
- package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
- package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
- package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
- package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
- package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
- package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
- package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
- package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
- package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
- package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
- package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
- package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
- package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
- package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
- package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
- package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
- package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
- package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
- package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
- package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
- package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
- package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
- package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
- package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
- package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
- package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
- package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
- package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
- package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
- package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
- package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
- package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
- package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
- package/dist/mcp-daemon-client.d.ts +6 -1
- package/dist/mcp-daemon-client.d.ts.map +1 -1
- package/dist/mcp-daemon-client.js +119 -2
- package/dist/mcp-daemon-client.js.map +1 -1
- package/dist/mcp-daemon-protocol.d.ts +18 -1
- package/dist/mcp-daemon-protocol.d.ts.map +1 -1
- package/dist/mcp-daemon-protocol.js +31 -0
- package/dist/mcp-daemon-protocol.js.map +1 -1
- package/dist/mcp-daemon.js +169 -76602
- package/dist/mcp-daemon.js.map +1 -1
- package/dist/mcp-policy.d.ts +11 -0
- package/dist/mcp-policy.d.ts.map +1 -0
- package/dist/mcp-policy.js +27 -0
- package/dist/mcp-policy.js.map +1 -0
- package/dist/mcp-run-worker.js +38 -76540
- package/dist/mcp-tools.d.ts +39 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +493 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/mcp.d.ts +21 -9
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +101 -31
- package/dist/mcp.js.map +1 -1
- package/dist/model-binding.d.ts +39 -0
- package/dist/model-binding.d.ts.map +1 -0
- package/dist/model-binding.js +103 -0
- package/dist/model-binding.js.map +1 -0
- package/dist/pi-extension.d.ts +2 -22
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +296 -71
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/resolve.d.ts +43 -20
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +215 -70
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/recipe-agent.d.ts +24 -27
- package/dist/recipe-agent.d.ts.map +1 -1
- package/dist/recipe-agent.js +278 -230
- package/dist/recipe-agent.js.map +1 -1
- package/dist/recipe-check.d.ts +18 -0
- package/dist/recipe-check.d.ts.map +1 -0
- package/dist/recipe-check.js +261 -0
- package/dist/recipe-check.js.map +1 -0
- package/dist/recipe-extensions.d.ts.map +1 -1
- package/dist/recipe-extensions.js +0 -3
- package/dist/recipe-extensions.js.map +1 -1
- package/dist/recipe-model.d.ts +3 -1
- package/dist/recipe-model.d.ts.map +1 -1
- package/dist/recipe-model.js +15 -12
- package/dist/recipe-model.js.map +1 -1
- package/dist/recipe-package.d.ts +6 -28
- package/dist/recipe-package.d.ts.map +1 -1
- package/dist/recipe-package.js +248 -191
- package/dist/recipe-package.js.map +1 -1
- package/dist/recipe-skills.d.ts.map +1 -1
- package/dist/recipe-skills.js +42 -29
- package/dist/recipe-skills.js.map +1 -1
- package/dist/run-controller.d.ts +10 -9
- package/dist/run-controller.d.ts.map +1 -1
- package/dist/run-controller.js +28 -21
- package/dist/run-controller.js.map +1 -1
- package/dist/session.d.ts +40 -53
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +312 -173
- package/dist/session.js.map +1 -1
- package/dist/test-utils.d.ts +7 -7
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.js +32 -15
- package/dist/test-utils.js.map +1 -1
- package/docs/agent-composition.md +41 -35
- package/docs/host-api.md +201 -0
- package/docs/index.md +9 -14
- package/docs/interactions.md +12 -11
- package/docs/mcp-auth.md +6 -6
- package/docs/mcp-configuration.md +73 -25
- package/docs/pi-extension.md +39 -11
- package/docs/recipe-flow.md +9 -9
- package/docs/recipe-format.md +106 -41
- package/docs/recipe-judges.md +24 -36
- package/package.json +23 -17
- package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
- package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
- package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
- package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
- package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
- package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
- package/vendor/recipe-check/linux-x64/recipe-check +0 -0
- package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
- package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
- package/dist/agent-tool.d.ts.map +0 -1
- package/dist/agent-tool.js.map +0 -1
- package/dist/run.d.ts +0 -28
- package/dist/run.d.ts.map +0 -1
- package/dist/run.js +0 -84
- package/dist/run.js.map +0 -1
- package/dist/testing.d.ts +0 -25
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -96
- package/dist/testing.js.map +0 -1
- package/docs/deployment-configuration.md +0 -65
- package/docs/migration.md +0 -70
- package/docs/python-bindings-release.md +0 -47
- package/docs/recipe-evals.md +0 -70
- package/docs/runtime-library.md +0 -171
|
@@ -0,0 +1,1101 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CliUsageError
|
|
4
|
+
} from "./chunk-BV56DXPW.js";
|
|
5
|
+
import {
|
|
6
|
+
chooseClosestIdentifier,
|
|
7
|
+
renderIdentifierResolutionMessages
|
|
8
|
+
} from "./chunk-BWHIA4PC.js";
|
|
9
|
+
import {
|
|
10
|
+
boldText,
|
|
11
|
+
dimText,
|
|
12
|
+
extraDimText,
|
|
13
|
+
supportsAnsiColor
|
|
14
|
+
} from "./chunk-N46NEFAF.js";
|
|
15
|
+
import {
|
|
16
|
+
clearOAuthCaches
|
|
17
|
+
} from "./chunk-YHQUTU6L.js";
|
|
18
|
+
import "./chunk-TATVT5IT.js";
|
|
19
|
+
import {
|
|
20
|
+
MCPORTER_VERSION
|
|
21
|
+
} from "./chunk-4SQKWYFF.js";
|
|
22
|
+
import {
|
|
23
|
+
loadRawConfig,
|
|
24
|
+
loadServerDefinitions,
|
|
25
|
+
pathsForImport,
|
|
26
|
+
readExternalEntries,
|
|
27
|
+
resolveConfigPath,
|
|
28
|
+
writeRawConfig
|
|
29
|
+
} from "./chunk-2U4BSDC4.js";
|
|
30
|
+
import "./chunk-P3PSC54P.js";
|
|
31
|
+
import {
|
|
32
|
+
withFileLock
|
|
33
|
+
} from "./chunk-2XL7MG7R.js";
|
|
34
|
+
import "./chunk-WQJZMCJN.js";
|
|
35
|
+
import {
|
|
36
|
+
expandHome,
|
|
37
|
+
mcporterConfigCandidates,
|
|
38
|
+
mcporterDir
|
|
39
|
+
} from "./chunk-ECIVB7P4.js";
|
|
40
|
+
import "./chunk-LS7PMWSR.js";
|
|
41
|
+
import "./chunk-D3MRAZ6H.js";
|
|
42
|
+
import "./chunk-LRKZP7DJ.js";
|
|
43
|
+
|
|
44
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/add.js
|
|
45
|
+
import path2 from "node:path";
|
|
46
|
+
|
|
47
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/shared.js
|
|
48
|
+
import fs from "node:fs/promises";
|
|
49
|
+
import path from "node:path";
|
|
50
|
+
var COLOR_ENABLED = () => Boolean(supportsAnsiColor && process.stdout.isTTY);
|
|
51
|
+
function cloneConfig(config) {
|
|
52
|
+
return {
|
|
53
|
+
mcpServers: config.mcpServers ? { ...config.mcpServers } : {},
|
|
54
|
+
imports: config.imports ? [...config.imports] : void 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function loadOrCreateConfig(loadOptions) {
|
|
58
|
+
try {
|
|
59
|
+
const { config, path: configPath } = await loadRawConfig(loadOptions);
|
|
60
|
+
return { config, path: configPath };
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (isErrno(error, "ENOENT")) {
|
|
63
|
+
const rootDir = loadOptions.rootDir ?? process.cwd();
|
|
64
|
+
const resolved = resolveConfigPath(loadOptions.configPath, rootDir);
|
|
65
|
+
return { config: { mcpServers: {} }, path: resolved.path };
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function resolveConfigLocations(loadOptions) {
|
|
71
|
+
const rootDir = loadOptions.rootDir ?? process.cwd();
|
|
72
|
+
const projectPath = path.resolve(rootDir, "config", "mcporter.json");
|
|
73
|
+
const projectExists = await pathExists(projectPath);
|
|
74
|
+
const systemCandidates = buildSystemConfigCandidates();
|
|
75
|
+
const systemResolved = await resolveFirstExisting(systemCandidates);
|
|
76
|
+
return {
|
|
77
|
+
projectPath,
|
|
78
|
+
projectExists,
|
|
79
|
+
systemPath: systemResolved.path,
|
|
80
|
+
systemExists: systemResolved.exists
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function logConfigLocations(summary, options) {
|
|
84
|
+
const shouldAddNewline = options?.leadingNewline ?? true;
|
|
85
|
+
if (shouldAddNewline) {
|
|
86
|
+
console.log("");
|
|
87
|
+
}
|
|
88
|
+
console.log(`Project config: ${formatPath(summary.projectPath, summary.projectExists)}`);
|
|
89
|
+
console.log(`System config: ${formatPath(summary.systemPath, summary.systemExists)}`);
|
|
90
|
+
}
|
|
91
|
+
function findServerNameWithFuzzyMatch(name, candidates, logger = console.log) {
|
|
92
|
+
if (candidates.includes(name)) {
|
|
93
|
+
return name;
|
|
94
|
+
}
|
|
95
|
+
const resolution = chooseClosestIdentifier(name, candidates);
|
|
96
|
+
if (!resolution) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const messages = renderIdentifierResolutionMessages({
|
|
100
|
+
entity: "server",
|
|
101
|
+
attempted: name,
|
|
102
|
+
resolution
|
|
103
|
+
});
|
|
104
|
+
if (messages.auto && logger) {
|
|
105
|
+
logger(dimText(messages.auto));
|
|
106
|
+
}
|
|
107
|
+
if (resolution.kind === "auto") {
|
|
108
|
+
return resolution.value;
|
|
109
|
+
}
|
|
110
|
+
if (messages.suggest && logger) {
|
|
111
|
+
logger(dimText(messages.suggest));
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
function resolveServerDefinition(name, servers, logger = console.log) {
|
|
116
|
+
const direct = servers.find((server) => server.name === name);
|
|
117
|
+
if (direct) {
|
|
118
|
+
return direct;
|
|
119
|
+
}
|
|
120
|
+
const resolution = chooseClosestIdentifier(name, servers.map((server) => server.name));
|
|
121
|
+
if (!resolution) {
|
|
122
|
+
throw new CliUsageError(`[mcporter] Unknown server '${name}'.`);
|
|
123
|
+
}
|
|
124
|
+
const messages = renderIdentifierResolutionMessages({
|
|
125
|
+
entity: "server",
|
|
126
|
+
attempted: name,
|
|
127
|
+
resolution
|
|
128
|
+
});
|
|
129
|
+
if (messages.auto && logger) {
|
|
130
|
+
logger(dimText(messages.auto));
|
|
131
|
+
}
|
|
132
|
+
if (resolution.kind === "auto") {
|
|
133
|
+
const match = servers.find((server) => server.name === resolution.value);
|
|
134
|
+
if (match) {
|
|
135
|
+
return match;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (messages.suggest && logger) {
|
|
139
|
+
logger(dimText(messages.suggest));
|
|
140
|
+
}
|
|
141
|
+
throw new CliUsageError(`[mcporter] Unknown server '${name}'.`);
|
|
142
|
+
}
|
|
143
|
+
function buildSystemConfigCandidates() {
|
|
144
|
+
return mcporterConfigCandidates();
|
|
145
|
+
}
|
|
146
|
+
async function resolveFirstExisting(pathsToCheck) {
|
|
147
|
+
for (const candidate of pathsToCheck) {
|
|
148
|
+
if (await pathExists(candidate)) {
|
|
149
|
+
return { path: candidate, exists: true };
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { path: pathsToCheck[0] ?? "", exists: false };
|
|
153
|
+
}
|
|
154
|
+
async function pathExists(targetPath) {
|
|
155
|
+
try {
|
|
156
|
+
await fs.access(targetPath);
|
|
157
|
+
return true;
|
|
158
|
+
} catch {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function formatPath(targetPath, exists) {
|
|
163
|
+
return exists ? targetPath : `${targetPath} (missing)`;
|
|
164
|
+
}
|
|
165
|
+
function isErrno(error, code) {
|
|
166
|
+
return Boolean(error && typeof error === "object" && error.code === code);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/add.js
|
|
170
|
+
async function handleAddCommand(options, args) {
|
|
171
|
+
const name = args.shift();
|
|
172
|
+
if (!name) {
|
|
173
|
+
throw new CliUsageError("Usage: mcporter config add <name> [target]");
|
|
174
|
+
}
|
|
175
|
+
let positionalTarget;
|
|
176
|
+
if (args[0] && !args[0].startsWith("--")) {
|
|
177
|
+
positionalTarget = args.shift();
|
|
178
|
+
}
|
|
179
|
+
const flags = extractAddFlags(args);
|
|
180
|
+
const targetPath = resolveWriteTarget(flags, options.loadOptions, options.loadOptions.rootDir ?? process.cwd());
|
|
181
|
+
const effectiveLoadOptions = { ...options.loadOptions, configPath: targetPath };
|
|
182
|
+
const baseEntry = await resolveBaseEntry(flags.copyFrom, options.loadOptions);
|
|
183
|
+
const entry = baseEntry ? { ...baseEntry } : {};
|
|
184
|
+
applyTargetToEntry(entry, positionalTarget, flags);
|
|
185
|
+
applyFlagsToEntry(entry, flags);
|
|
186
|
+
validateTransportChoice(entry, flags.transport);
|
|
187
|
+
const hasHttpTarget = Boolean(entry.baseUrl) || Boolean(entry.base_url) || Boolean(entry.url) || Boolean(entry.serverUrl) || Boolean(entry.server_url);
|
|
188
|
+
const hasCommandTarget = Boolean(entry.command ?? entry.executable);
|
|
189
|
+
if (flags.args.length > 0 && !hasCommandTarget) {
|
|
190
|
+
throw new CliUsageError("--arg/--args requires a stdio command (use --command, --stdio, or provide a positional target).");
|
|
191
|
+
}
|
|
192
|
+
if (!hasHttpTarget && !hasCommandTarget) {
|
|
193
|
+
throw new CliUsageError("Server definitions require either a --url/target or a stdio command.");
|
|
194
|
+
}
|
|
195
|
+
if (flags.dryRun) {
|
|
196
|
+
console.log(JSON.stringify({ [name]: entry }, null, 2));
|
|
197
|
+
console.log("(dry-run) No changes were written.");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
let configPath = targetPath;
|
|
201
|
+
await withFileLock(targetPath, async () => {
|
|
202
|
+
const loaded = await loadOrCreateConfig(effectiveLoadOptions);
|
|
203
|
+
configPath = loaded.path;
|
|
204
|
+
const nextConfig = cloneConfig(loaded.config);
|
|
205
|
+
if (!nextConfig.mcpServers) {
|
|
206
|
+
nextConfig.mcpServers = {};
|
|
207
|
+
}
|
|
208
|
+
nextConfig.mcpServers[name] = entry;
|
|
209
|
+
await writeRawConfig(configPath, nextConfig);
|
|
210
|
+
});
|
|
211
|
+
console.log(`Added '${name}' to ${configPath}`);
|
|
212
|
+
}
|
|
213
|
+
function resolveWriteTarget(flags, loadOptions, rootDir) {
|
|
214
|
+
if (flags.persistPath) {
|
|
215
|
+
return path2.resolve(expandHome(flags.persistPath));
|
|
216
|
+
}
|
|
217
|
+
if (flags.scope === "home") {
|
|
218
|
+
return path2.join(mcporterDir("config"), "mcporter.json");
|
|
219
|
+
}
|
|
220
|
+
if (flags.scope === "project") {
|
|
221
|
+
return path2.resolve(rootDir, "config", "mcporter.json");
|
|
222
|
+
}
|
|
223
|
+
if (loadOptions.configPath) {
|
|
224
|
+
return path2.resolve(expandHome(loadOptions.configPath));
|
|
225
|
+
}
|
|
226
|
+
return path2.resolve(rootDir, "config", "mcporter.json");
|
|
227
|
+
}
|
|
228
|
+
function extractAddFlags(args) {
|
|
229
|
+
const flags = { args: [], env: {}, headers: {} };
|
|
230
|
+
let index = 0;
|
|
231
|
+
while (index < args.length) {
|
|
232
|
+
const token = args[index];
|
|
233
|
+
switch (token) {
|
|
234
|
+
case "--transport":
|
|
235
|
+
flags.transport = parseTransport(requireValue(args, index, token));
|
|
236
|
+
args.splice(index, 2);
|
|
237
|
+
continue;
|
|
238
|
+
case "--url":
|
|
239
|
+
flags.url = requireValue(args, index, token);
|
|
240
|
+
args.splice(index, 2);
|
|
241
|
+
continue;
|
|
242
|
+
case "--command":
|
|
243
|
+
flags.command = requireValue(args, index, token);
|
|
244
|
+
args.splice(index, 2);
|
|
245
|
+
continue;
|
|
246
|
+
case "--stdio":
|
|
247
|
+
flags.stdio = requireValue(args, index, token);
|
|
248
|
+
args.splice(index, 2);
|
|
249
|
+
continue;
|
|
250
|
+
case "--arg":
|
|
251
|
+
case "--args":
|
|
252
|
+
flags.args.push(requireValue(args, index, token));
|
|
253
|
+
args.splice(index, 2);
|
|
254
|
+
continue;
|
|
255
|
+
case "--description":
|
|
256
|
+
flags.description = requireValue(args, index, token);
|
|
257
|
+
args.splice(index, 2);
|
|
258
|
+
continue;
|
|
259
|
+
case "--env":
|
|
260
|
+
parseKeyValue(requireValue(args, index, token), flags.env, "--env");
|
|
261
|
+
args.splice(index, 2);
|
|
262
|
+
continue;
|
|
263
|
+
case "--header":
|
|
264
|
+
parseKeyValue(requireValue(args, index, token), flags.headers, "--header");
|
|
265
|
+
args.splice(index, 2);
|
|
266
|
+
continue;
|
|
267
|
+
case "--token-cache-dir":
|
|
268
|
+
flags.tokenCacheDir = requireValue(args, index, token);
|
|
269
|
+
args.splice(index, 2);
|
|
270
|
+
continue;
|
|
271
|
+
case "--client-name":
|
|
272
|
+
flags.clientName = requireValue(args, index, token);
|
|
273
|
+
args.splice(index, 2);
|
|
274
|
+
continue;
|
|
275
|
+
case "--oauth-client-id":
|
|
276
|
+
flags.oauthClientId = requireValue(args, index, token);
|
|
277
|
+
args.splice(index, 2);
|
|
278
|
+
continue;
|
|
279
|
+
case "--oauth-client-secret-env":
|
|
280
|
+
flags.oauthClientSecretEnv = requireValue(args, index, token);
|
|
281
|
+
args.splice(index, 2);
|
|
282
|
+
continue;
|
|
283
|
+
case "--oauth-token-endpoint-auth-method":
|
|
284
|
+
flags.oauthTokenEndpointAuthMethod = requireValue(args, index, token);
|
|
285
|
+
args.splice(index, 2);
|
|
286
|
+
continue;
|
|
287
|
+
case "--oauth-redirect-url":
|
|
288
|
+
flags.oauthRedirectUrl = requireValue(args, index, token);
|
|
289
|
+
args.splice(index, 2);
|
|
290
|
+
continue;
|
|
291
|
+
case "--auth":
|
|
292
|
+
flags.auth = requireValue(args, index, token);
|
|
293
|
+
args.splice(index, 2);
|
|
294
|
+
continue;
|
|
295
|
+
case "--copy-from":
|
|
296
|
+
flags.copyFrom = requireValue(args, index, token);
|
|
297
|
+
args.splice(index, 2);
|
|
298
|
+
continue;
|
|
299
|
+
case "--persist":
|
|
300
|
+
flags.persistPath = requireValue(args, index, token);
|
|
301
|
+
args.splice(index, 2);
|
|
302
|
+
continue;
|
|
303
|
+
case "--scope": {
|
|
304
|
+
const scopeValue = requireValue(args, index, token);
|
|
305
|
+
if (scopeValue !== "home" && scopeValue !== "project") {
|
|
306
|
+
throw new CliUsageError('--scope must be either "home" or "project".');
|
|
307
|
+
}
|
|
308
|
+
flags.scope = scopeValue;
|
|
309
|
+
args.splice(index, 2);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
case "--dry-run":
|
|
313
|
+
flags.dryRun = true;
|
|
314
|
+
args.splice(index, 1);
|
|
315
|
+
continue;
|
|
316
|
+
case "--":
|
|
317
|
+
args.splice(index, 1);
|
|
318
|
+
while (index < args.length) {
|
|
319
|
+
const value = args[index];
|
|
320
|
+
if (value !== void 0) {
|
|
321
|
+
flags.args.push(value);
|
|
322
|
+
}
|
|
323
|
+
args.splice(index, 1);
|
|
324
|
+
}
|
|
325
|
+
continue;
|
|
326
|
+
default:
|
|
327
|
+
index += 1;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return flags;
|
|
332
|
+
}
|
|
333
|
+
function parseTransport(value) {
|
|
334
|
+
if (value !== "http" && value !== "sse" && value !== "stdio") {
|
|
335
|
+
throw new CliUsageError("--transport must be one of 'http', 'sse', or 'stdio'.");
|
|
336
|
+
}
|
|
337
|
+
return value;
|
|
338
|
+
}
|
|
339
|
+
function parseKeyValue(input, target, flagName) {
|
|
340
|
+
if (!input?.includes("=")) {
|
|
341
|
+
throw new CliUsageError(`${flagName} requires KEY=value.`);
|
|
342
|
+
}
|
|
343
|
+
const [key, ...rest] = input.split("=");
|
|
344
|
+
if (!key) {
|
|
345
|
+
throw new CliUsageError(`${flagName} requires KEY=value.`);
|
|
346
|
+
}
|
|
347
|
+
target[key] = rest.join("=");
|
|
348
|
+
}
|
|
349
|
+
function requireValue(args, index, flagName) {
|
|
350
|
+
const value = args[index + 1];
|
|
351
|
+
if (!value) {
|
|
352
|
+
throw new CliUsageError(`Flag '${flagName}' requires a value.`);
|
|
353
|
+
}
|
|
354
|
+
return value;
|
|
355
|
+
}
|
|
356
|
+
async function resolveBaseEntry(copyFrom, options) {
|
|
357
|
+
if (!copyFrom) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
const [kind, ...rest] = copyFrom.split(":");
|
|
361
|
+
const name = rest.join(":");
|
|
362
|
+
if (!kind || !name) {
|
|
363
|
+
throw new CliUsageError("--copy-from requires the format '<import>:<name>'.");
|
|
364
|
+
}
|
|
365
|
+
const rootDir = options.rootDir ?? process.cwd();
|
|
366
|
+
const paths = pathsForImport(kind, rootDir);
|
|
367
|
+
for (const candidate of paths) {
|
|
368
|
+
const resolved = expandHome(candidate);
|
|
369
|
+
const entries = await readExternalEntries(resolved, { projectRoot: rootDir, importKind: kind });
|
|
370
|
+
if (!entries) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
const entry = entries.get(name);
|
|
374
|
+
if (entry) {
|
|
375
|
+
return structuredClone(entry);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
throw new CliUsageError(`Unable to find '${name}' in import '${kind}'.`);
|
|
379
|
+
}
|
|
380
|
+
function applyTargetToEntry(entry, positionalTarget, flags) {
|
|
381
|
+
if (flags.url) {
|
|
382
|
+
entry.baseUrl = flags.url;
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (flags.command) {
|
|
386
|
+
entry.command = flags.command;
|
|
387
|
+
}
|
|
388
|
+
if (flags.stdio) {
|
|
389
|
+
entry.command = flags.stdio;
|
|
390
|
+
}
|
|
391
|
+
if (positionalTarget) {
|
|
392
|
+
if (looksLikeHttp(positionalTarget)) {
|
|
393
|
+
entry.baseUrl = positionalTarget;
|
|
394
|
+
} else {
|
|
395
|
+
entry.command = positionalTarget;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function applyFlagsToEntry(entry, flags) {
|
|
400
|
+
if (flags.args.length > 0) {
|
|
401
|
+
entry.args = flags.args;
|
|
402
|
+
}
|
|
403
|
+
if (flags.description) {
|
|
404
|
+
entry.description = flags.description;
|
|
405
|
+
}
|
|
406
|
+
if (Object.keys(flags.env).length > 0) {
|
|
407
|
+
entry.env = entry.env ? { ...entry.env, ...flags.env } : { ...flags.env };
|
|
408
|
+
}
|
|
409
|
+
if (Object.keys(flags.headers).length > 0) {
|
|
410
|
+
entry.headers = entry.headers ? { ...entry.headers, ...flags.headers } : { ...flags.headers };
|
|
411
|
+
}
|
|
412
|
+
if (flags.tokenCacheDir) {
|
|
413
|
+
entry.tokenCacheDir = flags.tokenCacheDir;
|
|
414
|
+
}
|
|
415
|
+
if (flags.clientName) {
|
|
416
|
+
entry.clientName = flags.clientName;
|
|
417
|
+
}
|
|
418
|
+
if (flags.oauthClientId) {
|
|
419
|
+
entry.oauthClientId = flags.oauthClientId;
|
|
420
|
+
}
|
|
421
|
+
if (flags.oauthClientSecretEnv) {
|
|
422
|
+
entry.oauthClientSecretEnv = flags.oauthClientSecretEnv;
|
|
423
|
+
}
|
|
424
|
+
if (flags.oauthTokenEndpointAuthMethod) {
|
|
425
|
+
entry.oauthTokenEndpointAuthMethod = flags.oauthTokenEndpointAuthMethod;
|
|
426
|
+
}
|
|
427
|
+
if (flags.oauthRedirectUrl) {
|
|
428
|
+
entry.oauthRedirectUrl = flags.oauthRedirectUrl;
|
|
429
|
+
}
|
|
430
|
+
if (flags.auth) {
|
|
431
|
+
entry.auth = flags.auth;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function validateTransportChoice(entry, transport) {
|
|
435
|
+
if (!transport) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const isHttp = Boolean(entry.baseUrl ?? entry.url ?? entry.serverUrl);
|
|
439
|
+
const isStdio = Boolean(entry.command ?? entry.args);
|
|
440
|
+
if (transport === "stdio" && !isStdio) {
|
|
441
|
+
throw new CliUsageError("Transport 'stdio' requires a stdio command.");
|
|
442
|
+
}
|
|
443
|
+
if ((transport === "http" || transport === "sse") && !isHttp) {
|
|
444
|
+
throw new CliUsageError(`Transport '${transport}' requires a URL target.`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function looksLikeHttp(value) {
|
|
448
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/auth.js
|
|
452
|
+
async function handleLoginCommand(options, args) {
|
|
453
|
+
if (args.length === 0) {
|
|
454
|
+
throw new CliUsageError("Usage: mcporter config login <name|url>");
|
|
455
|
+
}
|
|
456
|
+
await options.invokeAuth([...args]);
|
|
457
|
+
}
|
|
458
|
+
async function handleLogoutCommand(options, args) {
|
|
459
|
+
const name = args.shift();
|
|
460
|
+
if (!name) {
|
|
461
|
+
throw new CliUsageError("Usage: mcporter config logout <name>");
|
|
462
|
+
}
|
|
463
|
+
const servers = await loadServerDefinitions(options.loadOptions);
|
|
464
|
+
const target = resolveServerDefinition(name, servers);
|
|
465
|
+
await clearOAuthCaches(target);
|
|
466
|
+
console.log(`Cleared cached credentials for '${target.name}'`);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/doctor.js
|
|
470
|
+
import path3 from "node:path";
|
|
471
|
+
async function handleDoctorCommand(options, _args) {
|
|
472
|
+
console.log(`MCPorter ${MCPORTER_VERSION}`);
|
|
473
|
+
const configLocations = await resolveConfigLocations(options.loadOptions);
|
|
474
|
+
logConfigLocations(configLocations, { leadingNewline: false });
|
|
475
|
+
console.log("");
|
|
476
|
+
const servers = await loadServerDefinitions(options.loadOptions);
|
|
477
|
+
const issues = [];
|
|
478
|
+
for (const server of servers) {
|
|
479
|
+
if (server.command.kind === "stdio" && !path3.isAbsolute(server.command.cwd)) {
|
|
480
|
+
issues.push(`Server '${server.name}' has a non-absolute working directory.`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
if (issues.length === 0) {
|
|
484
|
+
console.log("Config looks good.");
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
console.log("Config issues detected:");
|
|
488
|
+
for (const issue of issues) {
|
|
489
|
+
console.log(` - ${issue}`);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/render.js
|
|
494
|
+
function serializeDefinition(definition) {
|
|
495
|
+
const origin = definition.source ?? { kind: "local", path: "" };
|
|
496
|
+
if (definition.command.kind === "http") {
|
|
497
|
+
return {
|
|
498
|
+
name: definition.name,
|
|
499
|
+
description: definition.description,
|
|
500
|
+
source: origin,
|
|
501
|
+
auth: definition.auth,
|
|
502
|
+
tokenCacheDir: definition.tokenCacheDir,
|
|
503
|
+
clientName: definition.clientName,
|
|
504
|
+
oauthClientId: definition.oauthClientId,
|
|
505
|
+
oauthClientSecretEnv: definition.oauthClientSecretEnv,
|
|
506
|
+
oauthTokenEndpointAuthMethod: definition.oauthTokenEndpointAuthMethod,
|
|
507
|
+
oauthRedirectUrl: definition.oauthRedirectUrl,
|
|
508
|
+
oauthScope: definition.oauthScope,
|
|
509
|
+
refresh: definition.refresh,
|
|
510
|
+
httpFetch: definition.httpFetch,
|
|
511
|
+
allowedTools: definition.allowedTools,
|
|
512
|
+
blockedTools: definition.blockedTools,
|
|
513
|
+
env: definition.env,
|
|
514
|
+
transport: "http",
|
|
515
|
+
baseUrl: definition.command.url.href,
|
|
516
|
+
headers: definition.command.headers
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
return {
|
|
520
|
+
name: definition.name,
|
|
521
|
+
description: definition.description,
|
|
522
|
+
source: origin,
|
|
523
|
+
auth: definition.auth,
|
|
524
|
+
tokenCacheDir: definition.tokenCacheDir,
|
|
525
|
+
clientName: definition.clientName,
|
|
526
|
+
oauthClientId: definition.oauthClientId,
|
|
527
|
+
oauthClientSecretEnv: definition.oauthClientSecretEnv,
|
|
528
|
+
oauthTokenEndpointAuthMethod: definition.oauthTokenEndpointAuthMethod,
|
|
529
|
+
oauthRedirectUrl: definition.oauthRedirectUrl,
|
|
530
|
+
oauthScope: definition.oauthScope,
|
|
531
|
+
refresh: definition.refresh,
|
|
532
|
+
httpFetch: definition.httpFetch,
|
|
533
|
+
allowedTools: definition.allowedTools,
|
|
534
|
+
blockedTools: definition.blockedTools,
|
|
535
|
+
env: definition.env,
|
|
536
|
+
transport: "stdio",
|
|
537
|
+
command: definition.command.command,
|
|
538
|
+
args: definition.command.args,
|
|
539
|
+
cwd: definition.command.cwd
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function printServerSummary(definition) {
|
|
543
|
+
const colorize = COLOR_ENABLED();
|
|
544
|
+
const origin = definition.source;
|
|
545
|
+
const header = colorize ? boldText(definition.name) : definition.name;
|
|
546
|
+
const label = (text) => colorize ? dimText(text) : text;
|
|
547
|
+
console.log(header);
|
|
548
|
+
if (origin) {
|
|
549
|
+
console.log(` ${label("Source")}: ${origin.kind}${origin.path ? ` (${origin.path})` : ""}`);
|
|
550
|
+
} else {
|
|
551
|
+
console.log(` ${label("Source")}: local`);
|
|
552
|
+
}
|
|
553
|
+
if (definition.command.kind === "http") {
|
|
554
|
+
console.log(` ${label("Transport")}: http (${definition.command.url.href})`);
|
|
555
|
+
} else {
|
|
556
|
+
const renderedArgs = definition.command.args.length > 0 ? ` ${definition.command.args.join(" ")}` : "";
|
|
557
|
+
console.log(` ${label("Transport")}: stdio (${definition.command.command}${renderedArgs})`);
|
|
558
|
+
console.log(` ${label("CWD")}: ${definition.command.cwd}`);
|
|
559
|
+
}
|
|
560
|
+
if (definition.description) {
|
|
561
|
+
console.log(` ${label("Description")}: ${definition.description}`);
|
|
562
|
+
}
|
|
563
|
+
if (definition.auth) {
|
|
564
|
+
console.log(` ${label("Auth")}: ${definition.auth}`);
|
|
565
|
+
}
|
|
566
|
+
if (definition.allowedTools !== void 0) {
|
|
567
|
+
const rendered = definition.allowedTools.length > 0 ? definition.allowedTools.join(", ") : "<none>";
|
|
568
|
+
console.log(` ${label("Allowed tools")}: ${rendered}`);
|
|
569
|
+
}
|
|
570
|
+
if (definition.blockedTools !== void 0) {
|
|
571
|
+
const rendered = definition.blockedTools.length > 0 ? definition.blockedTools.join(", ") : "<none>";
|
|
572
|
+
console.log(` ${label("Blocked tools")}: ${rendered}`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
function printImportSummary(importServers) {
|
|
576
|
+
if (importServers.length === 0) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
const colorize = COLOR_ENABLED();
|
|
580
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
581
|
+
for (const server of importServers) {
|
|
582
|
+
const sourcePath = server.source?.path ?? "<unknown>";
|
|
583
|
+
const list = grouped.get(sourcePath) ?? [];
|
|
584
|
+
list.push(server.name);
|
|
585
|
+
grouped.set(sourcePath, list);
|
|
586
|
+
}
|
|
587
|
+
console.log("");
|
|
588
|
+
const header = colorize ? boldText("Other sources available via --source import") : "Other sources available via --source import";
|
|
589
|
+
console.log(header);
|
|
590
|
+
for (const [path5, names] of grouped) {
|
|
591
|
+
names.sort();
|
|
592
|
+
const sample = names.slice(0, 3).join(", ");
|
|
593
|
+
const suffix = names.length > 3 ? ", \u2026" : "";
|
|
594
|
+
const countLabel = `${names.length} server${names.length === 1 ? "" : "s"}`;
|
|
595
|
+
const pathLabel = colorize ? dimText(path5) : path5;
|
|
596
|
+
console.log(` ${pathLabel} \u2014 ${countLabel} (${sample}${suffix})`);
|
|
597
|
+
}
|
|
598
|
+
const guidance = "Use `mcporter config import <kind>` to copy them locally.";
|
|
599
|
+
console.log(colorize ? dimText(guidance) : guidance);
|
|
600
|
+
}
|
|
601
|
+
function printConfigUsageExamples() {
|
|
602
|
+
return [
|
|
603
|
+
"pnpm mcporter config list --json",
|
|
604
|
+
"pnpm mcporter config add linear https://mcp.linear.app/mcp",
|
|
605
|
+
"pnpm mcporter config import cursor --copy"
|
|
606
|
+
];
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/get.js
|
|
610
|
+
async function handleGetCommand(options, args) {
|
|
611
|
+
const flags = extractGetFlags(args);
|
|
612
|
+
const name = args.shift();
|
|
613
|
+
if (!name) {
|
|
614
|
+
throw new CliUsageError("Usage: mcporter config get <name>");
|
|
615
|
+
}
|
|
616
|
+
const servers = await loadServerDefinitions(options.loadOptions);
|
|
617
|
+
const target = resolveServerDefinition(name, servers);
|
|
618
|
+
if (flags.format === "json") {
|
|
619
|
+
console.log(JSON.stringify(serializeDefinition(target), null, 2));
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
printServerSummary(target);
|
|
623
|
+
if (target.command.kind === "http" && target.command.headers && Object.keys(target.command.headers).length > 0) {
|
|
624
|
+
console.log(" Headers:");
|
|
625
|
+
for (const [key, value] of Object.entries(target.command.headers)) {
|
|
626
|
+
console.log(` ${key}: ${value}`);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
if (target.env && Object.keys(target.env).length > 0) {
|
|
630
|
+
console.log(" Env:");
|
|
631
|
+
for (const [key, value] of Object.entries(target.env)) {
|
|
632
|
+
console.log(` ${key}=${value}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function extractGetFlags(args) {
|
|
637
|
+
let format = "text";
|
|
638
|
+
let index = 0;
|
|
639
|
+
while (index < args.length) {
|
|
640
|
+
const token = args[index];
|
|
641
|
+
if (token === "--json") {
|
|
642
|
+
format = "json";
|
|
643
|
+
args.splice(index, 1);
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
index += 1;
|
|
647
|
+
}
|
|
648
|
+
return { format };
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/help.js
|
|
652
|
+
var CONFIG_HELP_ENTRIES = {
|
|
653
|
+
list: {
|
|
654
|
+
name: "list [options] [filter]",
|
|
655
|
+
summary: "Show merged servers",
|
|
656
|
+
usage: "mcporter config list [options] [filter]",
|
|
657
|
+
description: "Lists configured servers. Defaults to local entries, but you can view imports and emit JSON.",
|
|
658
|
+
flags: [
|
|
659
|
+
{ flag: "--json", description: "Print JSON payloads instead of ANSI text." },
|
|
660
|
+
{ flag: "--source <local|import>", description: "Filter to local definitions or imported entries only." },
|
|
661
|
+
{ flag: "filter (positional)", description: "Substring match applied to server names." }
|
|
662
|
+
],
|
|
663
|
+
examples: ["pnpm mcporter config list", "pnpm mcporter config list --json --source import cursor"]
|
|
664
|
+
},
|
|
665
|
+
get: {
|
|
666
|
+
name: "get <name> [--json]",
|
|
667
|
+
summary: "Inspect a single server",
|
|
668
|
+
usage: "mcporter config get <name> [--json]",
|
|
669
|
+
description: "Shows one server definition, including transport, headers, and env overrides.",
|
|
670
|
+
flags: [{ flag: "--json", description: "Emit the server entry as JSON." }],
|
|
671
|
+
examples: ["pnpm mcporter config get linear", "pnpm mcporter config get claude --json"]
|
|
672
|
+
},
|
|
673
|
+
add: {
|
|
674
|
+
name: "add [options] <name> [target]",
|
|
675
|
+
summary: "Persist a server definition",
|
|
676
|
+
usage: "mcporter config add [options] <name> [target]",
|
|
677
|
+
description: "Adds HTTP or stdio servers to the local config. Accepts URLs, commands, env vars, and OAuth metadata.",
|
|
678
|
+
flags: [
|
|
679
|
+
{ flag: "--url <https://host>", description: "Set the HTTP/S base URL (implies http transport)." },
|
|
680
|
+
{ flag: "--command <binary>", description: "Set the stdio executable (implies stdio transport)." },
|
|
681
|
+
{ flag: "--stdio <binary>", description: "Alias for --command." },
|
|
682
|
+
{ flag: "--transport <http|sse|stdio>", description: "Force a specific transport (validates target)." },
|
|
683
|
+
{ flag: "--arg <value>", description: "Pass through additional stdio arguments (repeatable)." },
|
|
684
|
+
{ flag: "--description <text>", description: "Set a human-friendly summary." },
|
|
685
|
+
{ flag: "--env KEY=value", description: "Attach environment variables (repeatable)." },
|
|
686
|
+
{ flag: "--header KEY=value", description: "Attach HTTP headers (repeatable)." },
|
|
687
|
+
{ flag: "--token-cache-dir <path>", description: "Override where OAuth tokens are persisted." },
|
|
688
|
+
{ flag: "--client-name <name>", description: "Customize the OAuth client identifier." },
|
|
689
|
+
{ flag: "--oauth-client-id <id>", description: "Use a pre-registered OAuth client id." },
|
|
690
|
+
{ flag: "--oauth-client-secret-env <env>", description: "Read the OAuth client secret from an env var." },
|
|
691
|
+
{
|
|
692
|
+
flag: "--oauth-token-endpoint-auth-method <method>",
|
|
693
|
+
description: "Set token auth, e.g. client_secret_post."
|
|
694
|
+
},
|
|
695
|
+
{ flag: "--oauth-redirect-url <url>", description: "Set a custom OAuth redirect URL." },
|
|
696
|
+
{ flag: "--auth <strategy>", description: "Force the auth type (e.g., oauth)." },
|
|
697
|
+
{ flag: "--copy-from <import:name>", description: "Start with an imported definition by name." },
|
|
698
|
+
{ flag: "--persist <config-path>", description: "Write to an alternate mcporter.json path." },
|
|
699
|
+
{
|
|
700
|
+
flag: "--scope <home|project>",
|
|
701
|
+
description: "Choose whether to write to the home or project config (default: project)."
|
|
702
|
+
},
|
|
703
|
+
{ flag: "--dry-run", description: "Print the would-be entry without writing to disk." },
|
|
704
|
+
{ flag: "--", description: "Forward every subsequent token as a stdio arg." }
|
|
705
|
+
],
|
|
706
|
+
examples: [
|
|
707
|
+
"pnpm mcporter config add linear https://mcp.linear.app/mcp",
|
|
708
|
+
'pnpm mcporter config add cursor --command "npx -y cursor" --arg --stdio'
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
remove: {
|
|
712
|
+
name: "remove <name>",
|
|
713
|
+
summary: "Delete a local entry",
|
|
714
|
+
usage: "mcporter config remove <name>",
|
|
715
|
+
description: "Removes a server definition from the active mcporter.json file.",
|
|
716
|
+
examples: ["pnpm mcporter config remove linear"]
|
|
717
|
+
},
|
|
718
|
+
import: {
|
|
719
|
+
name: "import <kind> [options]",
|
|
720
|
+
summary: "Inspect or copy imported servers",
|
|
721
|
+
usage: "mcporter config import <kind> [options]",
|
|
722
|
+
description: "Shows entries from Cursor, Claude, Codex, and other supported imports. Optionally copies them locally.",
|
|
723
|
+
flags: [
|
|
724
|
+
{ flag: "--path <file>", description: "Manually point at a config file path." },
|
|
725
|
+
{ flag: "--filter <substring>", description: "Match server names by substring before listing/copying." },
|
|
726
|
+
{ flag: "--copy", description: "Write the filtered entries into the local config." },
|
|
727
|
+
{ flag: "--json", description: "Emit JSON instead of plain text listings." }
|
|
728
|
+
],
|
|
729
|
+
examples: ["pnpm mcporter config import cursor --copy", "pnpm mcporter config import claude --filter notion"]
|
|
730
|
+
},
|
|
731
|
+
login: {
|
|
732
|
+
name: "login <name|url> [options]",
|
|
733
|
+
summary: "Run the OAuth/auth flow",
|
|
734
|
+
usage: "mcporter config login <name|url> [options]",
|
|
735
|
+
description: "Delegates to `mcporter auth`, so you can pass ephemeral flags like --http-url/--stdio/--reset and browser-suppression flags for headless OAuth.",
|
|
736
|
+
flags: [
|
|
737
|
+
{ flag: "--no-browser", description: "Print the OAuth authorization URL without launching a browser." },
|
|
738
|
+
{ flag: "--browser none", description: "Alias for --no-browser." },
|
|
739
|
+
{
|
|
740
|
+
flag: "MCPORTER_OAUTH_NO_BROWSER=1|true|yes",
|
|
741
|
+
description: "Environment default for browser-suppressed OAuth."
|
|
742
|
+
}
|
|
743
|
+
],
|
|
744
|
+
examples: [
|
|
745
|
+
"pnpm mcporter config login linear",
|
|
746
|
+
"pnpm mcporter config login linear --no-browser",
|
|
747
|
+
"pnpm mcporter config login https://example.com/mcp --reset"
|
|
748
|
+
]
|
|
749
|
+
},
|
|
750
|
+
logout: {
|
|
751
|
+
name: "logout <name>",
|
|
752
|
+
summary: "Clear cached credentials",
|
|
753
|
+
usage: "mcporter config logout <name>",
|
|
754
|
+
description: "Deletes the token cache directory for an OAuth-enabled server.",
|
|
755
|
+
examples: ["pnpm mcporter config logout linear"]
|
|
756
|
+
},
|
|
757
|
+
doctor: {
|
|
758
|
+
name: "doctor",
|
|
759
|
+
summary: "Validate config files",
|
|
760
|
+
usage: "mcporter config doctor",
|
|
761
|
+
description: "Validates config files, warns about missing token caches, and prints config locations.",
|
|
762
|
+
examples: ["pnpm mcporter config doctor"]
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
var CONFIG_HELP_ORDER = [
|
|
766
|
+
"list",
|
|
767
|
+
"get",
|
|
768
|
+
"add",
|
|
769
|
+
"remove",
|
|
770
|
+
"import",
|
|
771
|
+
"login",
|
|
772
|
+
"logout",
|
|
773
|
+
"doctor"
|
|
774
|
+
];
|
|
775
|
+
function isHelpToken(token) {
|
|
776
|
+
return token === "--help" || token === "-h";
|
|
777
|
+
}
|
|
778
|
+
function consumeInlineHelpTokens(args) {
|
|
779
|
+
let found = false;
|
|
780
|
+
for (let index = args.length - 1; index >= 0; index -= 1) {
|
|
781
|
+
const token = args[index];
|
|
782
|
+
if (token && isHelpToken(token)) {
|
|
783
|
+
args.splice(index, 1);
|
|
784
|
+
found = true;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
return found;
|
|
788
|
+
}
|
|
789
|
+
function printConfigHelp(subcommand) {
|
|
790
|
+
const colorize = COLOR_ENABLED();
|
|
791
|
+
if (!subcommand) {
|
|
792
|
+
printConfigOverview(colorize);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
const resolved = resolveHelpSubcommand(subcommand);
|
|
796
|
+
if (!resolved) {
|
|
797
|
+
console.log(`Unknown config subcommand '${subcommand}'. Available commands: ${CONFIG_HELP_ORDER.join(", ")}.`);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
printSubcommandHelp(resolved, colorize);
|
|
801
|
+
}
|
|
802
|
+
function resolveHelpSubcommand(token) {
|
|
803
|
+
if (!token) {
|
|
804
|
+
return void 0;
|
|
805
|
+
}
|
|
806
|
+
const normalized = token.toLowerCase();
|
|
807
|
+
return normalized in CONFIG_HELP_ENTRIES ? normalized : void 0;
|
|
808
|
+
}
|
|
809
|
+
function printConfigOverview(colorize) {
|
|
810
|
+
const title = colorize ? boldText("mcporter config") : "mcporter config";
|
|
811
|
+
const subtitle = colorize ? dimText("Manage configured MCP servers, imports, and ad-hoc discoveries.") : "Manage configured MCP servers, imports, and ad-hoc discoveries.";
|
|
812
|
+
const commandsHeader = colorize ? boldText("Commands") : "Commands";
|
|
813
|
+
const examplesHeader = colorize ? boldText("Examples") : "Examples";
|
|
814
|
+
const lines = [title, subtitle, "", commandsHeader];
|
|
815
|
+
const maxName = Math.max(...CONFIG_HELP_ORDER.map((key) => CONFIG_HELP_ENTRIES[key].name.length));
|
|
816
|
+
for (const key of CONFIG_HELP_ORDER) {
|
|
817
|
+
const entry = CONFIG_HELP_ENTRIES[key];
|
|
818
|
+
const padded = entry.name.padEnd(maxName);
|
|
819
|
+
const renderedName = colorize ? boldText(padded) : padded;
|
|
820
|
+
const renderedDesc = colorize ? dimText(entry.summary) : entry.summary;
|
|
821
|
+
lines.push(` ${renderedName} ${renderedDesc}`);
|
|
822
|
+
}
|
|
823
|
+
lines.push("", examplesHeader);
|
|
824
|
+
for (const example of printConfigUsageExamples()) {
|
|
825
|
+
lines.push(` ${colorize ? extraDimText(example) : example}`);
|
|
826
|
+
}
|
|
827
|
+
const pointer = "Run 'mcporter config <command> --help' for detailed flag info.";
|
|
828
|
+
lines.push("", colorize ? extraDimText(pointer) : pointer);
|
|
829
|
+
console.log(lines.join("\n"));
|
|
830
|
+
}
|
|
831
|
+
function printSubcommandHelp(subcommand, colorize) {
|
|
832
|
+
const entry = CONFIG_HELP_ENTRIES[subcommand];
|
|
833
|
+
const title = colorize ? boldText(`mcporter config ${subcommand}`) : `mcporter config ${subcommand}`;
|
|
834
|
+
const description = colorize ? dimText(entry.description) : entry.description;
|
|
835
|
+
const usageHeader = colorize ? boldText("Usage") : "Usage";
|
|
836
|
+
const lines = [title, description, "", usageHeader, ` ${entry.usage}`];
|
|
837
|
+
if (entry.flags && entry.flags.length > 0) {
|
|
838
|
+
const flagsHeader = colorize ? boldText("Flags") : "Flags";
|
|
839
|
+
const maxFlag = Math.max(...entry.flags.map((flag) => flag.flag.length));
|
|
840
|
+
lines.push("", flagsHeader);
|
|
841
|
+
for (const flag of entry.flags) {
|
|
842
|
+
const padded = flag.flag.padEnd(maxFlag);
|
|
843
|
+
const renderedFlag = colorize ? boldText(padded) : padded;
|
|
844
|
+
const renderedDesc = colorize ? dimText(flag.description) : flag.description;
|
|
845
|
+
lines.push(` ${renderedFlag} ${renderedDesc}`);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
if (entry.examples && entry.examples.length > 0) {
|
|
849
|
+
const examplesHeader = colorize ? boldText("Examples") : "Examples";
|
|
850
|
+
lines.push("", examplesHeader);
|
|
851
|
+
for (const example of entry.examples) {
|
|
852
|
+
lines.push(` ${colorize ? extraDimText(example) : example}`);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
console.log(lines.join("\n"));
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/import.js
|
|
859
|
+
import path4 from "node:path";
|
|
860
|
+
async function handleImportCommand(options, args) {
|
|
861
|
+
const kind = args.shift();
|
|
862
|
+
if (!kind) {
|
|
863
|
+
throw new CliUsageError("Usage: mcporter config import <kind>");
|
|
864
|
+
}
|
|
865
|
+
const flags = extractImportFlags(args);
|
|
866
|
+
const rootDir = options.loadOptions.rootDir ?? process.cwd();
|
|
867
|
+
const paths = flags.path ? [path4.resolve(expandHome(flags.path))] : pathsForImport(kind, rootDir);
|
|
868
|
+
const entries = [];
|
|
869
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
870
|
+
for (const candidate of paths) {
|
|
871
|
+
const resolved = expandHome(candidate);
|
|
872
|
+
const map = await readExternalEntries(resolved, { projectRoot: rootDir, importKind: kind });
|
|
873
|
+
if (!map) {
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
for (const [name, entry] of map) {
|
|
877
|
+
if (flags.filter && !name.includes(flags.filter)) {
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
if (seenNames.has(name)) {
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
seenNames.add(name);
|
|
884
|
+
entries.push({ name, entry, source: resolved });
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
if (entries.length === 0) {
|
|
888
|
+
console.log("No entries found.");
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
if (flags.format === "json") {
|
|
892
|
+
console.log(JSON.stringify({ entries }, null, 2));
|
|
893
|
+
} else {
|
|
894
|
+
for (const item of entries) {
|
|
895
|
+
console.log(`${item.name} (${item.source})`);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
if (flags.copy) {
|
|
899
|
+
const lockPath = resolveImportCopyTarget(options.loadOptions.configPath, rootDir);
|
|
900
|
+
let configPath = lockPath;
|
|
901
|
+
await withFileLock(lockPath, async () => {
|
|
902
|
+
const loaded = await loadOrCreateConfig({ ...options.loadOptions, configPath: lockPath });
|
|
903
|
+
configPath = loaded.path;
|
|
904
|
+
const nextConfig = cloneConfig(loaded.config);
|
|
905
|
+
if (!nextConfig.mcpServers) {
|
|
906
|
+
nextConfig.mcpServers = {};
|
|
907
|
+
}
|
|
908
|
+
for (const item of entries) {
|
|
909
|
+
nextConfig.mcpServers[item.name] = structuredClone(item.entry);
|
|
910
|
+
}
|
|
911
|
+
await writeRawConfig(configPath, nextConfig);
|
|
912
|
+
});
|
|
913
|
+
console.log(`Copied ${entries.length} entr${entries.length === 1 ? "y" : "ies"} to ${configPath}`);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
function resolveImportCopyTarget(configPath, rootDir) {
|
|
917
|
+
if (configPath || process.env.MCPORTER_CONFIG) {
|
|
918
|
+
return resolveConfigPath(configPath, rootDir).path;
|
|
919
|
+
}
|
|
920
|
+
return path4.resolve(rootDir, "config", "mcporter.json");
|
|
921
|
+
}
|
|
922
|
+
function extractImportFlags(args) {
|
|
923
|
+
const flags = { format: "text" };
|
|
924
|
+
let index = 0;
|
|
925
|
+
while (index < args.length) {
|
|
926
|
+
const token = args[index];
|
|
927
|
+
switch (token) {
|
|
928
|
+
case "--path":
|
|
929
|
+
flags.path = args[index + 1];
|
|
930
|
+
args.splice(index, 2);
|
|
931
|
+
continue;
|
|
932
|
+
case "--filter":
|
|
933
|
+
flags.filter = args[index + 1];
|
|
934
|
+
args.splice(index, 2);
|
|
935
|
+
continue;
|
|
936
|
+
case "--copy":
|
|
937
|
+
flags.copy = true;
|
|
938
|
+
args.splice(index, 1);
|
|
939
|
+
continue;
|
|
940
|
+
case "--json":
|
|
941
|
+
flags.format = "json";
|
|
942
|
+
args.splice(index, 1);
|
|
943
|
+
continue;
|
|
944
|
+
default:
|
|
945
|
+
index += 1;
|
|
946
|
+
break;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return flags;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/list.js
|
|
953
|
+
async function handleListCommand(options, args) {
|
|
954
|
+
const flags = extractListFlags(args);
|
|
955
|
+
const filter = args.shift();
|
|
956
|
+
const servers = await loadServerDefinitions(options.loadOptions);
|
|
957
|
+
let filtered = servers;
|
|
958
|
+
if (flags.source) {
|
|
959
|
+
filtered = filtered.filter((server) => (server.source?.kind ?? "local") === flags.source);
|
|
960
|
+
}
|
|
961
|
+
if (filter) {
|
|
962
|
+
filtered = filtered.filter((server) => filterMatches(filter, server));
|
|
963
|
+
}
|
|
964
|
+
if (flags.format === "json") {
|
|
965
|
+
const payload = filtered.map((server) => serializeDefinition(server));
|
|
966
|
+
console.log(JSON.stringify({ servers: payload }, null, 2));
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const colorize = COLOR_ENABLED();
|
|
970
|
+
if (filtered.length === 0) {
|
|
971
|
+
console.log(colorize ? dimText("No local servers match the provided filters.") : "No local servers match the provided filters.");
|
|
972
|
+
} else {
|
|
973
|
+
for (const server of filtered) {
|
|
974
|
+
printServerSummary(server);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
if ((!flags.source || flags.source === "local") && flags.format === "text") {
|
|
978
|
+
printImportSummary(servers.filter((server) => server.source?.kind === "import"));
|
|
979
|
+
}
|
|
980
|
+
if (flags.format === "text") {
|
|
981
|
+
const summary = await resolveConfigLocations(options.loadOptions);
|
|
982
|
+
logConfigLocations(summary, { leadingNewline: true });
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function extractListFlags(args) {
|
|
986
|
+
const flags = { format: "text", source: "local" };
|
|
987
|
+
let index = 0;
|
|
988
|
+
while (index < args.length) {
|
|
989
|
+
const token = args[index];
|
|
990
|
+
if (token === "--json") {
|
|
991
|
+
flags.format = "json";
|
|
992
|
+
args.splice(index, 1);
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
if (token === "--source") {
|
|
996
|
+
const value = args[index + 1];
|
|
997
|
+
if (value !== "local" && value !== "import") {
|
|
998
|
+
throw new CliUsageError("--source must be either 'local' or 'import'.");
|
|
999
|
+
}
|
|
1000
|
+
flags.source = value;
|
|
1001
|
+
args.splice(index, 2);
|
|
1002
|
+
continue;
|
|
1003
|
+
}
|
|
1004
|
+
index += 1;
|
|
1005
|
+
}
|
|
1006
|
+
return flags;
|
|
1007
|
+
}
|
|
1008
|
+
function filterMatches(filter, server) {
|
|
1009
|
+
if (filter.startsWith("source:")) {
|
|
1010
|
+
const origin = server.source?.kind ?? "local";
|
|
1011
|
+
return `source:${origin}` === filter;
|
|
1012
|
+
}
|
|
1013
|
+
return server.name.includes(filter);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config/remove.js
|
|
1017
|
+
async function handleRemoveCommand(options, args) {
|
|
1018
|
+
const name = args.shift();
|
|
1019
|
+
if (!name) {
|
|
1020
|
+
throw new CliUsageError("Usage: mcporter config remove <name>");
|
|
1021
|
+
}
|
|
1022
|
+
const rootDir = options.loadOptions.rootDir ?? process.cwd();
|
|
1023
|
+
const lockPath = resolveConfigPath(options.loadOptions.configPath, rootDir).path;
|
|
1024
|
+
let configPath = lockPath;
|
|
1025
|
+
let targetName = name;
|
|
1026
|
+
await withFileLock(lockPath, async () => {
|
|
1027
|
+
const loaded = await loadOrCreateConfig({ ...options.loadOptions, configPath: lockPath });
|
|
1028
|
+
configPath = loaded.path;
|
|
1029
|
+
const matched = findServerNameWithFuzzyMatch(name, Object.keys(loaded.config.mcpServers ?? {}));
|
|
1030
|
+
if (!matched) {
|
|
1031
|
+
throw new CliUsageError(`Server '${name}' does not exist in ${configPath}.`);
|
|
1032
|
+
}
|
|
1033
|
+
targetName = matched;
|
|
1034
|
+
const nextConfig = cloneConfig(loaded.config);
|
|
1035
|
+
delete nextConfig.mcpServers[targetName];
|
|
1036
|
+
await writeRawConfig(configPath, nextConfig);
|
|
1037
|
+
});
|
|
1038
|
+
console.log(`Removed '${targetName}' from ${configPath}`);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/config-command.js
|
|
1042
|
+
async function handleConfigCli(options, args) {
|
|
1043
|
+
const initialToken = args[0];
|
|
1044
|
+
if (args.length === 0 || initialToken && isHelpToken(initialToken)) {
|
|
1045
|
+
printConfigHelp();
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
const subcommand = args.shift();
|
|
1049
|
+
if (!subcommand) {
|
|
1050
|
+
printConfigHelp();
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
if (subcommand === "help") {
|
|
1054
|
+
const target = args[0];
|
|
1055
|
+
if (!target || isHelpToken(target)) {
|
|
1056
|
+
printConfigHelp();
|
|
1057
|
+
} else {
|
|
1058
|
+
printConfigHelp(target);
|
|
1059
|
+
}
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
if (consumeInlineHelpTokens(args)) {
|
|
1063
|
+
printConfigHelp(subcommand);
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
switch (subcommand) {
|
|
1067
|
+
case "list":
|
|
1068
|
+
await handleListCommand(options, args);
|
|
1069
|
+
return;
|
|
1070
|
+
case "get":
|
|
1071
|
+
await handleGetCommand(options, args);
|
|
1072
|
+
return;
|
|
1073
|
+
case "add":
|
|
1074
|
+
await handleAddCommand(options, args);
|
|
1075
|
+
return;
|
|
1076
|
+
case "remove":
|
|
1077
|
+
await handleRemoveCommand(options, args);
|
|
1078
|
+
return;
|
|
1079
|
+
case "import":
|
|
1080
|
+
await handleImportCommand(options, args);
|
|
1081
|
+
return;
|
|
1082
|
+
case "login":
|
|
1083
|
+
await handleLoginCommand(options, args);
|
|
1084
|
+
return;
|
|
1085
|
+
case "logout":
|
|
1086
|
+
await handleLogoutCommand(options, args);
|
|
1087
|
+
return;
|
|
1088
|
+
case "doctor":
|
|
1089
|
+
await handleDoctorCommand(options, args);
|
|
1090
|
+
return;
|
|
1091
|
+
default:
|
|
1092
|
+
throw new CliUsageError(`Unknown config subcommand '${subcommand}'. Run 'mcporter config --help'.`);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
var __configCommandInternals = {
|
|
1096
|
+
resolveWriteTarget
|
|
1097
|
+
};
|
|
1098
|
+
export {
|
|
1099
|
+
__configCommandInternals,
|
|
1100
|
+
handleConfigCli
|
|
1101
|
+
};
|