@solongate/proxy 0.4.8 → 0.4.9

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.
Files changed (3) hide show
  1. package/dist/index.js +23 -19
  2. package/dist/init.js +23 -19
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -516,7 +516,7 @@ var init_exports = {};
516
516
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync3, copyFileSync, mkdirSync } from "fs";
517
517
  import { resolve as resolve2, join } from "path";
518
518
  import { createInterface } from "readline";
519
- function findConfigFile(explicitPath) {
519
+ function findConfigFile(explicitPath, createIfMissing = false) {
520
520
  if (explicitPath) {
521
521
  if (existsSync3(explicitPath)) {
522
522
  return { path: resolve2(explicitPath), type: "mcp" };
@@ -527,6 +527,25 @@ function findConfigFile(explicitPath) {
527
527
  const full = resolve2(searchPath);
528
528
  if (existsSync3(full)) return { path: full, type: "mcp" };
529
529
  }
530
+ if (createIfMissing) {
531
+ const starterConfig = {
532
+ mcpServers: {
533
+ "filesystem": {
534
+ command: "npx",
535
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
536
+ },
537
+ "playwright": {
538
+ command: "npx",
539
+ args: ["-y", "@playwright/mcp@latest"]
540
+ }
541
+ }
542
+ };
543
+ const starterPath = resolve2(".mcp.json");
544
+ writeFileSync2(starterPath, JSON.stringify(starterConfig, null, 2) + "\n");
545
+ console.error(" Created .mcp.json with starter servers (filesystem, playwright).");
546
+ console.error("");
547
+ return { path: starterPath, type: "mcp" };
548
+ }
530
549
  for (const desktopPath of CLAUDE_DESKTOP_PATHS) {
531
550
  if (existsSync3(desktopPath)) return { path: desktopPath, type: "claude-desktop" };
532
551
  }
@@ -775,25 +794,10 @@ async function main() {
775
794
  console.error("");
776
795
  console.error(` ${_c.dim}${_c.italic}Init Setup${_c.reset}`);
777
796
  console.error("");
778
- let configInfo = findConfigFile(options.configPath);
797
+ const configInfo = findConfigFile(options.configPath, true);
779
798
  if (!configInfo) {
780
- const starterConfig = {
781
- mcpServers: {
782
- "filesystem": {
783
- command: "npx",
784
- args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
785
- },
786
- "playwright": {
787
- command: "npx",
788
- args: ["-y", "@playwright/mcp@latest"]
789
- }
790
- }
791
- };
792
- const starterPath = resolve2(".mcp.json");
793
- writeFileSync2(starterPath, JSON.stringify(starterConfig, null, 2) + "\n");
794
- console.error(" No MCP config found \u2014 created .mcp.json with starter servers.");
795
- console.error("");
796
- configInfo = { path: starterPath, type: "mcp" };
799
+ console.error(" No MCP config found and could not create one.");
800
+ process.exit(1);
797
801
  }
798
802
  console.error(` Config: ${configInfo.path}`);
799
803
  console.error(` Type: ${configInfo.type === "claude-desktop" ? "Claude Desktop" : "MCP JSON"}`);
package/dist/init.js CHANGED
@@ -11,7 +11,7 @@ var SEARCH_PATHS = [
11
11
  ".claude/mcp.json"
12
12
  ];
13
13
  var CLAUDE_DESKTOP_PATHS = process.platform === "win32" ? [join(process.env["APPDATA"] ?? "", "Claude", "claude_desktop_config.json")] : process.platform === "darwin" ? [join(process.env["HOME"] ?? "", "Library", "Application Support", "Claude", "claude_desktop_config.json")] : [join(process.env["HOME"] ?? "", ".config", "claude", "claude_desktop_config.json")];
14
- function findConfigFile(explicitPath) {
14
+ function findConfigFile(explicitPath, createIfMissing = false) {
15
15
  if (explicitPath) {
16
16
  if (existsSync(explicitPath)) {
17
17
  return { path: resolve(explicitPath), type: "mcp" };
@@ -22,6 +22,25 @@ function findConfigFile(explicitPath) {
22
22
  const full = resolve(searchPath);
23
23
  if (existsSync(full)) return { path: full, type: "mcp" };
24
24
  }
25
+ if (createIfMissing) {
26
+ const starterConfig = {
27
+ mcpServers: {
28
+ "filesystem": {
29
+ command: "npx",
30
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
31
+ },
32
+ "playwright": {
33
+ command: "npx",
34
+ args: ["-y", "@playwright/mcp@latest"]
35
+ }
36
+ }
37
+ };
38
+ const starterPath = resolve(".mcp.json");
39
+ writeFileSync(starterPath, JSON.stringify(starterConfig, null, 2) + "\n");
40
+ console.error(" Created .mcp.json with starter servers (filesystem, playwright).");
41
+ console.error("");
42
+ return { path: starterPath, type: "mcp" };
43
+ }
25
44
  for (const desktopPath of CLAUDE_DESKTOP_PATHS) {
26
45
  if (existsSync(desktopPath)) return { path: desktopPath, type: "claude-desktop" };
27
46
  }
@@ -476,25 +495,10 @@ async function main() {
476
495
  console.error("");
477
496
  console.error(` ${_c.dim}${_c.italic}Init Setup${_c.reset}`);
478
497
  console.error("");
479
- let configInfo = findConfigFile(options.configPath);
498
+ const configInfo = findConfigFile(options.configPath, true);
480
499
  if (!configInfo) {
481
- const starterConfig = {
482
- mcpServers: {
483
- "filesystem": {
484
- command: "npx",
485
- args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
486
- },
487
- "playwright": {
488
- command: "npx",
489
- args: ["-y", "@playwright/mcp@latest"]
490
- }
491
- }
492
- };
493
- const starterPath = resolve(".mcp.json");
494
- writeFileSync(starterPath, JSON.stringify(starterConfig, null, 2) + "\n");
495
- console.error(" No MCP config found \u2014 created .mcp.json with starter servers.");
496
- console.error("");
497
- configInfo = { path: starterPath, type: "mcp" };
500
+ console.error(" No MCP config found and could not create one.");
501
+ process.exit(1);
498
502
  }
499
503
  console.error(` Config: ${configInfo.path}`);
500
504
  console.error(` Type: ${configInfo.type === "claude-desktop" ? "Claude Desktop" : "MCP JSON"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "MCP security proxy — protect any MCP server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {