@regle/mcp-server 1.14.7-beta.2 → 1.14.7-beta.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.
@@ -1 +1 @@
1
- import "dotenv/config";
1
+ export { };
@@ -1,10 +1,379 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
2
+ import { createRequire } from "node:module";
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { z } from "zod";
6
6
  import "posthog-node";
7
7
 
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
10
+
11
+ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12
+ module.exports = {
13
+ "name": "dotenv",
14
+ "version": "17.2.3",
15
+ "description": "Loads environment variables from .env file",
16
+ "main": "lib/main.js",
17
+ "types": "lib/main.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./lib/main.d.ts",
21
+ "require": "./lib/main.js",
22
+ "default": "./lib/main.js"
23
+ },
24
+ "./config": "./config.js",
25
+ "./config.js": "./config.js",
26
+ "./lib/env-options": "./lib/env-options.js",
27
+ "./lib/env-options.js": "./lib/env-options.js",
28
+ "./lib/cli-options": "./lib/cli-options.js",
29
+ "./lib/cli-options.js": "./lib/cli-options.js",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "scripts": {
33
+ "dts-check": "tsc --project tests/types/tsconfig.json",
34
+ "lint": "standard",
35
+ "pretest": "npm run lint && npm run dts-check",
36
+ "test": "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
37
+ "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
38
+ "prerelease": "npm test",
39
+ "release": "standard-version"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git://github.com/motdotla/dotenv.git"
44
+ },
45
+ "homepage": "https://github.com/motdotla/dotenv#readme",
46
+ "funding": "https://dotenvx.com",
47
+ "keywords": [
48
+ "dotenv",
49
+ "env",
50
+ ".env",
51
+ "environment",
52
+ "variables",
53
+ "config",
54
+ "settings"
55
+ ],
56
+ "readmeFilename": "README.md",
57
+ "license": "BSD-2-Clause",
58
+ "devDependencies": {
59
+ "@types/node": "^18.11.3",
60
+ "decache": "^4.6.2",
61
+ "sinon": "^14.0.1",
62
+ "standard": "^17.0.0",
63
+ "standard-version": "^9.5.0",
64
+ "tap": "^19.2.0",
65
+ "typescript": "^4.8.4"
66
+ },
67
+ "engines": { "node": ">=12" },
68
+ "browser": { "fs": false }
69
+ };
70
+ }));
71
+
72
+ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
73
+ const fs = __require("fs");
74
+ const path = __require("path");
75
+ const os = __require("os");
76
+ const crypto = __require("crypto");
77
+ const version$1 = require_package().version;
78
+ const TIPS = [
79
+ "🔐 encrypt with Dotenvx: https://dotenvx.com",
80
+ "🔐 prevent committing .env to code: https://dotenvx.com/precommit",
81
+ "🔐 prevent building .env in docker: https://dotenvx.com/prebuild",
82
+ "📡 add observability to secrets: https://dotenvx.com/ops",
83
+ "👥 sync secrets across teammates & machines: https://dotenvx.com/ops",
84
+ "🗂️ backup and recover secrets: https://dotenvx.com/ops",
85
+ "✅ audit secrets and track compliance: https://dotenvx.com/ops",
86
+ "🔄 add secrets lifecycle management: https://dotenvx.com/ops",
87
+ "🔑 add access controls to secrets: https://dotenvx.com/ops",
88
+ "🛠️ run anywhere with `dotenvx run -- yourcommand`",
89
+ "⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
90
+ "⚙️ enable debug logging with { debug: true }",
91
+ "⚙️ override existing env vars with { override: true }",
92
+ "⚙️ suppress all logs with { quiet: true }",
93
+ "⚙️ write to custom object with { processEnv: myObject }",
94
+ "⚙️ load multiple .env files with { path: ['.env.local', '.env'] }"
95
+ ];
96
+ function _getRandomTip() {
97
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
98
+ }
99
+ function parseBoolean(value) {
100
+ if (typeof value === "string") return ![
101
+ "false",
102
+ "0",
103
+ "no",
104
+ "off",
105
+ ""
106
+ ].includes(value.toLowerCase());
107
+ return Boolean(value);
108
+ }
109
+ function supportsAnsi() {
110
+ return process.stdout.isTTY;
111
+ }
112
+ function dim(text) {
113
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
114
+ }
115
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
116
+ function parse(src) {
117
+ const obj = {};
118
+ let lines = src.toString();
119
+ lines = lines.replace(/\r\n?/gm, "\n");
120
+ let match;
121
+ while ((match = LINE.exec(lines)) != null) {
122
+ const key = match[1];
123
+ let value = match[2] || "";
124
+ value = value.trim();
125
+ const maybeQuote = value[0];
126
+ value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
127
+ if (maybeQuote === "\"") {
128
+ value = value.replace(/\\n/g, "\n");
129
+ value = value.replace(/\\r/g, "\r");
130
+ }
131
+ obj[key] = value;
132
+ }
133
+ return obj;
134
+ }
135
+ function _parseVault(options$1) {
136
+ options$1 = options$1 || {};
137
+ const vaultPath = _vaultPath(options$1);
138
+ options$1.path = vaultPath;
139
+ const result = DotenvModule.configDotenv(options$1);
140
+ if (!result.parsed) {
141
+ const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
142
+ err.code = "MISSING_DATA";
143
+ throw err;
144
+ }
145
+ const keys = _dotenvKey(options$1).split(",");
146
+ const length = keys.length;
147
+ let decrypted;
148
+ for (let i = 0; i < length; i++) try {
149
+ const attrs = _instructions(result, keys[i].trim());
150
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
151
+ break;
152
+ } catch (error) {
153
+ if (i + 1 >= length) throw error;
154
+ }
155
+ return DotenvModule.parse(decrypted);
156
+ }
157
+ function _warn(message) {
158
+ console.error(`[dotenv@${version$1}][WARN] ${message}`);
159
+ }
160
+ function _debug(message) {
161
+ console.log(`[dotenv@${version$1}][DEBUG] ${message}`);
162
+ }
163
+ function _log(message) {
164
+ console.log(`[dotenv@${version$1}] ${message}`);
165
+ }
166
+ function _dotenvKey(options$1) {
167
+ if (options$1 && options$1.DOTENV_KEY && options$1.DOTENV_KEY.length > 0) return options$1.DOTENV_KEY;
168
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
169
+ return "";
170
+ }
171
+ function _instructions(result, dotenvKey) {
172
+ let uri;
173
+ try {
174
+ uri = new URL(dotenvKey);
175
+ } catch (error) {
176
+ if (error.code === "ERR_INVALID_URL") {
177
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
178
+ err.code = "INVALID_DOTENV_KEY";
179
+ throw err;
180
+ }
181
+ throw error;
182
+ }
183
+ const key = uri.password;
184
+ if (!key) {
185
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
186
+ err.code = "INVALID_DOTENV_KEY";
187
+ throw err;
188
+ }
189
+ const environment = uri.searchParams.get("environment");
190
+ if (!environment) {
191
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
192
+ err.code = "INVALID_DOTENV_KEY";
193
+ throw err;
194
+ }
195
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
196
+ const ciphertext = result.parsed[environmentKey];
197
+ if (!ciphertext) {
198
+ const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
199
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
200
+ throw err;
201
+ }
202
+ return {
203
+ ciphertext,
204
+ key
205
+ };
206
+ }
207
+ function _vaultPath(options$1) {
208
+ let possibleVaultPath = null;
209
+ if (options$1 && options$1.path && options$1.path.length > 0) if (Array.isArray(options$1.path)) {
210
+ for (const filepath of options$1.path) if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
211
+ } else possibleVaultPath = options$1.path.endsWith(".vault") ? options$1.path : `${options$1.path}.vault`;
212
+ else possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
213
+ if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
214
+ return null;
215
+ }
216
+ function _resolveHome(envPath) {
217
+ return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
218
+ }
219
+ function _configVault(options$1) {
220
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options$1 && options$1.debug);
221
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options$1 && options$1.quiet);
222
+ if (debug || !quiet) _log("Loading env from encrypted .env.vault");
223
+ const parsed = DotenvModule._parseVault(options$1);
224
+ let processEnv = process.env;
225
+ if (options$1 && options$1.processEnv != null) processEnv = options$1.processEnv;
226
+ DotenvModule.populate(processEnv, parsed, options$1);
227
+ return { parsed };
228
+ }
229
+ function configDotenv(options$1) {
230
+ const dotenvPath = path.resolve(process.cwd(), ".env");
231
+ let encoding = "utf8";
232
+ let processEnv = process.env;
233
+ if (options$1 && options$1.processEnv != null) processEnv = options$1.processEnv;
234
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options$1 && options$1.debug);
235
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options$1 && options$1.quiet);
236
+ if (options$1 && options$1.encoding) encoding = options$1.encoding;
237
+ else if (debug) _debug("No encoding is specified. UTF-8 is used by default");
238
+ let optionPaths = [dotenvPath];
239
+ if (options$1 && options$1.path) if (!Array.isArray(options$1.path)) optionPaths = [_resolveHome(options$1.path)];
240
+ else {
241
+ optionPaths = [];
242
+ for (const filepath of options$1.path) optionPaths.push(_resolveHome(filepath));
243
+ }
244
+ let lastError;
245
+ const parsedAll = {};
246
+ for (const path$1 of optionPaths) try {
247
+ const parsed = DotenvModule.parse(fs.readFileSync(path$1, { encoding }));
248
+ DotenvModule.populate(parsedAll, parsed, options$1);
249
+ } catch (e) {
250
+ if (debug) _debug(`Failed to load ${path$1} ${e.message}`);
251
+ lastError = e;
252
+ }
253
+ const populated = DotenvModule.populate(processEnv, parsedAll, options$1);
254
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
255
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
256
+ if (debug || !quiet) {
257
+ const keysCount = Object.keys(populated).length;
258
+ const shortPaths = [];
259
+ for (const filePath of optionPaths) try {
260
+ const relative = path.relative(process.cwd(), filePath);
261
+ shortPaths.push(relative);
262
+ } catch (e) {
263
+ if (debug) _debug(`Failed to load ${filePath} ${e.message}`);
264
+ lastError = e;
265
+ }
266
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
267
+ }
268
+ if (lastError) return {
269
+ parsed: parsedAll,
270
+ error: lastError
271
+ };
272
+ else return { parsed: parsedAll };
273
+ }
274
+ function config(options$1) {
275
+ if (_dotenvKey(options$1).length === 0) return DotenvModule.configDotenv(options$1);
276
+ const vaultPath = _vaultPath(options$1);
277
+ if (!vaultPath) {
278
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
279
+ return DotenvModule.configDotenv(options$1);
280
+ }
281
+ return DotenvModule._configVault(options$1);
282
+ }
283
+ function decrypt(encrypted, keyStr) {
284
+ const key = Buffer.from(keyStr.slice(-64), "hex");
285
+ let ciphertext = Buffer.from(encrypted, "base64");
286
+ const nonce = ciphertext.subarray(0, 12);
287
+ const authTag = ciphertext.subarray(-16);
288
+ ciphertext = ciphertext.subarray(12, -16);
289
+ try {
290
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
291
+ aesgcm.setAuthTag(authTag);
292
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
293
+ } catch (error) {
294
+ const isRange = error instanceof RangeError;
295
+ const invalidKeyLength = error.message === "Invalid key length";
296
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
297
+ if (isRange || invalidKeyLength) {
298
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
299
+ err.code = "INVALID_DOTENV_KEY";
300
+ throw err;
301
+ } else if (decryptionFailed) {
302
+ const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
303
+ err.code = "DECRYPTION_FAILED";
304
+ throw err;
305
+ } else throw error;
306
+ }
307
+ }
308
+ function populate(processEnv, parsed, options$1 = {}) {
309
+ const debug = Boolean(options$1 && options$1.debug);
310
+ const override = Boolean(options$1 && options$1.override);
311
+ const populated = {};
312
+ if (typeof parsed !== "object") {
313
+ const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
314
+ err.code = "OBJECT_REQUIRED";
315
+ throw err;
316
+ }
317
+ for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
318
+ if (override === true) {
319
+ processEnv[key] = parsed[key];
320
+ populated[key] = parsed[key];
321
+ }
322
+ if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
323
+ else _debug(`"${key}" is already defined and was NOT overwritten`);
324
+ } else {
325
+ processEnv[key] = parsed[key];
326
+ populated[key] = parsed[key];
327
+ }
328
+ return populated;
329
+ }
330
+ const DotenvModule = {
331
+ configDotenv,
332
+ _configVault,
333
+ _parseVault,
334
+ config,
335
+ decrypt,
336
+ parse,
337
+ populate
338
+ };
339
+ module.exports.configDotenv = DotenvModule.configDotenv;
340
+ module.exports._configVault = DotenvModule._configVault;
341
+ module.exports._parseVault = DotenvModule._parseVault;
342
+ module.exports.config = DotenvModule.config;
343
+ module.exports.decrypt = DotenvModule.decrypt;
344
+ module.exports.parse = DotenvModule.parse;
345
+ module.exports.populate = DotenvModule.populate;
346
+ module.exports = DotenvModule;
347
+ }));
348
+
349
+ var require_env_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
350
+ const options = {};
351
+ if (process.env.DOTENV_CONFIG_ENCODING != null) options.encoding = process.env.DOTENV_CONFIG_ENCODING;
352
+ if (process.env.DOTENV_CONFIG_PATH != null) options.path = process.env.DOTENV_CONFIG_PATH;
353
+ if (process.env.DOTENV_CONFIG_QUIET != null) options.quiet = process.env.DOTENV_CONFIG_QUIET;
354
+ if (process.env.DOTENV_CONFIG_DEBUG != null) options.debug = process.env.DOTENV_CONFIG_DEBUG;
355
+ if (process.env.DOTENV_CONFIG_OVERRIDE != null) options.override = process.env.DOTENV_CONFIG_OVERRIDE;
356
+ if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
357
+ module.exports = options;
358
+ }));
359
+
360
+ var require_cli_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
361
+ const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
362
+ module.exports = function optionMatcher(args) {
363
+ const options$1 = args.reduce(function(acc, cur) {
364
+ const matches = cur.match(re);
365
+ if (matches) acc[matches[1]] = matches[2];
366
+ return acc;
367
+ }, {});
368
+ if (!("quiet" in options$1)) options$1.quiet = "true";
369
+ return options$1;
370
+ };
371
+ }));
372
+
373
+ (function() {
374
+ require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
375
+ })();
376
+
8
377
  var docs_data_default = {
9
378
  docs: [
10
379
  {
@@ -1665,7 +2034,7 @@ function searchApi(query) {
1665
2034
  return results;
1666
2035
  }
1667
2036
 
1668
- var version = "1.14.7-beta.2";
2037
+ var version = "1.14.7-beta.3";
1669
2038
 
1670
2039
  function trackServerConnected(params) {}
1671
2040
  function trackToolCall(params) {}
@@ -1704,8 +2073,8 @@ function getClientInfo() {
1704
2073
  clientVersion: clientInfo?.version
1705
2074
  };
1706
2075
  }
1707
- function registerTrackedTool(name, config, handler) {
1708
- server.registerTool(name, config, async (args) => {
2076
+ function registerTrackedTool(name, config$1, handler) {
2077
+ server.registerTool(name, config$1, async (args) => {
1709
2078
  const clientInfo = getClientInfo();
1710
2079
  try {
1711
2080
  const result = await handler(args, clientInfo);
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@regle/mcp-server",
3
- "version": "1.14.7-beta.2",
3
+ "version": "1.14.7-beta.3",
4
4
  "description": "MCP Server for Regle",
5
5
  "dependencies": {
6
6
  "@modelcontextprotocol/sdk": "1.24.3",
7
- "dotenv": "17.2.3",
8
7
  "posthog-node": "5.17.4",
9
8
  "zod": "4.1.13"
10
9
  },
@@ -12,7 +11,8 @@
12
11
  "@types/node": "22.19.1",
13
12
  "tsdown": "0.16.8",
14
13
  "tsx": "4.21.0",
15
- "typescript": "5.9.3"
14
+ "typescript": "5.9.3",
15
+ "dotenv": "17.2.3"
16
16
  },
17
17
  "type": "module",
18
18
  "exports": {