@hasna/connectors 0.5.5 → 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 +61 -15
- package/bin/mcp.js +44 -11
- package/dist/index.js +34 -1
- package/dist/lib/runner.d.ts +16 -0
- package/package.json +1 -1
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:
|
|
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.
|
|
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:
|
|
@@ -7646,10 +7679,11 @@ program2.command("info").argument("<connector>", "Connector name").option("--jso
|
|
|
7646
7679
|
const meta = getConnector(connector);
|
|
7647
7680
|
if (!meta) {
|
|
7648
7681
|
if (options.json) {
|
|
7649
|
-
console.log(JSON.stringify({ error: `Connector '${connector}' not found
|
|
7682
|
+
console.log(JSON.stringify({ error: `Connector '${connector}' not found. Run 'connectors list' to see available connectors.` }));
|
|
7650
7683
|
process.exit(1);
|
|
7651
7684
|
}
|
|
7652
7685
|
console.log(chalk2.red(`Connector '${connector}' not found`));
|
|
7686
|
+
console.log(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${connector}' to search.`));
|
|
7653
7687
|
process.exit(1);
|
|
7654
7688
|
return;
|
|
7655
7689
|
}
|
|
@@ -7674,9 +7708,10 @@ program2.command("docs").argument("<connector>", "Connector name").option("--jso
|
|
|
7674
7708
|
const meta = getConnector(connector);
|
|
7675
7709
|
if (!meta) {
|
|
7676
7710
|
if (options.json) {
|
|
7677
|
-
console.log(JSON.stringify({ error: `Connector '${connector}' not found
|
|
7711
|
+
console.log(JSON.stringify({ error: `Connector '${connector}' not found. Run 'connectors list' to see available connectors.` }));
|
|
7678
7712
|
} else {
|
|
7679
7713
|
console.log(chalk2.red(`Connector '${connector}' not found`));
|
|
7714
|
+
console.log(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${connector}' to search.`));
|
|
7680
7715
|
}
|
|
7681
7716
|
process.exit(1);
|
|
7682
7717
|
return;
|
|
@@ -7684,9 +7719,10 @@ program2.command("docs").argument("<connector>", "Connector name").option("--jso
|
|
|
7684
7719
|
const docs = getConnectorDocs(connector);
|
|
7685
7720
|
if (!docs) {
|
|
7686
7721
|
if (options.json) {
|
|
7687
|
-
console.log(JSON.stringify({ error: `No documentation found for '${connector}'
|
|
7722
|
+
console.log(JSON.stringify({ error: `No documentation found for '${connector}'. The connector may not be installed yet. Run 'connectors install ${connector}' first.` }));
|
|
7688
7723
|
} else {
|
|
7689
7724
|
console.log(chalk2.red(`No documentation found for '${connector}'`));
|
|
7725
|
+
console.log(chalk2.dim(`The connector may not be installed yet. Run 'connectors install ${connector}' first.`));
|
|
7690
7726
|
}
|
|
7691
7727
|
process.exit(1);
|
|
7692
7728
|
return;
|
|
@@ -7763,6 +7799,7 @@ program2.command("remove").alias("rm").argument("<connector>", "Connector to rem
|
|
|
7763
7799
|
console.log(chalk2.green(`\u2713 Removed ${connector}`));
|
|
7764
7800
|
} else {
|
|
7765
7801
|
console.log(chalk2.red(`\u2717 ${connector} is not installed`));
|
|
7802
|
+
console.log(chalk2.dim(`Run 'connectors install ${connector}' to install it, or 'connectors list --installed' to see installed connectors.`));
|
|
7766
7803
|
process.exit(1);
|
|
7767
7804
|
}
|
|
7768
7805
|
});
|
|
@@ -7814,7 +7851,7 @@ program2.command("update").argument("[connectors...]", "Specific connectors to u
|
|
|
7814
7851
|
console.log(JSON.stringify({ error: `Not installed: ${notInstalled.join(", ")}` }));
|
|
7815
7852
|
} else {
|
|
7816
7853
|
console.log(chalk2.red(`Not installed: ${notInstalled.join(", ")}`));
|
|
7817
|
-
console.log(chalk2.dim(
|
|
7854
|
+
console.log(chalk2.dim(`Run 'connectors install ${notInstalled[0]}' to install, or 'connectors list --installed' to see installed connectors.`));
|
|
7818
7855
|
}
|
|
7819
7856
|
process.exit(1);
|
|
7820
7857
|
return;
|
|
@@ -8130,9 +8167,10 @@ program2.command("auth").argument("<connector>", "Connector name to configure au
|
|
|
8130
8167
|
const meta = getConnector(connector);
|
|
8131
8168
|
if (!meta) {
|
|
8132
8169
|
if (options.json) {
|
|
8133
|
-
console.log(JSON.stringify({ error: `Connector '${connector}' not found
|
|
8170
|
+
console.log(JSON.stringify({ error: `Connector '${connector}' not found. Run 'connectors list' to see available connectors.` }));
|
|
8134
8171
|
} else {
|
|
8135
8172
|
console.log(chalk2.red(`Connector '${connector}' not found`));
|
|
8173
|
+
console.log(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${connector}' to search.`));
|
|
8136
8174
|
}
|
|
8137
8175
|
process.exit(1);
|
|
8138
8176
|
return;
|
|
@@ -9036,9 +9074,10 @@ program2.command("test").argument("[connector]", "Connector to test (default: al
|
|
|
9036
9074
|
if (connector) {
|
|
9037
9075
|
if (!getConnector(connector)) {
|
|
9038
9076
|
if (options.json) {
|
|
9039
|
-
console.log(JSON.stringify({ error: `Connector '${connector}' not found
|
|
9077
|
+
console.log(JSON.stringify({ error: `Connector '${connector}' not found. Run 'connectors list' to see available connectors.` }));
|
|
9040
9078
|
} else {
|
|
9041
9079
|
console.log(chalk2.red(`Connector '${connector}' not found`));
|
|
9080
|
+
console.log(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${connector}' to search.`));
|
|
9042
9081
|
}
|
|
9043
9082
|
process.exit(1);
|
|
9044
9083
|
return;
|
|
@@ -9064,15 +9103,15 @@ Testing connector credentials...
|
|
|
9064
9103
|
const auth = getAuthStatus(name);
|
|
9065
9104
|
const endpoint = TEST_ENDPOINTS[name];
|
|
9066
9105
|
if (!auth.configured) {
|
|
9067
|
-
results.push({ name, status: "no-key", message:
|
|
9106
|
+
results.push({ name, status: "no-key", message: `No credentials configured. Run 'connectors auth ${name}' or 'connectors setup ${name} --key <your-key>'` });
|
|
9068
9107
|
if (!options.json)
|
|
9069
|
-
console.log(` ${chalk2.dim("\u25CB")} ${chalk2.dim(name)} \u2014 ${chalk2.dim(
|
|
9108
|
+
console.log(` ${chalk2.dim("\u25CB")} ${chalk2.dim(name)} \u2014 ${chalk2.dim(`no credentials configured \u2014 run 'connectors auth ${name}'`)}`);
|
|
9070
9109
|
continue;
|
|
9071
9110
|
}
|
|
9072
9111
|
if (!endpoint) {
|
|
9073
|
-
results.push({ name, status: "skip", message:
|
|
9112
|
+
results.push({ name, status: "skip", message: `No test endpoint defined. Run 'connectors ops ${name}' to see available operations` });
|
|
9074
9113
|
if (!options.json)
|
|
9075
|
-
console.log(` ${chalk2.dim("\u25CB")} ${chalk2.dim(name)} \u2014 ${chalk2.dim(
|
|
9114
|
+
console.log(` ${chalk2.dim("\u25CB")} ${chalk2.dim(name)} \u2014 ${chalk2.dim(`no test endpoint \u2014 run 'connectors ops ${name}' to see operations`)}`);
|
|
9076
9115
|
continue;
|
|
9077
9116
|
}
|
|
9078
9117
|
const docs = getConnectorDocs(name);
|
|
@@ -9165,10 +9204,12 @@ Testing connector credentials...
|
|
|
9165
9204
|
console.log(` ${chalk2.green("\u2713")} ${chalk2.green(name)} \u2014 ${chalk2.dim(`${res.status} OK`)} ${chalk2.dim(`(${ms}ms)`)}`);
|
|
9166
9205
|
} else {
|
|
9167
9206
|
const body2 = await res.text().catch(() => "");
|
|
9168
|
-
const msg = res.status === 401 ?
|
|
9207
|
+
const msg = res.status === 401 ? `Invalid or expired credentials. Run 'connectors auth ${name}' to reconfigure` : `HTTP ${res.status}`;
|
|
9169
9208
|
results.push({ name, status: "fail", message: msg, ms });
|
|
9170
9209
|
if (!options.json)
|
|
9171
|
-
console.log(` ${chalk2.red("\u2717")} ${chalk2.red(name)} \u2014 ${chalk2.red(
|
|
9210
|
+
console.log(` ${chalk2.red("\u2717")} ${chalk2.red(name)} \u2014 ${chalk2.red(res.status === 401 ? "Invalid or expired credentials" : `HTTP ${res.status}`)} ${chalk2.dim(`(${ms}ms)`)}`);
|
|
9211
|
+
if (!options.json && res.status === 401)
|
|
9212
|
+
console.log(chalk2.dim(` \u2192 Run 'connectors auth ${name}' to reconfigure credentials`));
|
|
9172
9213
|
}
|
|
9173
9214
|
} catch (e) {
|
|
9174
9215
|
const ms = Date.now() - start;
|
|
@@ -9201,10 +9242,12 @@ program2.command("ops").description("List available API operations for a connect
|
|
|
9201
9242
|
const meta = getConnector(name);
|
|
9202
9243
|
if (!meta) {
|
|
9203
9244
|
console.error(chalk2.red(`Connector '${name}' not found.`));
|
|
9245
|
+
console.error(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${name}' to search.`));
|
|
9204
9246
|
process.exit(1);
|
|
9205
9247
|
}
|
|
9206
9248
|
if (!getConnectorCliPath(name)) {
|
|
9207
9249
|
console.error(chalk2.red(`Connector '${name}' does not have a CLI.`));
|
|
9250
|
+
console.error(chalk2.dim(`Run 'connectors docs ${name}' to see how to use this connector programmatically.`));
|
|
9208
9251
|
process.exit(1);
|
|
9209
9252
|
}
|
|
9210
9253
|
if (command) {
|
|
@@ -9247,10 +9290,12 @@ program2.command("run").description("Execute an API operation on a connector").a
|
|
|
9247
9290
|
const meta = getConnector(name);
|
|
9248
9291
|
if (!meta) {
|
|
9249
9292
|
console.error(chalk2.red(`Connector '${name}' not found.`));
|
|
9293
|
+
console.error(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${name}' to search.`));
|
|
9250
9294
|
process.exit(1);
|
|
9251
9295
|
}
|
|
9252
9296
|
if (!getConnectorCliPath(name)) {
|
|
9253
9297
|
console.error(chalk2.red(`Connector '${name}' does not have a CLI.`));
|
|
9298
|
+
console.error(chalk2.dim(`Run 'connectors docs ${name}' to see how to use this connector programmatically.`));
|
|
9254
9299
|
process.exit(1);
|
|
9255
9300
|
}
|
|
9256
9301
|
if (args.length === 0) {
|
|
@@ -9270,9 +9315,10 @@ program2.command("setup").argument("<name>", "Connector name to set up").option(
|
|
|
9270
9315
|
const meta = getConnector(name);
|
|
9271
9316
|
if (!meta) {
|
|
9272
9317
|
if (options.json) {
|
|
9273
|
-
console.log(JSON.stringify({ error: `Connector '${name}' not found
|
|
9318
|
+
console.log(JSON.stringify({ error: `Connector '${name}' not found. Run 'connectors list' to see available connectors.` }));
|
|
9274
9319
|
} else {
|
|
9275
9320
|
console.log(chalk2.red(`Connector '${name}' not found`));
|
|
9321
|
+
console.log(chalk2.dim(`Run 'connectors list' to see available connectors, or 'connectors search ${name}' to search.`));
|
|
9276
9322
|
}
|
|
9277
9323
|
process.exit(1);
|
|
9278
9324
|
return;
|
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:
|
|
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.
|
|
20799
|
+
version: "0.5.7"
|
|
20767
20800
|
});
|
|
20768
20801
|
server.registerTool("search_connectors", {
|
|
20769
20802
|
title: "Search Connectors",
|
|
@@ -20802,7 +20835,7 @@ server.registerTool("list_connectors", {
|
|
|
20802
20835
|
content: [
|
|
20803
20836
|
{
|
|
20804
20837
|
type: "text",
|
|
20805
|
-
text: `Unknown category: "${category}".
|
|
20838
|
+
text: `Unknown category: "${category}". Use list_categories to see available categories: ${CATEGORIES.join(", ")}`
|
|
20806
20839
|
}
|
|
20807
20840
|
],
|
|
20808
20841
|
isError: true
|
|
@@ -20832,14 +20865,14 @@ server.registerTool("connector_docs", {
|
|
|
20832
20865
|
const meta = getConnector(name);
|
|
20833
20866
|
if (!meta) {
|
|
20834
20867
|
return {
|
|
20835
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
20868
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
20836
20869
|
isError: true
|
|
20837
20870
|
};
|
|
20838
20871
|
}
|
|
20839
20872
|
const docs = getConnectorDocs(name);
|
|
20840
20873
|
if (!docs) {
|
|
20841
20874
|
return {
|
|
20842
|
-
content: [{ type: "text", text: `No documentation found for '${name}'.` }],
|
|
20875
|
+
content: [{ type: "text", text: `No documentation found for '${name}'. Use install_connector to install it first.` }],
|
|
20843
20876
|
isError: true
|
|
20844
20877
|
};
|
|
20845
20878
|
}
|
|
@@ -20921,7 +20954,7 @@ server.registerTool("connector_info", {
|
|
|
20921
20954
|
const meta = getConnector(name);
|
|
20922
20955
|
if (!meta) {
|
|
20923
20956
|
return {
|
|
20924
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
20957
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
20925
20958
|
isError: true
|
|
20926
20959
|
};
|
|
20927
20960
|
}
|
|
@@ -20944,7 +20977,7 @@ server.registerTool("connector_auth_status", {
|
|
|
20944
20977
|
const meta = getConnector(name);
|
|
20945
20978
|
if (!meta) {
|
|
20946
20979
|
return {
|
|
20947
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
20980
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
20948
20981
|
isError: true
|
|
20949
20982
|
};
|
|
20950
20983
|
}
|
|
@@ -21022,7 +21055,7 @@ server.registerTool("list_connector_operations", {
|
|
|
21022
21055
|
const meta = getConnector(name);
|
|
21023
21056
|
if (!meta) {
|
|
21024
21057
|
return {
|
|
21025
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
21058
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
21026
21059
|
isError: true
|
|
21027
21060
|
};
|
|
21028
21061
|
}
|
|
@@ -21031,7 +21064,7 @@ server.registerTool("list_connector_operations", {
|
|
|
21031
21064
|
content: [
|
|
21032
21065
|
{
|
|
21033
21066
|
type: "text",
|
|
21034
|
-
text: `Connector '${name}' does not have a CLI. It may be API-only.`
|
|
21067
|
+
text: `Connector '${name}' does not have a CLI. It may be API-only. Use connector_docs to see how to use it programmatically.`
|
|
21035
21068
|
}
|
|
21036
21069
|
],
|
|
21037
21070
|
isError: true
|
|
@@ -21076,7 +21109,7 @@ server.registerTool("run_connector_operation", {
|
|
|
21076
21109
|
const meta = getConnector(name);
|
|
21077
21110
|
if (!meta) {
|
|
21078
21111
|
return {
|
|
21079
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
21112
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
21080
21113
|
isError: true
|
|
21081
21114
|
};
|
|
21082
21115
|
}
|
|
@@ -21132,7 +21165,7 @@ server.registerTool("setup_connector", {
|
|
|
21132
21165
|
const meta = getConnector(name);
|
|
21133
21166
|
if (!meta) {
|
|
21134
21167
|
return {
|
|
21135
|
-
content: [{ type: "text", text: `Connector '${name}' not found.` }],
|
|
21168
|
+
content: [{ type: "text", text: `Connector '${name}' not found. Use search_connectors or list_connectors to find available connectors.` }],
|
|
21136
21169
|
isError: true
|
|
21137
21170
|
};
|
|
21138
21171
|
}
|
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:
|
|
1160
|
+
env: buildEnvWithCredentials(name, process.env),
|
|
1128
1161
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1129
1162
|
});
|
|
1130
1163
|
let stdout = "";
|
package/dist/lib/runner.d.ts
CHANGED
|
@@ -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.
|