@solongate/proxy 0.1.16 → 0.1.18

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/dist/index.js CHANGED
@@ -141,6 +141,36 @@ POLICY PRESETS
141
141
  `;
142
142
  console.error(help);
143
143
  }
144
+ function ensureEnvFile() {
145
+ const envPath = resolve2(".env");
146
+ if (!existsSync2(envPath)) {
147
+ const envContent = `# SolonGate API Keys
148
+ # Get your keys from the dashboard: https://solongate.com
149
+ # IMPORTANT: Never commit this file to git!
150
+
151
+ # Live key \u2014 enables cloud policy sync + audit logging to dashboard
152
+ SOLONGATE_API_KEY=sg_live_your_key_here
153
+
154
+ # Test key \u2014 local-only, no cloud connection (for development)
155
+ # SOLONGATE_API_KEY=sg_test_your_key_here
156
+ `;
157
+ writeFileSync(envPath, envContent);
158
+ console.error(` Created .env with placeholder API keys`);
159
+ console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
160
+ console.error("");
161
+ }
162
+ const gitignorePath = resolve2(".gitignore");
163
+ if (existsSync2(gitignorePath)) {
164
+ const gitignore = readFileSync2(gitignorePath, "utf-8");
165
+ if (!gitignore.includes(".env")) {
166
+ writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
167
+ console.error(` Added .env to .gitignore`);
168
+ }
169
+ } else {
170
+ writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
171
+ console.error(` Created .gitignore (with .env excluded)`);
172
+ }
173
+ }
144
174
  async function main() {
145
175
  const options = parseInitArgs(process.argv);
146
176
  const _c = {
@@ -176,6 +206,7 @@ async function main() {
176
206
  console.error(" No MCP config file found.");
177
207
  console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
178
208
  console.error("");
209
+ ensureEnvFile();
179
210
  console.error(" Create a .mcp.json file first, or specify --config <path>");
180
211
  process.exit(1);
181
212
  }
@@ -218,6 +249,7 @@ async function main() {
218
249
  console.error("");
219
250
  if (alreadyProtected.length === serverNames.length) {
220
251
  console.error(" All servers are already protected by SolonGate!");
252
+ ensureEnvFile();
221
253
  process.exit(0);
222
254
  }
223
255
  if (!options.all) {
@@ -233,6 +265,7 @@ async function main() {
233
265
  }
234
266
  if (toProtect.length === 0) {
235
267
  console.error(" No servers selected for protection.");
268
+ ensureEnvFile();
236
269
  process.exit(0);
237
270
  }
238
271
  console.error("");
@@ -278,6 +311,8 @@ async function main() {
278
311
  console.error(" \u2502 To undo: solongate-init --restore \u2502");
279
312
  console.error(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
280
313
  console.error("");
314
+ ensureEnvFile();
315
+ console.error("");
281
316
  for (const name of toProtect) {
282
317
  console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
283
318
  }
package/dist/init.js CHANGED
@@ -143,6 +143,36 @@ POLICY PRESETS
143
143
  `;
144
144
  console.error(help);
145
145
  }
146
+ function ensureEnvFile() {
147
+ const envPath = resolve(".env");
148
+ if (!existsSync(envPath)) {
149
+ const envContent = `# SolonGate API Keys
150
+ # Get your keys from the dashboard: https://solongate.com
151
+ # IMPORTANT: Never commit this file to git!
152
+
153
+ # Live key \u2014 enables cloud policy sync + audit logging to dashboard
154
+ SOLONGATE_API_KEY=sg_live_your_key_here
155
+
156
+ # Test key \u2014 local-only, no cloud connection (for development)
157
+ # SOLONGATE_API_KEY=sg_test_your_key_here
158
+ `;
159
+ writeFileSync(envPath, envContent);
160
+ console.error(` Created .env with placeholder API keys`);
161
+ console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
162
+ console.error("");
163
+ }
164
+ const gitignorePath = resolve(".gitignore");
165
+ if (existsSync(gitignorePath)) {
166
+ const gitignore = readFileSync(gitignorePath, "utf-8");
167
+ if (!gitignore.includes(".env")) {
168
+ writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
169
+ console.error(` Added .env to .gitignore`);
170
+ }
171
+ } else {
172
+ writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
173
+ console.error(` Created .gitignore (with .env excluded)`);
174
+ }
175
+ }
146
176
  async function main() {
147
177
  const options = parseInitArgs(process.argv);
148
178
  const _c = {
@@ -178,6 +208,7 @@ async function main() {
178
208
  console.error(" No MCP config file found.");
179
209
  console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
180
210
  console.error("");
211
+ ensureEnvFile();
181
212
  console.error(" Create a .mcp.json file first, or specify --config <path>");
182
213
  process.exit(1);
183
214
  }
@@ -220,6 +251,7 @@ async function main() {
220
251
  console.error("");
221
252
  if (alreadyProtected.length === serverNames.length) {
222
253
  console.error(" All servers are already protected by SolonGate!");
254
+ ensureEnvFile();
223
255
  process.exit(0);
224
256
  }
225
257
  if (!options.all) {
@@ -235,6 +267,7 @@ async function main() {
235
267
  }
236
268
  if (toProtect.length === 0) {
237
269
  console.error(" No servers selected for protection.");
270
+ ensureEnvFile();
238
271
  process.exit(0);
239
272
  }
240
273
  console.error("");
@@ -280,6 +313,8 @@ async function main() {
280
313
  console.error(" \u2502 To undo: solongate-init --restore \u2502");
281
314
  console.error(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
282
315
  console.error("");
316
+ ensureEnvFile();
317
+ console.error("");
283
318
  for (const name of toProtect) {
284
319
  console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
285
320
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.1.16",
4
- "description": "MCP security proxy protect any MCP server with policies, input validation, rate limiting, and audit logging. Zero code changes required.",
3
+ "version": "0.1.18",
4
+ "description": "MCP security proxy \u00e2\u20ac\u201d protect any MCP server with policies, input validation, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "solongate-proxy": "./dist/index.js",