@solongate/proxy 0.26.3 → 0.27.0

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/init.js CHANGED
@@ -98,10 +98,11 @@ function isAlreadyProtected(server) {
98
98
  }
99
99
  return false;
100
100
  }
101
- function wrapServer(server, policy) {
101
+ function wrapServer(serverName, server, policy) {
102
102
  const env = { ...server.env ?? {} };
103
103
  env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
104
104
  const proxyArgs = ["-y", "@solongate/proxy@latest"];
105
+ proxyArgs.push("--agent-name", serverName);
105
106
  if (policy) {
106
107
  proxyArgs.push("--policy", policy);
107
108
  }
@@ -504,7 +505,7 @@ async function main() {
504
505
  const newConfig = { mcpServers: {} };
505
506
  for (const name of serverNames) {
506
507
  if (toProtect.includes(name)) {
507
- newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], policyValue);
508
+ newConfig.mcpServers[name] = wrapServer(name, config.mcpServers[name], policyValue);
508
509
  } else {
509
510
  newConfig.mcpServers[name] = config.mcpServers[name];
510
511
  }
package/dist/inject.js CHANGED
@@ -163,21 +163,21 @@ function installSdk() {
163
163
  try {
164
164
  const pkg = JSON.parse(readFileSync(resolve("package.json"), "utf-8"));
165
165
  const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
166
- if (allDeps["@solongate/sdk"]) {
167
- log(" @solongate/sdk already installed");
166
+ if (allDeps["@solongate/proxy"]) {
167
+ log(" @solongate/proxy already installed");
168
168
  return true;
169
169
  }
170
170
  } catch {
171
171
  }
172
172
  const pm = detectPackageManager();
173
- const cmd = pm === "yarn" ? "yarn add @solongate/sdk" : `${pm} install @solongate/sdk`;
174
- log(` Installing @solongate/sdk via ${pm}...`);
173
+ const cmd = pm === "yarn" ? "yarn add @solongate/proxy" : `${pm} install @solongate/proxy`;
174
+ log(` Installing @solongate/proxy via ${pm}...`);
175
175
  try {
176
176
  execSync(cmd, { stdio: "pipe", cwd: process.cwd() });
177
177
  return true;
178
178
  } catch (err) {
179
179
  log(` Failed to install: ${err instanceof Error ? err.message : String(err)}`);
180
- log(" You can install manually: npm install @solongate/sdk");
180
+ log(" You can install manually: npm install @solongate/proxy");
181
181
  return false;
182
182
  }
183
183
  }
@@ -204,18 +204,18 @@ function injectTypeScript(filePath) {
204
204
  if (importNames.length === 1 && importNames[0] === "McpServer") {
205
205
  modified = modified.replace(
206
206
  importLine,
207
- `import { SecureMcpServer } from '@solongate/sdk'`
207
+ `import { SecureMcpServer } from '@solongate/proxy'`
208
208
  );
209
- changes.push("Replaced McpServer import with SecureMcpServer from @solongate/sdk");
209
+ changes.push("Replaced McpServer import with SecureMcpServer from @solongate/proxy");
210
210
  } else {
211
211
  const otherImports = importNames.filter((n) => n !== "McpServer");
212
212
  const fromModule = importLine.match(/from\s*['"]([^'"]+)['"]/)?.[1] ?? "";
213
213
  modified = modified.replace(
214
214
  importLine,
215
215
  `import { ${otherImports.join(", ")} } from '${fromModule}';
216
- import { SecureMcpServer } from '@solongate/sdk'`
216
+ import { SecureMcpServer } from '@solongate/proxy'`
217
217
  );
218
- changes.push("Removed McpServer from existing import, added SecureMcpServer import from @solongate/sdk");
218
+ changes.push("Removed McpServer from existing import, added SecureMcpServer import from @solongate/proxy");
219
219
  }
220
220
  importReplaced = true;
221
221
  break;
@@ -223,9 +223,9 @@ import { SecureMcpServer } from '@solongate/sdk'`
223
223
  }
224
224
  if (!importReplaced) {
225
225
  const insertPos = findImportInsertPosition(modified);
226
- modified = modified.slice(0, insertPos) + `import { SecureMcpServer } from '@solongate/sdk';
226
+ modified = modified.slice(0, insertPos) + `import { SecureMcpServer } from '@solongate/proxy';
227
227
  ` + modified.slice(insertPos);
228
- changes.push("Added SecureMcpServer import from @solongate/sdk");
228
+ changes.push("Added SecureMcpServer import from @solongate/proxy");
229
229
  }
230
230
  const constructorPattern = /new\s+McpServer\s*\(/g;
231
231
  const constructorCount = (modified.match(constructorPattern) || []).length;