@solongate/proxy 0.1.17 → 0.1.19
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 +60 -38
- package/dist/init.js +60 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -58,7 +58,10 @@ function wrapServer(server, policy, proxyPath) {
|
|
|
58
58
|
server.command,
|
|
59
59
|
...server.args ?? []
|
|
60
60
|
],
|
|
61
|
-
env:
|
|
61
|
+
env: {
|
|
62
|
+
...server.env,
|
|
63
|
+
SOLONGATE_API_KEY: server.env?.SOLONGATE_API_KEY ?? "sg_live_YOUR_KEY_HERE"
|
|
64
|
+
}
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
67
|
async function prompt(question) {
|
|
@@ -141,6 +144,45 @@ POLICY PRESETS
|
|
|
141
144
|
`;
|
|
142
145
|
console.error(help);
|
|
143
146
|
}
|
|
147
|
+
function ensureEnvFile() {
|
|
148
|
+
const envPath = resolve2(".env");
|
|
149
|
+
if (!existsSync2(envPath)) {
|
|
150
|
+
const envContent = `# SolonGate API Keys
|
|
151
|
+
# Get your keys from the dashboard: https://solongate.com
|
|
152
|
+
# IMPORTANT: Never commit this file to git!
|
|
153
|
+
|
|
154
|
+
# Live key \u2014 enables cloud policy sync + audit logging to dashboard
|
|
155
|
+
SOLONGATE_API_KEY=sg_live_your_key_here
|
|
156
|
+
|
|
157
|
+
# Test key \u2014 local-only, no cloud connection (for development)
|
|
158
|
+
# SOLONGATE_API_KEY=sg_test_your_key_here
|
|
159
|
+
`;
|
|
160
|
+
writeFileSync(envPath, envContent);
|
|
161
|
+
console.error(` Created .env with placeholder API keys`);
|
|
162
|
+
console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
|
|
163
|
+
console.error("");
|
|
164
|
+
}
|
|
165
|
+
const gitignorePath = resolve2(".gitignore");
|
|
166
|
+
if (existsSync2(gitignorePath)) {
|
|
167
|
+
let gitignore = readFileSync2(gitignorePath, "utf-8");
|
|
168
|
+
let updated = false;
|
|
169
|
+
if (!gitignore.includes(".env")) {
|
|
170
|
+
gitignore = gitignore.trimEnd() + "\n.env\n.env.local\n";
|
|
171
|
+
updated = true;
|
|
172
|
+
}
|
|
173
|
+
if (!gitignore.includes(".mcp.json")) {
|
|
174
|
+
gitignore = gitignore.trimEnd() + "\n.mcp.json\n";
|
|
175
|
+
updated = true;
|
|
176
|
+
}
|
|
177
|
+
if (updated) {
|
|
178
|
+
writeFileSync(gitignorePath, gitignore);
|
|
179
|
+
console.error(` Updated .gitignore (added .env + .mcp.json)`);
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
writeFileSync(gitignorePath, ".env\n.env.local\n.mcp.json\nnode_modules/\n");
|
|
183
|
+
console.error(` Created .gitignore (with .env and .mcp.json excluded)`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
144
186
|
async function main() {
|
|
145
187
|
const options = parseInitArgs(process.argv);
|
|
146
188
|
const _c = {
|
|
@@ -176,6 +218,7 @@ async function main() {
|
|
|
176
218
|
console.error(" No MCP config file found.");
|
|
177
219
|
console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
|
|
178
220
|
console.error("");
|
|
221
|
+
ensureEnvFile();
|
|
179
222
|
console.error(" Create a .mcp.json file first, or specify --config <path>");
|
|
180
223
|
process.exit(1);
|
|
181
224
|
}
|
|
@@ -218,6 +261,7 @@ async function main() {
|
|
|
218
261
|
console.error("");
|
|
219
262
|
if (alreadyProtected.length === serverNames.length) {
|
|
220
263
|
console.error(" All servers are already protected by SolonGate!");
|
|
264
|
+
ensureEnvFile();
|
|
221
265
|
process.exit(0);
|
|
222
266
|
}
|
|
223
267
|
if (!options.all) {
|
|
@@ -233,6 +277,7 @@ async function main() {
|
|
|
233
277
|
}
|
|
234
278
|
if (toProtect.length === 0) {
|
|
235
279
|
console.error(" No servers selected for protection.");
|
|
280
|
+
ensureEnvFile();
|
|
236
281
|
process.exit(0);
|
|
237
282
|
}
|
|
238
283
|
console.error("");
|
|
@@ -268,44 +313,21 @@ async function main() {
|
|
|
268
313
|
}
|
|
269
314
|
console.error(" Config updated!");
|
|
270
315
|
console.error("");
|
|
271
|
-
console.error(" \u250C\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\u2510");
|
|
272
|
-
console.error(" \u2502 Your MCP servers are now protected by
|
|
273
|
-
console.error(" \u2502 SolonGate security policies.
|
|
274
|
-
console.error(" \u2502
|
|
275
|
-
console.error(" \u2502
|
|
276
|
-
console.error(" \u2502
|
|
277
|
-
console.error(" \u2502
|
|
278
|
-
console.error(" \u2502
|
|
279
|
-
console.error(" \
|
|
316
|
+
console.error(" \u250C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
317
|
+
console.error(" \u2502 Your MCP servers are now protected by \u2502");
|
|
318
|
+
console.error(" \u2502 SolonGate security policies. \u2502");
|
|
319
|
+
console.error(" \u2502 \u2502");
|
|
320
|
+
console.error(" \u2502 Next steps: \u2502");
|
|
321
|
+
console.error(" \u2502 1. Replace sg_live_YOUR_KEY_HERE in your \u2502");
|
|
322
|
+
console.error(" \u2502 config with your real API key from \u2502");
|
|
323
|
+
console.error(" \u2502 https://solongate.com \u2502");
|
|
324
|
+
console.error(" \u2502 2. Restart your MCP client (Claude Code \u2502");
|
|
325
|
+
console.error(" \u2502 or Claude Desktop) to apply changes. \u2502");
|
|
326
|
+
console.error(" \u2502 \u2502");
|
|
327
|
+
console.error(" \u2502 To undo: solongate-init --restore \u2502");
|
|
328
|
+
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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
280
329
|
console.error("");
|
|
281
|
-
|
|
282
|
-
if (!existsSync2(envPath)) {
|
|
283
|
-
const envContent = `# SolonGate API Keys
|
|
284
|
-
# Get your keys from the dashboard: https://solongate.com
|
|
285
|
-
# IMPORTANT: Never commit this file to git!
|
|
286
|
-
|
|
287
|
-
# Live key \u2014 enables cloud policy sync + audit logging to dashboard
|
|
288
|
-
SOLONGATE_API_KEY=sg_live_your_key_here
|
|
289
|
-
|
|
290
|
-
# Test key \u2014 local-only, no cloud connection (for development)
|
|
291
|
-
# SOLONGATE_API_KEY=sg_test_your_key_here
|
|
292
|
-
`;
|
|
293
|
-
writeFileSync(envPath, envContent);
|
|
294
|
-
console.error(` Created .env with placeholder API keys`);
|
|
295
|
-
console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
|
|
296
|
-
console.error("");
|
|
297
|
-
}
|
|
298
|
-
const gitignorePath = resolve2(".gitignore");
|
|
299
|
-
if (existsSync2(gitignorePath)) {
|
|
300
|
-
const gitignore = readFileSync2(gitignorePath, "utf-8");
|
|
301
|
-
if (!gitignore.includes(".env")) {
|
|
302
|
-
writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
|
|
303
|
-
console.error(` Added .env to .gitignore`);
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
|
|
307
|
-
console.error(` Created .gitignore (with .env excluded)`);
|
|
308
|
-
}
|
|
330
|
+
ensureEnvFile();
|
|
309
331
|
console.error("");
|
|
310
332
|
for (const name of toProtect) {
|
|
311
333
|
console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
|
package/dist/init.js
CHANGED
|
@@ -60,7 +60,10 @@ function wrapServer(server, policy, proxyPath) {
|
|
|
60
60
|
server.command,
|
|
61
61
|
...server.args ?? []
|
|
62
62
|
],
|
|
63
|
-
env:
|
|
63
|
+
env: {
|
|
64
|
+
...server.env,
|
|
65
|
+
SOLONGATE_API_KEY: server.env?.SOLONGATE_API_KEY ?? "sg_live_YOUR_KEY_HERE"
|
|
66
|
+
}
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
69
|
async function prompt(question) {
|
|
@@ -143,6 +146,45 @@ POLICY PRESETS
|
|
|
143
146
|
`;
|
|
144
147
|
console.error(help);
|
|
145
148
|
}
|
|
149
|
+
function ensureEnvFile() {
|
|
150
|
+
const envPath = resolve(".env");
|
|
151
|
+
if (!existsSync(envPath)) {
|
|
152
|
+
const envContent = `# SolonGate API Keys
|
|
153
|
+
# Get your keys from the dashboard: https://solongate.com
|
|
154
|
+
# IMPORTANT: Never commit this file to git!
|
|
155
|
+
|
|
156
|
+
# Live key \u2014 enables cloud policy sync + audit logging to dashboard
|
|
157
|
+
SOLONGATE_API_KEY=sg_live_your_key_here
|
|
158
|
+
|
|
159
|
+
# Test key \u2014 local-only, no cloud connection (for development)
|
|
160
|
+
# SOLONGATE_API_KEY=sg_test_your_key_here
|
|
161
|
+
`;
|
|
162
|
+
writeFileSync(envPath, envContent);
|
|
163
|
+
console.error(` Created .env with placeholder API keys`);
|
|
164
|
+
console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
|
|
165
|
+
console.error("");
|
|
166
|
+
}
|
|
167
|
+
const gitignorePath = resolve(".gitignore");
|
|
168
|
+
if (existsSync(gitignorePath)) {
|
|
169
|
+
let gitignore = readFileSync(gitignorePath, "utf-8");
|
|
170
|
+
let updated = false;
|
|
171
|
+
if (!gitignore.includes(".env")) {
|
|
172
|
+
gitignore = gitignore.trimEnd() + "\n.env\n.env.local\n";
|
|
173
|
+
updated = true;
|
|
174
|
+
}
|
|
175
|
+
if (!gitignore.includes(".mcp.json")) {
|
|
176
|
+
gitignore = gitignore.trimEnd() + "\n.mcp.json\n";
|
|
177
|
+
updated = true;
|
|
178
|
+
}
|
|
179
|
+
if (updated) {
|
|
180
|
+
writeFileSync(gitignorePath, gitignore);
|
|
181
|
+
console.error(` Updated .gitignore (added .env + .mcp.json)`);
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
writeFileSync(gitignorePath, ".env\n.env.local\n.mcp.json\nnode_modules/\n");
|
|
185
|
+
console.error(` Created .gitignore (with .env and .mcp.json excluded)`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
146
188
|
async function main() {
|
|
147
189
|
const options = parseInitArgs(process.argv);
|
|
148
190
|
const _c = {
|
|
@@ -178,6 +220,7 @@ async function main() {
|
|
|
178
220
|
console.error(" No MCP config file found.");
|
|
179
221
|
console.error(" Searched: .mcp.json, mcp.json, Claude Desktop config");
|
|
180
222
|
console.error("");
|
|
223
|
+
ensureEnvFile();
|
|
181
224
|
console.error(" Create a .mcp.json file first, or specify --config <path>");
|
|
182
225
|
process.exit(1);
|
|
183
226
|
}
|
|
@@ -220,6 +263,7 @@ async function main() {
|
|
|
220
263
|
console.error("");
|
|
221
264
|
if (alreadyProtected.length === serverNames.length) {
|
|
222
265
|
console.error(" All servers are already protected by SolonGate!");
|
|
266
|
+
ensureEnvFile();
|
|
223
267
|
process.exit(0);
|
|
224
268
|
}
|
|
225
269
|
if (!options.all) {
|
|
@@ -235,6 +279,7 @@ async function main() {
|
|
|
235
279
|
}
|
|
236
280
|
if (toProtect.length === 0) {
|
|
237
281
|
console.error(" No servers selected for protection.");
|
|
282
|
+
ensureEnvFile();
|
|
238
283
|
process.exit(0);
|
|
239
284
|
}
|
|
240
285
|
console.error("");
|
|
@@ -270,44 +315,21 @@ async function main() {
|
|
|
270
315
|
}
|
|
271
316
|
console.error(" Config updated!");
|
|
272
317
|
console.error("");
|
|
273
|
-
console.error(" \u250C\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\u2510");
|
|
274
|
-
console.error(" \u2502 Your MCP servers are now protected by
|
|
275
|
-
console.error(" \u2502 SolonGate security policies.
|
|
276
|
-
console.error(" \u2502
|
|
277
|
-
console.error(" \u2502
|
|
278
|
-
console.error(" \u2502
|
|
279
|
-
console.error(" \u2502
|
|
280
|
-
console.error(" \u2502
|
|
281
|
-
console.error(" \
|
|
318
|
+
console.error(" \u250C\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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
319
|
+
console.error(" \u2502 Your MCP servers are now protected by \u2502");
|
|
320
|
+
console.error(" \u2502 SolonGate security policies. \u2502");
|
|
321
|
+
console.error(" \u2502 \u2502");
|
|
322
|
+
console.error(" \u2502 Next steps: \u2502");
|
|
323
|
+
console.error(" \u2502 1. Replace sg_live_YOUR_KEY_HERE in your \u2502");
|
|
324
|
+
console.error(" \u2502 config with your real API key from \u2502");
|
|
325
|
+
console.error(" \u2502 https://solongate.com \u2502");
|
|
326
|
+
console.error(" \u2502 2. Restart your MCP client (Claude Code \u2502");
|
|
327
|
+
console.error(" \u2502 or Claude Desktop) to apply changes. \u2502");
|
|
328
|
+
console.error(" \u2502 \u2502");
|
|
329
|
+
console.error(" \u2502 To undo: solongate-init --restore \u2502");
|
|
330
|
+
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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
282
331
|
console.error("");
|
|
283
|
-
|
|
284
|
-
if (!existsSync(envPath)) {
|
|
285
|
-
const envContent = `# SolonGate API Keys
|
|
286
|
-
# Get your keys from the dashboard: https://solongate.com
|
|
287
|
-
# IMPORTANT: Never commit this file to git!
|
|
288
|
-
|
|
289
|
-
# Live key \u2014 enables cloud policy sync + audit logging to dashboard
|
|
290
|
-
SOLONGATE_API_KEY=sg_live_your_key_here
|
|
291
|
-
|
|
292
|
-
# Test key \u2014 local-only, no cloud connection (for development)
|
|
293
|
-
# SOLONGATE_API_KEY=sg_test_your_key_here
|
|
294
|
-
`;
|
|
295
|
-
writeFileSync(envPath, envContent);
|
|
296
|
-
console.error(` Created .env with placeholder API keys`);
|
|
297
|
-
console.error(` \u2192 Edit .env and replace with your real keys from https://solongate.com`);
|
|
298
|
-
console.error("");
|
|
299
|
-
}
|
|
300
|
-
const gitignorePath = resolve(".gitignore");
|
|
301
|
-
if (existsSync(gitignorePath)) {
|
|
302
|
-
const gitignore = readFileSync(gitignorePath, "utf-8");
|
|
303
|
-
if (!gitignore.includes(".env")) {
|
|
304
|
-
writeFileSync(gitignorePath, gitignore.trimEnd() + "\n.env\n.env.local\n");
|
|
305
|
-
console.error(` Added .env to .gitignore`);
|
|
306
|
-
}
|
|
307
|
-
} else {
|
|
308
|
-
writeFileSync(gitignorePath, ".env\n.env.local\nnode_modules/\n");
|
|
309
|
-
console.error(` Created .gitignore (with .env excluded)`);
|
|
310
|
-
}
|
|
332
|
+
ensureEnvFile();
|
|
311
333
|
console.error("");
|
|
312
334
|
for (const name of toProtect) {
|
|
313
335
|
console.error(` \u2713 ${name} \u2014 protected (${options.policy})`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
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": {
|