better-caprover-mcp 0.1.2 → 0.1.3
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 +1 -0
- package/dist/main.js +53 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -217,6 +217,7 @@ The mode decides which operations the client sees at all. Only the person can ch
|
|
|
217
217
|
| `CAPROVER_PASSWORD` | none | The CapRover password |
|
|
218
218
|
| `CAPROVER_MCP_MODE` | `readonly` | `readonly`, `operate` or `admin` |
|
|
219
219
|
| `CAPROVER_MCP_ALLOW_CRITICAL` | off | Set to `1` to unlock critical operations in `admin` mode. No operation is critical yet |
|
|
220
|
+
| `CAPROVER_MCP_LOG_LEVEL` | `info` | `error`, `info` or `debug`. `info` logs the start (transport, mode, what is set); `debug` also logs the configuration (CapRover address, HTTP host and port, whether a token is set). Never the password or the token. Audit lines are always written |
|
|
220
221
|
| `CAPROVER_MCP_TRANSPORT` | `stdio` | `stdio` or `http`. `http` makes a plain start (no arguments) serve Streamable HTTP, same as `serve --http` |
|
|
221
222
|
| `CAPROVER_MCP_HTTP_TOKEN` | none | Bearer secret for `serve --http` (minimum 8 characters); required for non-local HTTP bind |
|
|
222
223
|
| `CAPROVER_MCP_HTTP_HOST` | `127.0.0.1` | Address for `serve --http` |
|
package/dist/main.js
CHANGED
|
@@ -31634,6 +31634,9 @@ var DEFAULT_HTTP_SESSION_TTL_MS = 864e5;
|
|
|
31634
31634
|
var DEFAULT_MAX_CONCURRENT = 5;
|
|
31635
31635
|
var MIN_HTTP_TOKEN_LENGTH = 8;
|
|
31636
31636
|
var HttpTokenSchema = external_exports.string().min(MIN_HTTP_TOKEN_LENGTH);
|
|
31637
|
+
var LogLevelSchema = OptionalTextSchema.pipe(
|
|
31638
|
+
external_exports.enum(["error", "info", "debug"], { error: "CAPROVER_MCP_LOG_LEVEL must be error, info or debug." }).optional()
|
|
31639
|
+
).transform((level) => level ?? "info");
|
|
31637
31640
|
var TransportSchema = OptionalTextSchema.pipe(
|
|
31638
31641
|
external_exports.enum(["stdio", "http"], { error: "CAPROVER_MCP_TRANSPORT must be stdio or http." }).optional()
|
|
31639
31642
|
).transform((transport) => transport ?? "stdio");
|
|
@@ -31666,6 +31669,7 @@ var RawEnvSchema = external_exports.object({
|
|
|
31666
31669
|
CAPROVER_MCP_MODE: AccessModeSchema.default("readonly"),
|
|
31667
31670
|
CAPROVER_MCP_ALLOW_CRITICAL: external_exports.string().optional().transform((text) => text === "1"),
|
|
31668
31671
|
CAPROVER_MCP_TRANSPORT: TransportSchema,
|
|
31672
|
+
CAPROVER_MCP_LOG_LEVEL: LogLevelSchema,
|
|
31669
31673
|
CAPROVER_URL: OptionalTextSchema.pipe(
|
|
31670
31674
|
external_exports.url({ protocol: /^https?$/, error: "CAPROVER_URL must be a URL that starts with http:// or https://" }).transform((url2) => new URL(url2).origin).optional()
|
|
31671
31675
|
),
|
|
@@ -31694,6 +31698,7 @@ var EnvUtil = class _EnvUtil {
|
|
|
31694
31698
|
CAPROVER_MCP_MODE: raw.CAPROVER_MCP_MODE,
|
|
31695
31699
|
CAPROVER_MCP_ALLOW_CRITICAL: raw.CAPROVER_MCP_ALLOW_CRITICAL,
|
|
31696
31700
|
CAPROVER_MCP_TRANSPORT: raw.CAPROVER_MCP_TRANSPORT,
|
|
31701
|
+
CAPROVER_MCP_LOG_LEVEL: raw.CAPROVER_MCP_LOG_LEVEL,
|
|
31697
31702
|
CAPROVER_URL: raw.CAPROVER_URL,
|
|
31698
31703
|
CAPROVER_PASSWORD: raw.CAPROVER_PASSWORD,
|
|
31699
31704
|
CAPROVER_MCP_HTTP_HOST: raw.CAPROVER_MCP_HTTP_HOST,
|
|
@@ -36212,12 +36217,20 @@ var InputStripUtil = class {
|
|
|
36212
36217
|
};
|
|
36213
36218
|
|
|
36214
36219
|
// src/Utils/LogUtil.ts
|
|
36220
|
+
var LEVELS_FROM_LEAST_TO_MOST_VERBOSE = ["error", "info", "debug"];
|
|
36215
36221
|
var LogUtil = class _LogUtil {
|
|
36216
|
-
static
|
|
36217
|
-
|
|
36222
|
+
static threshold = "info";
|
|
36223
|
+
static setLevel(level) {
|
|
36224
|
+
_LogUtil.threshold = level;
|
|
36225
|
+
}
|
|
36226
|
+
static logDebug(event, fields) {
|
|
36227
|
+
_LogUtil.write("debug", event, fields);
|
|
36228
|
+
}
|
|
36229
|
+
static logInfo(event, fields = {}) {
|
|
36230
|
+
_LogUtil.write("info", event, fields);
|
|
36218
36231
|
}
|
|
36219
36232
|
static logError(event, detail) {
|
|
36220
|
-
_LogUtil.write("error", event, detail);
|
|
36233
|
+
_LogUtil.write("error", event, { detail });
|
|
36221
36234
|
}
|
|
36222
36235
|
static logAudit(record2) {
|
|
36223
36236
|
const payload = {
|
|
@@ -36234,8 +36247,12 @@ var LogUtil = class _LogUtil {
|
|
|
36234
36247
|
process.stderr.write(`${text}
|
|
36235
36248
|
`);
|
|
36236
36249
|
}
|
|
36237
|
-
static write(level, event,
|
|
36238
|
-
|
|
36250
|
+
static write(level, event, fields) {
|
|
36251
|
+
const findVerbosity = (name) => LEVELS_FROM_LEAST_TO_MOST_VERBOSE.indexOf(name);
|
|
36252
|
+
if (findVerbosity(level) > findVerbosity(_LogUtil.threshold)) {
|
|
36253
|
+
return;
|
|
36254
|
+
}
|
|
36255
|
+
process.stderr.write(`${JSON.stringify({ level, event, ...fields })}
|
|
36239
36256
|
`);
|
|
36240
36257
|
}
|
|
36241
36258
|
};
|
|
@@ -45209,7 +45226,7 @@ var SharedMcpRuntimeSurface = class _SharedMcpRuntimeSurface {
|
|
|
45209
45226
|
const runner = this.buildRunner();
|
|
45210
45227
|
const tools = OperationManifestSurface.build(this.parts.client, this.parts.policy, runner).filter((tool) => this.parts.policy.canRun(tool.risk));
|
|
45211
45228
|
const server = new McpServer(
|
|
45212
|
-
{ name: McpServerMetadataUtil.SERVER_NAME, version: "0.1.
|
|
45229
|
+
{ name: McpServerMetadataUtil.SERVER_NAME, version: "0.1.3" },
|
|
45213
45230
|
{ instructions: McpInstructionsSurface.build(this.parts.policy) }
|
|
45214
45231
|
);
|
|
45215
45232
|
ToolsSurface.register(server, tools);
|
|
@@ -45242,6 +45259,32 @@ var HttpBodyUtil = class {
|
|
|
45242
45259
|
}
|
|
45243
45260
|
};
|
|
45244
45261
|
|
|
45262
|
+
// src/Utils/StartupLogUtil.ts
|
|
45263
|
+
var StartupLogUtil = class {
|
|
45264
|
+
static startLogging(env, transport) {
|
|
45265
|
+
LogUtil.setLevel(env.CAPROVER_MCP_LOG_LEVEL);
|
|
45266
|
+
LogUtil.logDebug("config_loaded", {
|
|
45267
|
+
transport,
|
|
45268
|
+
logLevel: env.CAPROVER_MCP_LOG_LEVEL,
|
|
45269
|
+
capRoverOrigin: env.CAPROVER_URL ?? "unset",
|
|
45270
|
+
capRoverPasswordSet: env.CAPROVER_PASSWORD !== void 0,
|
|
45271
|
+
httpHost: env.CAPROVER_MCP_HTTP_HOST,
|
|
45272
|
+
httpPort: env.CAPROVER_MCP_HTTP_PORT,
|
|
45273
|
+
httpTokenSet: env.CAPROVER_MCP_HTTP_TOKEN !== void 0,
|
|
45274
|
+
maxConcurrent: env.CAPROVER_MCP_MAX_CONCURRENT
|
|
45275
|
+
});
|
|
45276
|
+
}
|
|
45277
|
+
static logServerStarted(env, transport) {
|
|
45278
|
+
LogUtil.logInfo("server_started", {
|
|
45279
|
+
transport,
|
|
45280
|
+
mode: env.CAPROVER_MCP_MODE,
|
|
45281
|
+
allowCritical: env.CAPROVER_MCP_ALLOW_CRITICAL,
|
|
45282
|
+
capRoverUrlSet: env.CAPROVER_URL !== void 0,
|
|
45283
|
+
capRoverPasswordSet: env.CAPROVER_PASSWORD !== void 0
|
|
45284
|
+
});
|
|
45285
|
+
}
|
|
45286
|
+
};
|
|
45287
|
+
|
|
45245
45288
|
// src/Setup/HttpRunner.ts
|
|
45246
45289
|
var HEALTH_PATH = "/health";
|
|
45247
45290
|
var MCP_PATH = "/mcp";
|
|
@@ -45268,6 +45311,7 @@ var HttpRunner = class _HttpRunner {
|
|
|
45268
45311
|
});
|
|
45269
45312
|
}
|
|
45270
45313
|
static async start(env = EnvUtil.read(), options = {}) {
|
|
45314
|
+
StartupLogUtil.startLogging(env, "http");
|
|
45271
45315
|
_HttpRunner.assertBindAllowed(env);
|
|
45272
45316
|
const getNowMs = () => Date.now();
|
|
45273
45317
|
const runtime = SharedMcpRuntimeSurface.buildFromEnv(
|
|
@@ -45312,7 +45356,7 @@ var HttpRunner = class _HttpRunner {
|
|
|
45312
45356
|
const markerPath = options.httpMarkerPath ?? HttpModeMarkerUtil.DEFAULT_MARKER_PATH;
|
|
45313
45357
|
const port = await _HttpRunner.bindHttpServer(httpServer, env.CAPROVER_MCP_HTTP_HOST, env.CAPROVER_MCP_HTTP_PORT);
|
|
45314
45358
|
HttpModeMarkerUtil.markHttpModeActive(markerPath);
|
|
45315
|
-
|
|
45359
|
+
StartupLogUtil.logServerStarted(env, "http");
|
|
45316
45360
|
return {
|
|
45317
45361
|
url: `http://${NetworkBindUtil.buildUrlHost(env.CAPROVER_MCP_HTTP_HOST)}:${port}`,
|
|
45318
45362
|
close: async () => {
|
|
@@ -45592,9 +45636,10 @@ var ServerSurface = class {
|
|
|
45592
45636
|
var StdioRunner = class {
|
|
45593
45637
|
static async run() {
|
|
45594
45638
|
const env = EnvUtil.read();
|
|
45639
|
+
StartupLogUtil.startLogging(env, "stdio");
|
|
45595
45640
|
const server = ServerSurface.build(env, () => Date.now());
|
|
45596
45641
|
await server.connect(new StdioServerTransport());
|
|
45597
|
-
|
|
45642
|
+
StartupLogUtil.logServerStarted(env, "stdio");
|
|
45598
45643
|
}
|
|
45599
45644
|
};
|
|
45600
45645
|
|
package/package.json
CHANGED