@exorcist-98/mcp-server 0.3.3 → 0.3.5

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 CHANGED
@@ -37,7 +37,7 @@ out of results unless you ask for it, and is then marked as untrusted.
37
37
  ```json
38
38
  {
39
39
  "mcpServers": {
40
- "exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.3"] }
40
+ "exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.5"] }
41
41
  }
42
42
  }
43
43
  ```
package/dist/index.mjs CHANGED
@@ -22759,7 +22759,7 @@ import { homedir as homedir6 } from "node:os";
22759
22759
  import { delimiter } from "node:path";
22760
22760
 
22761
22761
  // src/tools.ts
22762
- import { existsSync as existsSync4, readFileSync as readFileSync7, realpathSync as realpathSync3, statSync as statSync6 } from "node:fs";
22762
+ import { existsSync as existsSync5, readFileSync as readFileSync7, realpathSync as realpathSync3, statSync as statSync6 } from "node:fs";
22763
22763
  import { fileURLToPath as fileURLToPath2 } from "node:url";
22764
22764
 
22765
22765
  // ../shield/src/canonical.ts
@@ -31207,7 +31207,7 @@ function checkPathSegment(name) {
31207
31207
  }
31208
31208
 
31209
31209
  // ../core/src/lifecycle-scripts.ts
31210
- import { closeSync as closeSync2, existsSync, lstatSync as lstatSync2, openSync as openSync2, readdirSync, readSync, realpathSync, statSync as statSync2 } from "node:fs";
31210
+ import { closeSync as closeSync2, existsSync as existsSync2, lstatSync as lstatSync2, openSync as openSync2, readdirSync, readSync, realpathSync, statSync as statSync2 } from "node:fs";
31211
31211
  import { isAbsolute as isAbsolute6, join as join8, posix as posix2, relative as relative5, resolve as resolve5, sep } from "node:path";
31212
31212
 
31213
31213
  // ../core/src/install-hooks.ts
@@ -32036,7 +32036,7 @@ function parseShell(command, sub = false) {
32036
32036
 
32037
32037
  // ../core/src/dev-tools.ts
32038
32038
  init_zod();
32039
- import { readFileSync as readFileSync4, statSync } from "node:fs";
32039
+ import { existsSync, readFileSync as readFileSync4, statSync } from "node:fs";
32040
32040
  import { homedir as homedir3 } from "node:os";
32041
32041
  import { isAbsolute as isAbsolute5, join as join7, normalize as normalize2, relative as relative4, resolve as resolve3 } from "node:path";
32042
32042
 
@@ -32138,12 +32138,42 @@ function envFamilyOwners(name) {
32138
32138
  for (const [re2, owners] of ENV_FAMILIES) if (re2.test(name)) return owners;
32139
32139
  return null;
32140
32140
  }
32141
- function envAssignRisk(name, value, cwd, dynamic = false, known) {
32141
+ var PATH_VAR = /(?:CONFIG|_FILES?|_DIR|_HOME|_PATH|_PLUGINS?|CACHEDIR|_CERT\w*|_CA\w*)$/;
32142
+ var PROGRAM_VAR = /(?:EDITOR|PAGER|BROWSER|_CMD|_COMMAND|_HELPER|_PROGRAM|_EXEC|_SHELL|_ARGS(?:_\w+)?)$/u;
32143
+ var ENDPOINT_VAR = /(?:_HOST|_URL|_ENDPOINT|_SERVER)$/;
32144
+ function unlockedValueRisk(name, value, cwd, dynamic) {
32145
+ const runtime = dynamic || /[$`]/.test(value);
32146
+ const say = `${name} is set to a path inside the project, or to a value built at run time, and a tool config can name a program to run or a daemon to reach`;
32147
+ if (runtime) return say;
32148
+ if (PATH_VAR.test(name) && anyInside(value, cwd)) return say;
32149
+ const parts = value.split(/[\s:,;=]+/u).filter((x) => x !== "");
32150
+ if (PROGRAM_VAR.test(name)) {
32151
+ const only = parts.length === 1 && value.trim() === parts[0] ? parts[0] : void 0;
32152
+ const ok = only !== void 0 && (isAbsolute5(only) ? !insideProject(only, cwd) : !/[/\\~]/u.test(only) && cwd !== void 0 && !existsSync(resolve3(cwd, only)));
32153
+ if (!ok) return `${name} names a program or arguments for the tool, and only one word is allowed: an absolute path outside the project, or a program name that is not a file in the project`;
32154
+ }
32155
+ for (const part of parts) {
32156
+ if (/^[./~]/u.test(part) || part.includes("/")) {
32157
+ if (insideProject(part, cwd)) return say;
32158
+ } else {
32159
+ const bare = part.replace(/^-+/u, "");
32160
+ if (bare !== "" && (cwd === void 0 || existsSync(resolve3(cwd, bare)))) return say;
32161
+ }
32162
+ }
32163
+ if (ENDPOINT_VAR.test(name)) {
32164
+ const m = /^(?:unix|npipe|file):\/\/(.*)$/.exec(value);
32165
+ const target = m === null ? value : m[1];
32166
+ if ((m !== null || /^[./~]/.test(target)) && insideProject(target, cwd)) return say;
32167
+ }
32168
+ return null;
32169
+ }
32170
+ function envAssignRisk(name, value, cwd, dynamic = false, known, prog) {
32142
32171
  const owners = envFamilyOwners(name);
32143
32172
  if (owners !== null) {
32144
32173
  if (name === "HELM_PLUGINS") return "HELM_PLUGINS names a folder of helm plugins, which are programs, and the guard always refuses it. The person can run it in their own terminal";
32145
32174
  const list = known ?? userKnownPrograms();
32146
- if (owners.some((o) => list.has(o))) return null;
32175
+ const unlocked = prog === void 0 ? owners.some((o) => list.has(o)) : owners.includes(prog) && list.has(prog);
32176
+ if (unlocked) return unlockedValueRisk(name, value, cwd, dynamic);
32147
32177
  return `${name} belongs to the environment of ${owners[0]}, and its variables change what the tool runs or trusts (config files, plugins, endpoints, certificates, helpers). The guard refuses them whatever the value. To allow it, add "${owners[0]}" to the list of programs in your own user config, ${KNOWN_PROGRAMS_HINT} (a list inside a repository is never read)`;
32148
32178
  }
32149
32179
  if (!RISK_ENV.test(name)) return null;
@@ -32315,7 +32345,7 @@ function route(tool, args, c) {
32315
32345
  const bad = entry.check?.(parsed.pos, parsed.opts, c) ?? null;
32316
32346
  if (bad !== null) return blocked(n, `${n} ${key}`, bad);
32317
32347
  if (entry.stop !== void 0) {
32318
- const ep = parsed.opts.find((o) => o.name === "--entrypoint")?.value;
32348
+ const ep = parsed.opts.filter((o) => o.name === "--entrypoint").pop()?.value;
32319
32349
  const inner = [...ep === void 0 ? [] : [ep], ...parsed.rest ?? []];
32320
32350
  return inner.length === 0 ? plain : { kind: "follow", words: inner };
32321
32351
  }
@@ -32396,8 +32426,8 @@ var KUBE_NEVER = /* @__PURE__ */ new Map([
32396
32426
  ["--server", "was given a server address, and the request would carry your credentials to it"]
32397
32427
  ]);
32398
32428
  var tableOutputOnly = (_pos, opts) => {
32399
- const o = opts.find((x) => x.name === "-o" || x.name === "--output");
32400
- return o === void 0 || o.value !== void 0 && ["wide", "name"].includes(t(o.value)) ? null : "was asked for an output format other than the plain table (wide or name), and yaml, json and templates return secret values";
32429
+ const outs = opts.filter((x) => x.name === "-o" || x.name === "--output");
32430
+ return outs.every((o) => o.value !== void 0 && ["wide", "name"].includes(t(o.value).replace(/^=/, ""))) ? null : "was asked for an output format other than the plain table (wide or name), and yaml, json and templates return secret values";
32401
32431
  };
32402
32432
  var KUBECTL_TOOL = {
32403
32433
  name: "kubectl",
@@ -32543,11 +32573,11 @@ var TOOLS = {
32543
32573
  };
32544
32574
  function devToolPlan(prog, args, ctx2 = {}) {
32545
32575
  const c = { env: ctx2.env ?? {}, known: ctx2.known ?? userKnownPrograms(), ...ctx2.cwd === void 0 ? {} : { cwd: ctx2.cwd } };
32546
- if (c.known.has(prog)) return plain;
32547
32576
  for (const [k, v] of Object.entries(c.env)) {
32548
- const risk = envAssignRisk(k, v, c.cwd, false, c.known);
32577
+ const risk = envAssignRisk(k, v, c.cwd, false, c.known, prog);
32549
32578
  if (risk !== null) return blocked(prog, prog, `was given ${risk}`);
32550
32579
  }
32580
+ if (c.known.has(prog)) return plain;
32551
32581
  const unreadable = args.find((w) => w.dynamic || w.glob);
32552
32582
  if (unreadable !== void 0) return blocked(prog, prog, "was given a word built at run time (a variable, a substitution or a pattern), and the guard cannot read what it will be");
32553
32583
  switch (prog) {
@@ -33088,7 +33118,8 @@ function resolveWords(words2, f, ctx2) {
33088
33118
  const env = { ...f.env };
33089
33119
  let i = skipFlags(words2, 1, WRAP_SPECS[prog], prog, prog === "env" || prog === "sudo" || prog === "doas" ? env : void 0);
33090
33120
  if (prog === "env" || prog === "sudo" || prog === "doas") {
33091
- for (const [k, v] of Object.entries(env)) if (f.env[k] !== v) checkAssign(ctx2, k, v, /[$`]/.test(v));
33121
+ const inner = words2[i] !== void 0 && !words2[i]?.dynamic && !words2[i]?.glob ? progName(words2[i].text) : void 0;
33122
+ for (const [k, v] of Object.entries(env)) if (f.env[k] !== v) checkAssign(ctx2, k, v, /[$`]/.test(v), inner);
33092
33123
  }
33093
33124
  if (prog === "timeout") {
33094
33125
  if (words2[i] === void 0 || words2[i]?.dynamic) reject("timeout has no fixed duration");
@@ -33263,9 +33294,14 @@ function producedText(e) {
33263
33294
  }
33264
33295
  var ENV_DECLARERS = /* @__PURE__ */ new Set(["export", "declare", "typeset", "readonly", "local"]);
33265
33296
  var ASSIGN_WORD = /^([A-Za-z_][A-Za-z0-9_]*)=([\s\S]*)$/;
33266
- function checkAssign(ctx2, name, value, dynamic) {
33297
+ function literalProg(words2) {
33298
+ const w = words2[0];
33299
+ if (w === void 0 || w.dynamic || w.glob || ENV_DECLARERS.has(w.text)) return void 0;
33300
+ return progName(w.text);
33301
+ }
33302
+ function checkAssign(ctx2, name, value, dynamic, prog) {
33267
33303
  if (ctx2.mode !== "agent") return;
33268
- const why = envAssignRisk(name, value, ctx2.cwd, dynamic);
33304
+ const why = envAssignRisk(name, value, ctx2.cwd, dynamic, void 0, prog);
33269
33305
  if (why !== null) reject(`${why}. If you trust it, the person can run it in their own terminal`, FIX_SIMPLE);
33270
33306
  }
33271
33307
  function resolveCommands(commands, ctx2, via, baseEnv) {
@@ -33275,7 +33311,7 @@ function resolveCommands(commands, ctx2, via, baseEnv) {
33275
33311
  for (const c of commands) {
33276
33312
  const env = { ...persist };
33277
33313
  for (const a of c.assigns) {
33278
- checkAssign(ctx2, a.name, a.value.text, a.value.dynamic);
33314
+ checkAssign(ctx2, a.name, a.value.text, a.value.dynamic, literalProg(c.words));
33279
33315
  env[a.name] = a.value.text;
33280
33316
  }
33281
33317
  let stdinText = null;
@@ -33987,7 +34023,7 @@ function readLocalText(pkgDir, rel) {
33987
34023
  const r = relative5(root, p);
33988
34024
  return r !== "" && !r.startsWith("..") && !isAbsolute6(r) && !r.split(sep).includes("..");
33989
34025
  };
33990
- if (!within(pkgDir, abs) || !existsSync(abs)) return null;
34026
+ if (!within(pkgDir, abs) || !existsSync2(abs)) return null;
33991
34027
  const real = realpathSync(abs);
33992
34028
  if (!within(realpathSync(pkgDir), real)) return null;
33993
34029
  const st = statSync2(real);
@@ -35731,7 +35767,7 @@ var LockSchema = external_exports.object({
35731
35767
 
35732
35768
  // ../shield/src/vault.ts
35733
35769
  import { createHash as createHash3, randomBytes as randomBytes4 } from "node:crypto";
35734
- import { closeSync as closeSync4, constants as constants3, copyFileSync, existsSync as existsSync2, fstatSync as fstatSync3, lstatSync as lstatSync4, mkdirSync as mkdirSync3, openSync as openSync4, readFileSync as readFileSync6, readdirSync as readdirSync3, realpathSync as realpathSync2, rmSync as rmSync2, statSync as statSync4, writeFileSync as writeFileSync2, writeSync as writeSync2 } from "node:fs";
35770
+ import { closeSync as closeSync4, constants as constants3, copyFileSync, existsSync as existsSync3, fstatSync as fstatSync3, lstatSync as lstatSync4, mkdirSync as mkdirSync3, openSync as openSync4, readFileSync as readFileSync6, readdirSync as readdirSync3, realpathSync as realpathSync2, rmSync as rmSync2, statSync as statSync4, writeFileSync as writeFileSync2, writeSync as writeSync2 } from "node:fs";
35735
35771
  import { basename as basename5, dirname as dirname3, isAbsolute as isAbsolute7, join as join12, resolve as resolve7, sep as sep2 } from "node:path";
35736
35772
  init_zod();
35737
35773
  var SafeRel = external_exports.string().min(1).max(1024).refine(
@@ -35829,12 +35865,12 @@ function writeManifest(vaultDir, e) {
35829
35865
  `);
35830
35866
  }
35831
35867
  function listEntries(vaultDir) {
35832
- if (!existsSync2(vaultDir)) return [];
35868
+ if (!existsSync3(vaultDir)) return [];
35833
35869
  const key = getUserKey();
35834
35870
  const out = [];
35835
35871
  for (const name of readdirSync3(vaultDir)) {
35836
35872
  const file = join12(vaultDir, name, "manifest.json");
35837
- if (!existsSync2(file)) continue;
35873
+ if (!existsSync3(file)) continue;
35838
35874
  try {
35839
35875
  const st = lstatSync4(file);
35840
35876
  if (!st.isFile()) continue;
@@ -36068,7 +36104,7 @@ var MAX_HASHED_BYTES = 64 * 1024 * 1024;
36068
36104
  var MAX_EVENT_BYTES2 = 16 * 1024 * 1024;
36069
36105
 
36070
36106
  // ../shield/src/locate.ts
36071
- import { existsSync as existsSync3, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
36107
+ import { existsSync as existsSync4, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
36072
36108
  import { dirname as dirname4, isAbsolute as isAbsolute8, join as join13, parse as parse3, resolve as resolve8 } from "node:path";
36073
36109
  import { fileURLToPath } from "node:url";
36074
36110
  function hasDefinitions(dir) {
@@ -36134,11 +36170,11 @@ function findDefinitionsDir2(cwd) {
36134
36170
  }
36135
36171
  function resolveInside(cwd, p, roots = [], primary) {
36136
36172
  const real = (d) => realpathSync3(d);
36137
- const extra = roots.filter((r) => existsSync4(r)).map(real);
36173
+ const extra = roots.filter((r) => existsSync5(r)).map(real);
36138
36174
  const first = primary !== void 0 && extra.includes(real(primary)) ? [real(primary)] : [];
36139
36175
  const bases = [.../* @__PURE__ */ new Set([...first, real(cwd), ...extra])];
36140
36176
  const tries = isAbsolute9(p) ? [p] : bases.map((b) => resolve9(b, p));
36141
- const found = tries.find((t2) => existsSync4(t2));
36177
+ const found = tries.find((t2) => existsSync5(t2));
36142
36178
  if (!found) return { ok: false, error: `Path not found: ${p}` };
36143
36179
  const target = realpathSync3(found);
36144
36180
  const base = bases.find((b) => {
@@ -36174,7 +36210,7 @@ var PROJECT_MARKERS = [
36174
36210
  "README"
36175
36211
  ];
36176
36212
  function looksLikeProject(dir) {
36177
- const has = (n) => existsSync4(join14(dir, n));
36213
+ const has = (n) => existsSync5(join14(dir, n));
36178
36214
  if (has("plugin.json") || has("POWER.md")) return false;
36179
36215
  return PROJECT_MARKERS.some(has);
36180
36216
  }
@@ -36185,7 +36221,7 @@ var isWithin = (base, p) => {
36185
36221
  return rel === "" || !rel.startsWith("..") && !isAbsolute9(rel);
36186
36222
  };
36187
36223
  function sensitiveReason(real, home = homedir5()) {
36188
- const realHome = existsSync4(home) ? realpathSync3(home) : home;
36224
+ const realHome = existsSync5(home) ? realpathSync3(home) : home;
36189
36225
  if (dirname5(real) === real) return "it is the filesystem root";
36190
36226
  if (isWithin(real, realHome)) return real === realHome ? "it is the home folder" : "it contains the home folder";
36191
36227
  for (const n of SENSITIVE_IN_HOME) {
@@ -36249,7 +36285,7 @@ function usableRoots(entries, home) {
36249
36285
  continue;
36250
36286
  }
36251
36287
  } else if (/^[a-z][a-z0-9+.-]*:/i.test(path) && !/^[a-z]:[\\/]/i.test(path)) continue;
36252
- if (!isAbsolute9(path) || !existsSync4(path)) continue;
36288
+ if (!isAbsolute9(path) || !existsSync5(path)) continue;
36253
36289
  let real;
36254
36290
  try {
36255
36291
  if (!statSync6(path).isDirectory()) continue;
@@ -36257,7 +36293,7 @@ function usableRoots(entries, home) {
36257
36293
  } catch {
36258
36294
  continue;
36259
36295
  }
36260
- const realHome = existsSync4(home) ? realpathSync3(home) : home;
36296
+ const realHome = existsSync5(home) ? realpathSync3(home) : home;
36261
36297
  if (real === resolve9("/") || real === realHome || dirname5(real) === real) continue;
36262
36298
  if (!out.includes(real)) out.push(real);
36263
36299
  }
@@ -36377,7 +36413,7 @@ Tell the user. They can undo this with: exorcist vault restore ${r.value.id}`
36377
36413
  }
36378
36414
 
36379
36415
  // src/index.ts
36380
- var VERSION = "0.3.3";
36416
+ var VERSION = "0.3.5";
36381
36417
  var ctx = {
36382
36418
  cwd: process.cwd(),
36383
36419
  approved: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exorcist-98/mcp-server",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "MCP server for Exorcist 98: scan repos and MCP configs, explain findings, quarantine servers.",