@hasna/connectors 0.5.6 → 0.5.7

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/bin/index.js CHANGED
@@ -7185,6 +7185,39 @@ function resolveConnectorsDir2() {
7185
7185
  return fromBin;
7186
7186
  }
7187
7187
  var CONNECTORS_DIR2 = resolveConnectorsDir2();
7188
+ var ENV_VAR_NAME_OVERRIDES = {
7189
+ googlemaps: ["GOOGLE_MAPS"],
7190
+ googletasks: ["GOOGLE_TASKS", "GOOGLE"],
7191
+ google: ["GOOGLE"],
7192
+ stabilityai: ["STABILITY"],
7193
+ openweathermap: ["OPENWEATHERMAP", "OPENWEATHER"]
7194
+ };
7195
+ function buildEnvWithCredentials(connectorName, baseEnv) {
7196
+ const env = { ...baseEnv };
7197
+ const prefixes = ENV_VAR_NAME_OVERRIDES[connectorName] || [
7198
+ connectorName.toUpperCase().replace(/-/g, "_")
7199
+ ];
7200
+ for (const prefix of prefixes) {
7201
+ const canonicalKey = `${prefix}_API_KEY`;
7202
+ if (env[canonicalKey])
7203
+ continue;
7204
+ const alternatives = [
7205
+ `HASNAXYZ_${prefix}_LIVE_API_KEY`,
7206
+ `HASNA_${prefix}_LIVE_API_KEY`,
7207
+ `${prefix}_LIVE_API_KEY`,
7208
+ `${prefix}_KEY`,
7209
+ `${prefix}_TOKEN`
7210
+ ];
7211
+ for (const alt of alternatives) {
7212
+ const value = env[alt];
7213
+ if (value) {
7214
+ env[canonicalKey] = value;
7215
+ break;
7216
+ }
7217
+ }
7218
+ }
7219
+ return env;
7220
+ }
7188
7221
  function getConnectorCliPath(name) {
7189
7222
  const safeName = name.replace(/[^a-z0-9-]/g, "");
7190
7223
  const connectorDir = join4(CONNECTORS_DIR2, `connect-${safeName}`);
@@ -7206,7 +7239,7 @@ function runConnectorCommand(name, args, timeoutMs = 30000) {
7206
7239
  return new Promise((resolve) => {
7207
7240
  const proc = spawn("bun", ["run", cliPath, ...args], {
7208
7241
  timeout: timeoutMs,
7209
- env: { ...process.env },
7242
+ env: buildEnvWithCredentials(name, process.env),
7210
7243
  stdio: ["pipe", "pipe", "pipe"]
7211
7244
  });
7212
7245
  let stdout = "";
@@ -7281,7 +7314,7 @@ var PRESETS = {
7281
7314
  commerce: { description: "Commerce and finance", connectors: ["stripe", "shopify", "revolut", "mercury", "pandadoc"] }
7282
7315
  };
7283
7316
  var program2 = new Command;
7284
- program2.name("connectors").description("Install API connectors for your project").version("0.5.6").enablePositionalOptions();
7317
+ program2.name("connectors").description("Install API connectors for your project").version("0.5.7").enablePositionalOptions();
7285
7318
  program2.command("interactive", { isDefault: true }).alias("i").description("Interactive connector browser").action(() => {
7286
7319
  if (!isTTY) {
7287
7320
  console.log(`Non-interactive environment detected. Use a subcommand:
package/bin/mcp.js CHANGED
@@ -20676,6 +20676,39 @@ function resolveConnectorsDir2() {
20676
20676
  return fromBin;
20677
20677
  }
20678
20678
  var CONNECTORS_DIR2 = resolveConnectorsDir2();
20679
+ var ENV_VAR_NAME_OVERRIDES = {
20680
+ googlemaps: ["GOOGLE_MAPS"],
20681
+ googletasks: ["GOOGLE_TASKS", "GOOGLE"],
20682
+ google: ["GOOGLE"],
20683
+ stabilityai: ["STABILITY"],
20684
+ openweathermap: ["OPENWEATHERMAP", "OPENWEATHER"]
20685
+ };
20686
+ function buildEnvWithCredentials(connectorName, baseEnv) {
20687
+ const env = { ...baseEnv };
20688
+ const prefixes = ENV_VAR_NAME_OVERRIDES[connectorName] || [
20689
+ connectorName.toUpperCase().replace(/-/g, "_")
20690
+ ];
20691
+ for (const prefix of prefixes) {
20692
+ const canonicalKey = `${prefix}_API_KEY`;
20693
+ if (env[canonicalKey])
20694
+ continue;
20695
+ const alternatives = [
20696
+ `HASNAXYZ_${prefix}_LIVE_API_KEY`,
20697
+ `HASNA_${prefix}_LIVE_API_KEY`,
20698
+ `${prefix}_LIVE_API_KEY`,
20699
+ `${prefix}_KEY`,
20700
+ `${prefix}_TOKEN`
20701
+ ];
20702
+ for (const alt of alternatives) {
20703
+ const value = env[alt];
20704
+ if (value) {
20705
+ env[canonicalKey] = value;
20706
+ break;
20707
+ }
20708
+ }
20709
+ }
20710
+ return env;
20711
+ }
20679
20712
  function getConnectorCliPath(name) {
20680
20713
  const safeName = name.replace(/[^a-z0-9-]/g, "");
20681
20714
  const connectorDir = join4(CONNECTORS_DIR2, `connect-${safeName}`);
@@ -20697,7 +20730,7 @@ function runConnectorCommand(name, args, timeoutMs = 30000) {
20697
20730
  return new Promise((resolve) => {
20698
20731
  const proc = spawn("bun", ["run", cliPath, ...args], {
20699
20732
  timeout: timeoutMs,
20700
- env: { ...process.env },
20733
+ env: buildEnvWithCredentials(name, process.env),
20701
20734
  stdio: ["pipe", "pipe", "pipe"]
20702
20735
  });
20703
20736
  let stdout = "";
@@ -20763,7 +20796,7 @@ async function getConnectorCommandHelp(name, command) {
20763
20796
  loadConnectorVersions();
20764
20797
  var server = new McpServer({
20765
20798
  name: "connectors",
20766
- version: "0.5.6"
20799
+ version: "0.5.7"
20767
20800
  });
20768
20801
  server.registerTool("search_connectors", {
20769
20802
  title: "Search Connectors",
package/dist/index.js CHANGED
@@ -1103,6 +1103,39 @@ function resolveConnectorsDir2() {
1103
1103
  return fromBin;
1104
1104
  }
1105
1105
  var CONNECTORS_DIR2 = resolveConnectorsDir2();
1106
+ var ENV_VAR_NAME_OVERRIDES = {
1107
+ googlemaps: ["GOOGLE_MAPS"],
1108
+ googletasks: ["GOOGLE_TASKS", "GOOGLE"],
1109
+ google: ["GOOGLE"],
1110
+ stabilityai: ["STABILITY"],
1111
+ openweathermap: ["OPENWEATHERMAP", "OPENWEATHER"]
1112
+ };
1113
+ function buildEnvWithCredentials(connectorName, baseEnv) {
1114
+ const env = { ...baseEnv };
1115
+ const prefixes = ENV_VAR_NAME_OVERRIDES[connectorName] || [
1116
+ connectorName.toUpperCase().replace(/-/g, "_")
1117
+ ];
1118
+ for (const prefix of prefixes) {
1119
+ const canonicalKey = `${prefix}_API_KEY`;
1120
+ if (env[canonicalKey])
1121
+ continue;
1122
+ const alternatives = [
1123
+ `HASNAXYZ_${prefix}_LIVE_API_KEY`,
1124
+ `HASNA_${prefix}_LIVE_API_KEY`,
1125
+ `${prefix}_LIVE_API_KEY`,
1126
+ `${prefix}_KEY`,
1127
+ `${prefix}_TOKEN`
1128
+ ];
1129
+ for (const alt of alternatives) {
1130
+ const value = env[alt];
1131
+ if (value) {
1132
+ env[canonicalKey] = value;
1133
+ break;
1134
+ }
1135
+ }
1136
+ }
1137
+ return env;
1138
+ }
1106
1139
  function getConnectorCliPath(name) {
1107
1140
  const safeName = name.replace(/[^a-z0-9-]/g, "");
1108
1141
  const connectorDir = join3(CONNECTORS_DIR2, `connect-${safeName}`);
@@ -1124,7 +1157,7 @@ function runConnectorCommand(name, args, timeoutMs = 30000) {
1124
1157
  return new Promise((resolve) => {
1125
1158
  const proc = spawn("bun", ["run", cliPath, ...args], {
1126
1159
  timeout: timeoutMs,
1127
- env: { ...process.env },
1160
+ env: buildEnvWithCredentials(name, process.env),
1128
1161
  stdio: ["pipe", "pipe", "pipe"]
1129
1162
  });
1130
1163
  let stdout = "";
@@ -6,6 +6,22 @@
6
6
  * them as subprocesses and capture stdout/stderr. This keeps the main CLI/MCP
7
7
  * lightweight while exposing every connector's full API.
8
8
  */
9
+ /**
10
+ * Build the subprocess env with auto-detected credentials.
11
+ *
12
+ * For each connector we derive the "canonical" env var (e.g. EXA_API_KEY)
13
+ * and, if it's not already set, check common alternative patterns from the
14
+ * user's environment. When a match is found we inject it so the connector
15
+ * subprocess can read it.
16
+ *
17
+ * Patterns checked (in priority order):
18
+ * 1. HASNAXYZ_{NAME}_LIVE_API_KEY → {NAME}_API_KEY
19
+ * 2. HASNA_{NAME}_LIVE_API_KEY → {NAME}_API_KEY
20
+ * 3. {NAME}_LIVE_API_KEY → {NAME}_API_KEY
21
+ * 4. {NAME}_KEY → {NAME}_API_KEY
22
+ * 5. {NAME}_TOKEN → {NAME}_API_KEY
23
+ */
24
+ export declare function buildEnvWithCredentials(connectorName: string, baseEnv: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
9
25
  /**
10
26
  * Get the path to a connector's CLI entry point.
11
27
  * Returns null if the connector has no CLI.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {