@hasna/connectors 0.2.9 → 0.3.1
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 +21 -4
- package/bin/mcp.js +24 -36
- package/bin/serve.js +18 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -4642,7 +4642,24 @@ Dashboard not found at: ${dashboardDir}`);
|
|
|
4642
4642
|
const path = url2.pathname;
|
|
4643
4643
|
const method = req.method;
|
|
4644
4644
|
if (path === "/api/connectors" && method === "GET") {
|
|
4645
|
-
|
|
4645
|
+
const compact = url2.searchParams.get("compact") === "true";
|
|
4646
|
+
const fieldsParam = url2.searchParams.get("fields");
|
|
4647
|
+
const fields = fieldsParam ? new Set(fieldsParam.split(",").map((f) => f.trim())) : null;
|
|
4648
|
+
const data = getAllConnectorsWithAuth();
|
|
4649
|
+
if (compact) {
|
|
4650
|
+
return json(data.map((c) => ({ name: c.name, category: c.category, installed: c.installed })), 200, port);
|
|
4651
|
+
}
|
|
4652
|
+
if (fields) {
|
|
4653
|
+
return json(data.map((c) => {
|
|
4654
|
+
const out = {};
|
|
4655
|
+
for (const f of fields) {
|
|
4656
|
+
if (f in c)
|
|
4657
|
+
out[f] = c[f];
|
|
4658
|
+
}
|
|
4659
|
+
return out;
|
|
4660
|
+
}), 200, port);
|
|
4661
|
+
}
|
|
4662
|
+
return json(data, 200, port);
|
|
4646
4663
|
}
|
|
4647
4664
|
const singleMatch = path.match(/^\/api\/connectors\/([^/]+)$/);
|
|
4648
4665
|
if (singleMatch && method === "GET") {
|
|
@@ -6583,7 +6600,7 @@ var PRESETS = {
|
|
|
6583
6600
|
commerce: { description: "Commerce and finance", connectors: ["stripe", "shopify", "revolut", "mercury", "pandadoc"] }
|
|
6584
6601
|
};
|
|
6585
6602
|
var program2 = new Command;
|
|
6586
|
-
program2.name("connectors").description("Install API connectors for your project").version("0.
|
|
6603
|
+
program2.name("connectors").description("Install API connectors for your project").version("0.3.1");
|
|
6587
6604
|
program2.command("interactive", { isDefault: true }).alias("i").description("Interactive connector browser").action(() => {
|
|
6588
6605
|
if (!isTTY) {
|
|
6589
6606
|
console.log(`Non-interactive environment detected. Use a subcommand:
|
|
@@ -7746,7 +7763,7 @@ program2.command("import").argument("<file>", "JSON backup file to import (use -
|
|
|
7746
7763
|
}
|
|
7747
7764
|
});
|
|
7748
7765
|
program2.command("upgrade").alias("self-update").option("--check", "Only check for updates, don't install", false).option("--json", "Output as JSON", false).description("Check for updates and upgrade to the latest version").action(async (options) => {
|
|
7749
|
-
const currentVersion = "0.
|
|
7766
|
+
const currentVersion = "0.3.1";
|
|
7750
7767
|
try {
|
|
7751
7768
|
const res = await fetch("https://registry.npmjs.org/@hasna/connectors/latest");
|
|
7752
7769
|
if (!res.ok)
|
|
@@ -7962,7 +7979,7 @@ Available presets:
|
|
|
7962
7979
|
program2.command("whoami").option("--json", "Output as JSON", false).description("Show current setup: config dir, installed connectors, auth status").action((options) => {
|
|
7963
7980
|
const configDir = join5(homedir3(), ".connectors");
|
|
7964
7981
|
const installed = getInstalledConnectors();
|
|
7965
|
-
const version = "0.
|
|
7982
|
+
const version = "0.3.1";
|
|
7966
7983
|
let configured = 0;
|
|
7967
7984
|
let unconfigured = 0;
|
|
7968
7985
|
const connectorDetails = [];
|
package/bin/mcp.js
CHANGED
|
@@ -20275,14 +20275,12 @@ function guessKeyField(name) {
|
|
|
20275
20275
|
loadConnectorVersions();
|
|
20276
20276
|
var server = new McpServer({
|
|
20277
20277
|
name: "connectors",
|
|
20278
|
-
version: "0.
|
|
20278
|
+
version: "0.3.1"
|
|
20279
20279
|
});
|
|
20280
20280
|
server.registerTool("search_connectors", {
|
|
20281
20281
|
title: "Search Connectors",
|
|
20282
|
-
description: "Search connectors by name
|
|
20283
|
-
inputSchema: {
|
|
20284
|
-
query: exports_external.string().describe("Search query")
|
|
20285
|
-
}
|
|
20282
|
+
description: "Search connectors by name or keyword.",
|
|
20283
|
+
inputSchema: { query: exports_external.string() }
|
|
20286
20284
|
}, async ({ query }) => {
|
|
20287
20285
|
const results = searchConnectors(query);
|
|
20288
20286
|
return {
|
|
@@ -20302,10 +20300,10 @@ server.registerTool("search_connectors", {
|
|
|
20302
20300
|
});
|
|
20303
20301
|
server.registerTool("list_connectors", {
|
|
20304
20302
|
title: "List Connectors",
|
|
20305
|
-
description: "List connectors
|
|
20303
|
+
description: "List connectors. category filters; compact=true returns names only.",
|
|
20306
20304
|
inputSchema: {
|
|
20307
|
-
category: exports_external.string().optional()
|
|
20308
|
-
compact: exports_external.boolean().optional()
|
|
20305
|
+
category: exports_external.string().optional(),
|
|
20306
|
+
compact: exports_external.boolean().optional()
|
|
20309
20307
|
}
|
|
20310
20308
|
}, async ({ category, compact }) => {
|
|
20311
20309
|
let connectors = CONNECTORS;
|
|
@@ -20337,10 +20335,10 @@ server.registerTool("list_connectors", {
|
|
|
20337
20335
|
});
|
|
20338
20336
|
server.registerTool("connector_docs", {
|
|
20339
20337
|
title: "Connector Documentation",
|
|
20340
|
-
description: "Get connector docs.
|
|
20338
|
+
description: "Get connector docs. essential=true returns auth+envVars only.",
|
|
20341
20339
|
inputSchema: {
|
|
20342
|
-
name: exports_external.string()
|
|
20343
|
-
essential: exports_external.boolean().optional()
|
|
20340
|
+
name: exports_external.string(),
|
|
20341
|
+
essential: exports_external.boolean().optional()
|
|
20344
20342
|
}
|
|
20345
20343
|
}, async ({ name, essential }) => {
|
|
20346
20344
|
const meta = getConnector(name);
|
|
@@ -20375,10 +20373,10 @@ server.registerTool("connector_docs", {
|
|
|
20375
20373
|
});
|
|
20376
20374
|
server.registerTool("install_connector", {
|
|
20377
20375
|
title: "Install Connector",
|
|
20378
|
-
description: "Install connectors into .connectors
|
|
20376
|
+
description: "Install connectors into .connectors/.",
|
|
20379
20377
|
inputSchema: {
|
|
20380
|
-
names: exports_external.array(exports_external.string())
|
|
20381
|
-
overwrite: exports_external.boolean().optional()
|
|
20378
|
+
names: exports_external.array(exports_external.string()),
|
|
20379
|
+
overwrite: exports_external.boolean().optional()
|
|
20382
20380
|
}
|
|
20383
20381
|
}, async ({ names, overwrite }) => {
|
|
20384
20382
|
const results = names.map((name) => installConnector(name, { overwrite: overwrite ?? false }));
|
|
@@ -20399,10 +20397,8 @@ server.registerTool("install_connector", {
|
|
|
20399
20397
|
});
|
|
20400
20398
|
server.registerTool("remove_connector", {
|
|
20401
20399
|
title: "Remove Connector",
|
|
20402
|
-
description: "Remove an installed connector
|
|
20403
|
-
inputSchema: {
|
|
20404
|
-
name: exports_external.string().describe("Connector name to remove")
|
|
20405
|
-
}
|
|
20400
|
+
description: "Remove an installed connector.",
|
|
20401
|
+
inputSchema: { name: exports_external.string() }
|
|
20406
20402
|
}, async ({ name }) => {
|
|
20407
20403
|
const removed = removeConnector(name);
|
|
20408
20404
|
return {
|
|
@@ -20432,9 +20428,7 @@ server.registerTool("list_installed", {
|
|
|
20432
20428
|
server.registerTool("connector_info", {
|
|
20433
20429
|
title: "Connector Info",
|
|
20434
20430
|
description: "Get connector metadata and installed status.",
|
|
20435
|
-
inputSchema: {
|
|
20436
|
-
name: exports_external.string().describe("Connector name")
|
|
20437
|
-
}
|
|
20431
|
+
inputSchema: { name: exports_external.string() }
|
|
20438
20432
|
}, async ({ name }) => {
|
|
20439
20433
|
const meta = getConnector(name);
|
|
20440
20434
|
if (!meta) {
|
|
@@ -20456,10 +20450,8 @@ server.registerTool("connector_info", {
|
|
|
20456
20450
|
});
|
|
20457
20451
|
server.registerTool("connector_auth_status", {
|
|
20458
20452
|
title: "Connector Auth Status",
|
|
20459
|
-
description: "Check
|
|
20460
|
-
inputSchema: {
|
|
20461
|
-
name: exports_external.string().describe("Connector name")
|
|
20462
|
-
}
|
|
20453
|
+
description: "Check auth status, token expiry, and env vars.",
|
|
20454
|
+
inputSchema: { name: exports_external.string() }
|
|
20463
20455
|
}, async ({ name }) => {
|
|
20464
20456
|
const meta = getConnector(name);
|
|
20465
20457
|
if (!meta) {
|
|
@@ -20484,11 +20476,11 @@ server.registerTool("connector_auth_status", {
|
|
|
20484
20476
|
});
|
|
20485
20477
|
server.registerTool("configure_auth", {
|
|
20486
20478
|
title: "Configure Auth",
|
|
20487
|
-
description: "Save an API key or
|
|
20479
|
+
description: "Save an API key or token for a connector.",
|
|
20488
20480
|
inputSchema: {
|
|
20489
|
-
name: exports_external.string()
|
|
20490
|
-
key: exports_external.string()
|
|
20491
|
-
field: exports_external.string().optional()
|
|
20481
|
+
name: exports_external.string(),
|
|
20482
|
+
key: exports_external.string(),
|
|
20483
|
+
field: exports_external.string().optional()
|
|
20492
20484
|
}
|
|
20493
20485
|
}, async ({ name, key, field }) => {
|
|
20494
20486
|
try {
|
|
@@ -20534,9 +20526,7 @@ server.registerTool("list_categories", {
|
|
|
20534
20526
|
server.registerTool("search_tools", {
|
|
20535
20527
|
title: "Search Tools",
|
|
20536
20528
|
description: "List tool names, optionally filtered by keyword.",
|
|
20537
|
-
inputSchema: {
|
|
20538
|
-
query: exports_external.string().optional().describe("Keyword filter")
|
|
20539
|
-
}
|
|
20529
|
+
inputSchema: { query: exports_external.string().optional() }
|
|
20540
20530
|
}, async ({ query }) => {
|
|
20541
20531
|
const all = [
|
|
20542
20532
|
"search_connectors",
|
|
@@ -20557,10 +20547,8 @@ server.registerTool("search_tools", {
|
|
|
20557
20547
|
});
|
|
20558
20548
|
server.registerTool("describe_tools", {
|
|
20559
20549
|
title: "Describe Tools",
|
|
20560
|
-
description: "Get descriptions for specific tools
|
|
20561
|
-
inputSchema: {
|
|
20562
|
-
names: exports_external.array(exports_external.string()).describe("Tool names")
|
|
20563
|
-
}
|
|
20550
|
+
description: "Get full descriptions for specific tools.",
|
|
20551
|
+
inputSchema: { names: exports_external.array(exports_external.string()) }
|
|
20564
20552
|
}, async ({ names }) => {
|
|
20565
20553
|
const descriptions = {
|
|
20566
20554
|
search_connectors: "Search connectors by name/keyword. Params: query",
|
package/bin/serve.js
CHANGED
|
@@ -1136,7 +1136,24 @@ Dashboard not found at: ${dashboardDir}`);
|
|
|
1136
1136
|
const path = url2.pathname;
|
|
1137
1137
|
const method = req.method;
|
|
1138
1138
|
if (path === "/api/connectors" && method === "GET") {
|
|
1139
|
-
|
|
1139
|
+
const compact = url2.searchParams.get("compact") === "true";
|
|
1140
|
+
const fieldsParam = url2.searchParams.get("fields");
|
|
1141
|
+
const fields = fieldsParam ? new Set(fieldsParam.split(",").map((f) => f.trim())) : null;
|
|
1142
|
+
const data = getAllConnectorsWithAuth();
|
|
1143
|
+
if (compact) {
|
|
1144
|
+
return json(data.map((c) => ({ name: c.name, category: c.category, installed: c.installed })), 200, port);
|
|
1145
|
+
}
|
|
1146
|
+
if (fields) {
|
|
1147
|
+
return json(data.map((c) => {
|
|
1148
|
+
const out = {};
|
|
1149
|
+
for (const f of fields) {
|
|
1150
|
+
if (f in c)
|
|
1151
|
+
out[f] = c[f];
|
|
1152
|
+
}
|
|
1153
|
+
return out;
|
|
1154
|
+
}), 200, port);
|
|
1155
|
+
}
|
|
1156
|
+
return json(data, 200, port);
|
|
1140
1157
|
}
|
|
1141
1158
|
const singleMatch = path.match(/^\/api\/connectors\/([^/]+)$/);
|
|
1142
1159
|
if (singleMatch && method === "GET") {
|