@mcpc-tech/cli 0.1.51 → 0.1.52
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/app.cjs +170 -23
- package/app.mjs +170 -23
- package/bin/mcpc.cjs +188 -41
- package/bin/mcpc.mjs +186 -39
- package/bin.cjs +188 -41
- package/bin.mjs +186 -39
- package/index.cjs +190 -43
- package/index.mjs +188 -41
- package/package.json +1 -1
- package/server.cjs +190 -43
- package/server.mjs +188 -41
package/app.cjs
CHANGED
|
@@ -506,7 +506,7 @@ var require_cross_spawn = __commonJS({
|
|
|
506
506
|
var cp = require("child_process");
|
|
507
507
|
var parse2 = require_parse();
|
|
508
508
|
var enoent = require_enoent();
|
|
509
|
-
function
|
|
509
|
+
function spawn3(command, args, options) {
|
|
510
510
|
const parsed = parse2(command, args, options);
|
|
511
511
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
512
512
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -518,8 +518,8 @@ var require_cross_spawn = __commonJS({
|
|
|
518
518
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
519
519
|
return result;
|
|
520
520
|
}
|
|
521
|
-
module2.exports =
|
|
522
|
-
module2.exports.spawn =
|
|
521
|
+
module2.exports = spawn3;
|
|
522
|
+
module2.exports.spawn = spawn3;
|
|
523
523
|
module2.exports.sync = spawnSync;
|
|
524
524
|
module2.exports._parse = parse2;
|
|
525
525
|
module2.exports._enoent = enoent;
|
|
@@ -11052,6 +11052,152 @@ Skill path: ${meta.basePath}
|
|
|
11052
11052
|
};
|
|
11053
11053
|
}
|
|
11054
11054
|
|
|
11055
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
11056
|
+
var import_node_child_process = require("node:child_process");
|
|
11057
|
+
var import_node_process7 = __toESM(require("node:process"), 1);
|
|
11058
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
11059
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
11060
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
11061
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
11062
|
+
const fullOutput = (stderr ? `STDERR:
|
|
11063
|
+
${stderr}
|
|
11064
|
+
|
|
11065
|
+
STDOUT:
|
|
11066
|
+
` : "") + stdout;
|
|
11067
|
+
const lines = fullOutput.split("\n");
|
|
11068
|
+
if (lines.length > maxLines) {
|
|
11069
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
11070
|
+
return {
|
|
11071
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
11072
|
+
|
|
11073
|
+
` + truncatedLines.join("\n"),
|
|
11074
|
+
truncated: true
|
|
11075
|
+
};
|
|
11076
|
+
}
|
|
11077
|
+
if (fullOutput.length > maxBytes) {
|
|
11078
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
11079
|
+
return {
|
|
11080
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
11081
|
+
|
|
11082
|
+
` + truncatedBytes,
|
|
11083
|
+
truncated: true
|
|
11084
|
+
};
|
|
11085
|
+
}
|
|
11086
|
+
return {
|
|
11087
|
+
output: fullOutput,
|
|
11088
|
+
truncated: false
|
|
11089
|
+
};
|
|
11090
|
+
}
|
|
11091
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
11092
|
+
return new Promise((resolve5) => {
|
|
11093
|
+
const stdout = [];
|
|
11094
|
+
const stderr = [];
|
|
11095
|
+
const proc = (0, import_node_child_process.spawn)("bash", [
|
|
11096
|
+
"-c",
|
|
11097
|
+
command
|
|
11098
|
+
], {
|
|
11099
|
+
cwd: cwd2,
|
|
11100
|
+
stdio: [
|
|
11101
|
+
"ignore",
|
|
11102
|
+
"pipe",
|
|
11103
|
+
"pipe"
|
|
11104
|
+
]
|
|
11105
|
+
});
|
|
11106
|
+
proc.stdout?.on("data", (data) => {
|
|
11107
|
+
stdout.push(data.toString());
|
|
11108
|
+
});
|
|
11109
|
+
proc.stderr?.on("data", (data) => {
|
|
11110
|
+
stderr.push(data.toString());
|
|
11111
|
+
});
|
|
11112
|
+
proc.on("close", (code) => {
|
|
11113
|
+
resolve5({
|
|
11114
|
+
stdout: stdout.join(""),
|
|
11115
|
+
stderr: stderr.join(""),
|
|
11116
|
+
exitCode: code
|
|
11117
|
+
});
|
|
11118
|
+
});
|
|
11119
|
+
proc.on("error", (err) => {
|
|
11120
|
+
resolve5({
|
|
11121
|
+
stdout: "",
|
|
11122
|
+
stderr: err.message,
|
|
11123
|
+
exitCode: null
|
|
11124
|
+
});
|
|
11125
|
+
});
|
|
11126
|
+
setTimeout(() => {
|
|
11127
|
+
proc.kill("SIGTERM");
|
|
11128
|
+
resolve5({
|
|
11129
|
+
stdout: stdout.join(""),
|
|
11130
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
11131
|
+
exitCode: null
|
|
11132
|
+
});
|
|
11133
|
+
}, timeoutMs);
|
|
11134
|
+
});
|
|
11135
|
+
}
|
|
11136
|
+
function createBashPlugin(options = {}) {
|
|
11137
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
11138
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
11139
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
11140
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
11141
|
+
...options
|
|
11142
|
+
};
|
|
11143
|
+
let serverRef = null;
|
|
11144
|
+
return {
|
|
11145
|
+
name: "plugin-bash",
|
|
11146
|
+
version: "1.0.0",
|
|
11147
|
+
// Store server reference for tool registration
|
|
11148
|
+
configureServer: (server) => {
|
|
11149
|
+
serverRef = server;
|
|
11150
|
+
},
|
|
11151
|
+
// Register bash tool with agent name prefix
|
|
11152
|
+
composeStart: (context2) => {
|
|
11153
|
+
if (!serverRef) return;
|
|
11154
|
+
const agentName = context2.serverName;
|
|
11155
|
+
const toolName = `${agentName}__bash`;
|
|
11156
|
+
serverRef.tool(toolName, "Execute a bash command and return its output.\n\nUse this for:\n- Running shell commands\n- Executing scripts\n- System operations\n\nNote: Output is truncated if too large.", {
|
|
11157
|
+
type: "object",
|
|
11158
|
+
properties: {
|
|
11159
|
+
command: {
|
|
11160
|
+
type: "string",
|
|
11161
|
+
description: "The bash command to execute"
|
|
11162
|
+
},
|
|
11163
|
+
cwd: {
|
|
11164
|
+
type: "string",
|
|
11165
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
11166
|
+
}
|
|
11167
|
+
},
|
|
11168
|
+
required: [
|
|
11169
|
+
"command"
|
|
11170
|
+
]
|
|
11171
|
+
}, async (args) => {
|
|
11172
|
+
const cwd2 = args.cwd || import_node_process7.default.cwd();
|
|
11173
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
11174
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
11175
|
+
let finalOutput = output;
|
|
11176
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
11177
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
11178
|
+
` + finalOutput;
|
|
11179
|
+
}
|
|
11180
|
+
if (truncated) {
|
|
11181
|
+
finalOutput += `
|
|
11182
|
+
|
|
11183
|
+
[Note: Output was truncated]`;
|
|
11184
|
+
}
|
|
11185
|
+
return {
|
|
11186
|
+
content: [
|
|
11187
|
+
{
|
|
11188
|
+
type: "text",
|
|
11189
|
+
text: finalOutput
|
|
11190
|
+
}
|
|
11191
|
+
],
|
|
11192
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
11193
|
+
};
|
|
11194
|
+
}, {
|
|
11195
|
+
internal: true
|
|
11196
|
+
});
|
|
11197
|
+
}
|
|
11198
|
+
};
|
|
11199
|
+
}
|
|
11200
|
+
|
|
11055
11201
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
11056
11202
|
var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
|
|
11057
11203
|
|
|
@@ -13031,10 +13177,10 @@ function parse(content, options = {}) {
|
|
|
13031
13177
|
}
|
|
13032
13178
|
|
|
13033
13179
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
13034
|
-
var
|
|
13180
|
+
var import_node_process8 = __toESM(require("node:process"), 1);
|
|
13035
13181
|
function replaceEnvVars(str2) {
|
|
13036
13182
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
13037
|
-
const value =
|
|
13183
|
+
const value = import_node_process8.default.env[varName];
|
|
13038
13184
|
if (value !== void 0) {
|
|
13039
13185
|
return value;
|
|
13040
13186
|
}
|
|
@@ -13133,17 +13279,18 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
13133
13279
|
|
|
13134
13280
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
13135
13281
|
var import_node_path5 = require("node:path");
|
|
13136
|
-
var
|
|
13282
|
+
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
13137
13283
|
var DEFAULT_SKILLS_PATHS = [
|
|
13138
13284
|
".agent/skills"
|
|
13139
13285
|
];
|
|
13140
13286
|
function getGlobalPlugins(skillsPaths) {
|
|
13141
|
-
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(
|
|
13287
|
+
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process9.default.cwd(), p2));
|
|
13142
13288
|
return [
|
|
13143
13289
|
markdownLoaderPlugin(),
|
|
13144
13290
|
createSkillsPlugin({
|
|
13145
13291
|
paths: resolvedPaths
|
|
13146
|
-
})
|
|
13292
|
+
}),
|
|
13293
|
+
createBashPlugin()
|
|
13147
13294
|
];
|
|
13148
13295
|
}
|
|
13149
13296
|
function getDefaultAgents() {
|
|
@@ -14743,8 +14890,8 @@ function parseArgs(args, options) {
|
|
|
14743
14890
|
var import_promises4 = require("node:fs/promises");
|
|
14744
14891
|
var import_node_os3 = require("node:os");
|
|
14745
14892
|
var import_node_path6 = require("node:path");
|
|
14746
|
-
var
|
|
14747
|
-
var CLI_VERSION = "0.1.
|
|
14893
|
+
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
14894
|
+
var CLI_VERSION = "0.1.52";
|
|
14748
14895
|
function extractServerName(command, commandArgs) {
|
|
14749
14896
|
for (const arg of commandArgs) {
|
|
14750
14897
|
if (!arg.startsWith("-")) {
|
|
@@ -14804,7 +14951,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
14804
14951
|
async function createWrapConfig(args) {
|
|
14805
14952
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
14806
14953
|
console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
|
|
14807
|
-
|
|
14954
|
+
import_node_process10.default.exit(1);
|
|
14808
14955
|
}
|
|
14809
14956
|
const mcpServers = {};
|
|
14810
14957
|
const serverNames = [];
|
|
@@ -14927,7 +15074,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
14927
15074
|
};
|
|
14928
15075
|
}
|
|
14929
15076
|
function parseCLIArgs() {
|
|
14930
|
-
const args = parseArgs(
|
|
15077
|
+
const args = parseArgs(import_node_process10.default.argv.slice(2), {
|
|
14931
15078
|
boolean: [
|
|
14932
15079
|
"help",
|
|
14933
15080
|
"version",
|
|
@@ -15016,15 +15163,15 @@ async function loadConfig() {
|
|
|
15016
15163
|
const args = parseCLIArgs();
|
|
15017
15164
|
if (args.version) {
|
|
15018
15165
|
printVersion();
|
|
15019
|
-
|
|
15166
|
+
import_node_process10.default.exit(0);
|
|
15020
15167
|
}
|
|
15021
15168
|
if (args.help) {
|
|
15022
15169
|
printHelp();
|
|
15023
|
-
|
|
15170
|
+
import_node_process10.default.exit(0);
|
|
15024
15171
|
}
|
|
15025
15172
|
if (args.cwd) {
|
|
15026
|
-
const targetCwd = (0, import_node_path6.resolve)(
|
|
15027
|
-
|
|
15173
|
+
const targetCwd = (0, import_node_path6.resolve)(import_node_process10.default.cwd(), args.cwd);
|
|
15174
|
+
import_node_process10.default.chdir(targetCwd);
|
|
15028
15175
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
15029
15176
|
}
|
|
15030
15177
|
const mergeSkills = (config) => {
|
|
@@ -15036,7 +15183,7 @@ async function loadConfig() {
|
|
|
15036
15183
|
...args,
|
|
15037
15184
|
saveConfig: true
|
|
15038
15185
|
});
|
|
15039
|
-
|
|
15186
|
+
import_node_process10.default.exit(0);
|
|
15040
15187
|
}
|
|
15041
15188
|
if (args.wrap) {
|
|
15042
15189
|
return mergeSkills(await createWrapConfig({
|
|
@@ -15053,16 +15200,16 @@ async function loadConfig() {
|
|
|
15053
15200
|
throw error;
|
|
15054
15201
|
}
|
|
15055
15202
|
}
|
|
15056
|
-
if (
|
|
15203
|
+
if (import_node_process10.default.env.MCPC_CONFIG) {
|
|
15057
15204
|
try {
|
|
15058
|
-
const parsed = JSON.parse(
|
|
15205
|
+
const parsed = JSON.parse(import_node_process10.default.env.MCPC_CONFIG);
|
|
15059
15206
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
15060
15207
|
} catch (error) {
|
|
15061
15208
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
15062
15209
|
throw error;
|
|
15063
15210
|
}
|
|
15064
15211
|
}
|
|
15065
|
-
const configUrl = args.configUrl ||
|
|
15212
|
+
const configUrl = args.configUrl || import_node_process10.default.env.MCPC_CONFIG_URL;
|
|
15066
15213
|
if (configUrl) {
|
|
15067
15214
|
try {
|
|
15068
15215
|
const headers = {
|
|
@@ -15083,7 +15230,7 @@ async function loadConfig() {
|
|
|
15083
15230
|
throw error;
|
|
15084
15231
|
}
|
|
15085
15232
|
}
|
|
15086
|
-
const configFile = args.configFile ||
|
|
15233
|
+
const configFile = args.configFile || import_node_process10.default.env.MCPC_CONFIG_FILE;
|
|
15087
15234
|
if (configFile) {
|
|
15088
15235
|
try {
|
|
15089
15236
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -15108,7 +15255,7 @@ async function loadConfig() {
|
|
|
15108
15255
|
throw error;
|
|
15109
15256
|
}
|
|
15110
15257
|
}
|
|
15111
|
-
const defaultJsonConfigPath = (0, import_node_path6.resolve)(
|
|
15258
|
+
const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process10.default.cwd(), "mcpc.config.json");
|
|
15112
15259
|
try {
|
|
15113
15260
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
15114
15261
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -15123,7 +15270,7 @@ async function loadConfig() {
|
|
|
15123
15270
|
}
|
|
15124
15271
|
function replaceEnvVars2(str2) {
|
|
15125
15272
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
15126
|
-
return
|
|
15273
|
+
return import_node_process10.default.env[varName] || "";
|
|
15127
15274
|
});
|
|
15128
15275
|
}
|
|
15129
15276
|
function isMarkdownFile2(path) {
|
package/app.mjs
CHANGED
|
@@ -509,7 +509,7 @@ var require_cross_spawn = __commonJS({
|
|
|
509
509
|
var cp = __require("child_process");
|
|
510
510
|
var parse2 = require_parse();
|
|
511
511
|
var enoent = require_enoent();
|
|
512
|
-
function
|
|
512
|
+
function spawn3(command, args, options) {
|
|
513
513
|
const parsed = parse2(command, args, options);
|
|
514
514
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
515
515
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -521,8 +521,8 @@ var require_cross_spawn = __commonJS({
|
|
|
521
521
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
522
522
|
return result;
|
|
523
523
|
}
|
|
524
|
-
module.exports =
|
|
525
|
-
module.exports.spawn =
|
|
524
|
+
module.exports = spawn3;
|
|
525
|
+
module.exports.spawn = spawn3;
|
|
526
526
|
module.exports.sync = spawnSync;
|
|
527
527
|
module.exports._parse = parse2;
|
|
528
528
|
module.exports._enoent = enoent;
|
|
@@ -11048,6 +11048,152 @@ Skill path: ${meta.basePath}
|
|
|
11048
11048
|
};
|
|
11049
11049
|
}
|
|
11050
11050
|
|
|
11051
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
11052
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
11053
|
+
import process7 from "node:process";
|
|
11054
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
11055
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
11056
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
11057
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
11058
|
+
const fullOutput = (stderr ? `STDERR:
|
|
11059
|
+
${stderr}
|
|
11060
|
+
|
|
11061
|
+
STDOUT:
|
|
11062
|
+
` : "") + stdout;
|
|
11063
|
+
const lines = fullOutput.split("\n");
|
|
11064
|
+
if (lines.length > maxLines) {
|
|
11065
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
11066
|
+
return {
|
|
11067
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
11068
|
+
|
|
11069
|
+
` + truncatedLines.join("\n"),
|
|
11070
|
+
truncated: true
|
|
11071
|
+
};
|
|
11072
|
+
}
|
|
11073
|
+
if (fullOutput.length > maxBytes) {
|
|
11074
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
11075
|
+
return {
|
|
11076
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
11077
|
+
|
|
11078
|
+
` + truncatedBytes,
|
|
11079
|
+
truncated: true
|
|
11080
|
+
};
|
|
11081
|
+
}
|
|
11082
|
+
return {
|
|
11083
|
+
output: fullOutput,
|
|
11084
|
+
truncated: false
|
|
11085
|
+
};
|
|
11086
|
+
}
|
|
11087
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
11088
|
+
return new Promise((resolve5) => {
|
|
11089
|
+
const stdout = [];
|
|
11090
|
+
const stderr = [];
|
|
11091
|
+
const proc = spawn2("bash", [
|
|
11092
|
+
"-c",
|
|
11093
|
+
command
|
|
11094
|
+
], {
|
|
11095
|
+
cwd: cwd2,
|
|
11096
|
+
stdio: [
|
|
11097
|
+
"ignore",
|
|
11098
|
+
"pipe",
|
|
11099
|
+
"pipe"
|
|
11100
|
+
]
|
|
11101
|
+
});
|
|
11102
|
+
proc.stdout?.on("data", (data) => {
|
|
11103
|
+
stdout.push(data.toString());
|
|
11104
|
+
});
|
|
11105
|
+
proc.stderr?.on("data", (data) => {
|
|
11106
|
+
stderr.push(data.toString());
|
|
11107
|
+
});
|
|
11108
|
+
proc.on("close", (code) => {
|
|
11109
|
+
resolve5({
|
|
11110
|
+
stdout: stdout.join(""),
|
|
11111
|
+
stderr: stderr.join(""),
|
|
11112
|
+
exitCode: code
|
|
11113
|
+
});
|
|
11114
|
+
});
|
|
11115
|
+
proc.on("error", (err) => {
|
|
11116
|
+
resolve5({
|
|
11117
|
+
stdout: "",
|
|
11118
|
+
stderr: err.message,
|
|
11119
|
+
exitCode: null
|
|
11120
|
+
});
|
|
11121
|
+
});
|
|
11122
|
+
setTimeout(() => {
|
|
11123
|
+
proc.kill("SIGTERM");
|
|
11124
|
+
resolve5({
|
|
11125
|
+
stdout: stdout.join(""),
|
|
11126
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
11127
|
+
exitCode: null
|
|
11128
|
+
});
|
|
11129
|
+
}, timeoutMs);
|
|
11130
|
+
});
|
|
11131
|
+
}
|
|
11132
|
+
function createBashPlugin(options = {}) {
|
|
11133
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
11134
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
11135
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
11136
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
11137
|
+
...options
|
|
11138
|
+
};
|
|
11139
|
+
let serverRef = null;
|
|
11140
|
+
return {
|
|
11141
|
+
name: "plugin-bash",
|
|
11142
|
+
version: "1.0.0",
|
|
11143
|
+
// Store server reference for tool registration
|
|
11144
|
+
configureServer: (server) => {
|
|
11145
|
+
serverRef = server;
|
|
11146
|
+
},
|
|
11147
|
+
// Register bash tool with agent name prefix
|
|
11148
|
+
composeStart: (context2) => {
|
|
11149
|
+
if (!serverRef) return;
|
|
11150
|
+
const agentName = context2.serverName;
|
|
11151
|
+
const toolName = `${agentName}__bash`;
|
|
11152
|
+
serverRef.tool(toolName, "Execute a bash command and return its output.\n\nUse this for:\n- Running shell commands\n- Executing scripts\n- System operations\n\nNote: Output is truncated if too large.", {
|
|
11153
|
+
type: "object",
|
|
11154
|
+
properties: {
|
|
11155
|
+
command: {
|
|
11156
|
+
type: "string",
|
|
11157
|
+
description: "The bash command to execute"
|
|
11158
|
+
},
|
|
11159
|
+
cwd: {
|
|
11160
|
+
type: "string",
|
|
11161
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
11162
|
+
}
|
|
11163
|
+
},
|
|
11164
|
+
required: [
|
|
11165
|
+
"command"
|
|
11166
|
+
]
|
|
11167
|
+
}, async (args) => {
|
|
11168
|
+
const cwd2 = args.cwd || process7.cwd();
|
|
11169
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
11170
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
11171
|
+
let finalOutput = output;
|
|
11172
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
11173
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
11174
|
+
` + finalOutput;
|
|
11175
|
+
}
|
|
11176
|
+
if (truncated) {
|
|
11177
|
+
finalOutput += `
|
|
11178
|
+
|
|
11179
|
+
[Note: Output was truncated]`;
|
|
11180
|
+
}
|
|
11181
|
+
return {
|
|
11182
|
+
content: [
|
|
11183
|
+
{
|
|
11184
|
+
type: "text",
|
|
11185
|
+
text: finalOutput
|
|
11186
|
+
}
|
|
11187
|
+
],
|
|
11188
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
11189
|
+
};
|
|
11190
|
+
}, {
|
|
11191
|
+
internal: true
|
|
11192
|
+
});
|
|
11193
|
+
}
|
|
11194
|
+
};
|
|
11195
|
+
}
|
|
11196
|
+
|
|
11051
11197
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
11052
11198
|
import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
|
|
11053
11199
|
|
|
@@ -13027,10 +13173,10 @@ function parse(content, options = {}) {
|
|
|
13027
13173
|
}
|
|
13028
13174
|
|
|
13029
13175
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
13030
|
-
import
|
|
13176
|
+
import process8 from "node:process";
|
|
13031
13177
|
function replaceEnvVars(str2) {
|
|
13032
13178
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
13033
|
-
const value =
|
|
13179
|
+
const value = process8.env[varName];
|
|
13034
13180
|
if (value !== void 0) {
|
|
13035
13181
|
return value;
|
|
13036
13182
|
}
|
|
@@ -13129,17 +13275,18 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
13129
13275
|
|
|
13130
13276
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
13131
13277
|
import { resolve as resolve3 } from "node:path";
|
|
13132
|
-
import
|
|
13278
|
+
import process9 from "node:process";
|
|
13133
13279
|
var DEFAULT_SKILLS_PATHS = [
|
|
13134
13280
|
".agent/skills"
|
|
13135
13281
|
];
|
|
13136
13282
|
function getGlobalPlugins(skillsPaths) {
|
|
13137
|
-
const resolvedPaths = skillsPaths.map((p2) => resolve3(
|
|
13283
|
+
const resolvedPaths = skillsPaths.map((p2) => resolve3(process9.cwd(), p2));
|
|
13138
13284
|
return [
|
|
13139
13285
|
markdownLoaderPlugin(),
|
|
13140
13286
|
createSkillsPlugin({
|
|
13141
13287
|
paths: resolvedPaths
|
|
13142
|
-
})
|
|
13288
|
+
}),
|
|
13289
|
+
createBashPlugin()
|
|
13143
13290
|
];
|
|
13144
13291
|
}
|
|
13145
13292
|
function getDefaultAgents() {
|
|
@@ -14739,8 +14886,8 @@ function parseArgs(args, options) {
|
|
|
14739
14886
|
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
14740
14887
|
import { homedir } from "node:os";
|
|
14741
14888
|
import { dirname, join as join3, resolve as resolve4 } from "node:path";
|
|
14742
|
-
import
|
|
14743
|
-
var CLI_VERSION = "0.1.
|
|
14889
|
+
import process10 from "node:process";
|
|
14890
|
+
var CLI_VERSION = "0.1.52";
|
|
14744
14891
|
function extractServerName(command, commandArgs) {
|
|
14745
14892
|
for (const arg of commandArgs) {
|
|
14746
14893
|
if (!arg.startsWith("-")) {
|
|
@@ -14800,7 +14947,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
14800
14947
|
async function createWrapConfig(args) {
|
|
14801
14948
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
14802
14949
|
console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
|
|
14803
|
-
|
|
14950
|
+
process10.exit(1);
|
|
14804
14951
|
}
|
|
14805
14952
|
const mcpServers = {};
|
|
14806
14953
|
const serverNames = [];
|
|
@@ -14923,7 +15070,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
14923
15070
|
};
|
|
14924
15071
|
}
|
|
14925
15072
|
function parseCLIArgs() {
|
|
14926
|
-
const args = parseArgs(
|
|
15073
|
+
const args = parseArgs(process10.argv.slice(2), {
|
|
14927
15074
|
boolean: [
|
|
14928
15075
|
"help",
|
|
14929
15076
|
"version",
|
|
@@ -15012,15 +15159,15 @@ async function loadConfig() {
|
|
|
15012
15159
|
const args = parseCLIArgs();
|
|
15013
15160
|
if (args.version) {
|
|
15014
15161
|
printVersion();
|
|
15015
|
-
|
|
15162
|
+
process10.exit(0);
|
|
15016
15163
|
}
|
|
15017
15164
|
if (args.help) {
|
|
15018
15165
|
printHelp();
|
|
15019
|
-
|
|
15166
|
+
process10.exit(0);
|
|
15020
15167
|
}
|
|
15021
15168
|
if (args.cwd) {
|
|
15022
|
-
const targetCwd = resolve4(
|
|
15023
|
-
|
|
15169
|
+
const targetCwd = resolve4(process10.cwd(), args.cwd);
|
|
15170
|
+
process10.chdir(targetCwd);
|
|
15024
15171
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
15025
15172
|
}
|
|
15026
15173
|
const mergeSkills = (config) => {
|
|
@@ -15032,7 +15179,7 @@ async function loadConfig() {
|
|
|
15032
15179
|
...args,
|
|
15033
15180
|
saveConfig: true
|
|
15034
15181
|
});
|
|
15035
|
-
|
|
15182
|
+
process10.exit(0);
|
|
15036
15183
|
}
|
|
15037
15184
|
if (args.wrap) {
|
|
15038
15185
|
return mergeSkills(await createWrapConfig({
|
|
@@ -15049,16 +15196,16 @@ async function loadConfig() {
|
|
|
15049
15196
|
throw error;
|
|
15050
15197
|
}
|
|
15051
15198
|
}
|
|
15052
|
-
if (
|
|
15199
|
+
if (process10.env.MCPC_CONFIG) {
|
|
15053
15200
|
try {
|
|
15054
|
-
const parsed = JSON.parse(
|
|
15201
|
+
const parsed = JSON.parse(process10.env.MCPC_CONFIG);
|
|
15055
15202
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
15056
15203
|
} catch (error) {
|
|
15057
15204
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
15058
15205
|
throw error;
|
|
15059
15206
|
}
|
|
15060
15207
|
}
|
|
15061
|
-
const configUrl = args.configUrl ||
|
|
15208
|
+
const configUrl = args.configUrl || process10.env.MCPC_CONFIG_URL;
|
|
15062
15209
|
if (configUrl) {
|
|
15063
15210
|
try {
|
|
15064
15211
|
const headers = {
|
|
@@ -15079,7 +15226,7 @@ async function loadConfig() {
|
|
|
15079
15226
|
throw error;
|
|
15080
15227
|
}
|
|
15081
15228
|
}
|
|
15082
|
-
const configFile = args.configFile ||
|
|
15229
|
+
const configFile = args.configFile || process10.env.MCPC_CONFIG_FILE;
|
|
15083
15230
|
if (configFile) {
|
|
15084
15231
|
try {
|
|
15085
15232
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -15104,7 +15251,7 @@ async function loadConfig() {
|
|
|
15104
15251
|
throw error;
|
|
15105
15252
|
}
|
|
15106
15253
|
}
|
|
15107
|
-
const defaultJsonConfigPath = resolve4(
|
|
15254
|
+
const defaultJsonConfigPath = resolve4(process10.cwd(), "mcpc.config.json");
|
|
15108
15255
|
try {
|
|
15109
15256
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
15110
15257
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -15119,7 +15266,7 @@ async function loadConfig() {
|
|
|
15119
15266
|
}
|
|
15120
15267
|
function replaceEnvVars2(str2) {
|
|
15121
15268
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
15122
|
-
return
|
|
15269
|
+
return process10.env[varName] || "";
|
|
15123
15270
|
});
|
|
15124
15271
|
}
|
|
15125
15272
|
function isMarkdownFile2(path) {
|