@hasna/connectors 0.5.8 → 0.6.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/bin/index.js +108 -128
- package/bin/mcp.js +57 -1
- package/bin/serve.js +56 -0
- package/connectors/connect-chargebee/.env.example +11 -0
- package/connectors/connect-chargebee/CLAUDE.md +272 -0
- package/connectors/connect-chargebee/README.md +193 -0
- package/connectors/connect-chargebee/package.json +51 -0
- package/connectors/connect-chargebee/scripts/release.ts +179 -0
- package/connectors/connect-chargebee/src/api/client.ts +213 -0
- package/connectors/connect-chargebee/src/api/example.ts +48 -0
- package/connectors/connect-chargebee/src/api/index.ts +51 -0
- package/connectors/connect-chargebee/src/cli/index.ts +254 -0
- package/connectors/connect-chargebee/src/index.ts +103 -0
- package/connectors/connect-chargebee/src/types/index.ts +237 -0
- package/connectors/connect-chargebee/src/utils/auth.ts +274 -0
- package/connectors/connect-chargebee/src/utils/bulk.ts +212 -0
- package/connectors/connect-chargebee/src/utils/config.ts +326 -0
- package/connectors/connect-chargebee/src/utils/output.ts +175 -0
- package/connectors/connect-chargebee/src/utils/settings.ts +114 -0
- package/connectors/connect-chargebee/src/utils/storage.ts +198 -0
- package/connectors/connect-chargebee/tsconfig.json +16 -0
- package/connectors/connect-databricks/.env.example +11 -0
- package/connectors/connect-databricks/CLAUDE.md +272 -0
- package/connectors/connect-databricks/README.md +193 -0
- package/connectors/connect-databricks/package.json +51 -0
- package/connectors/connect-databricks/scripts/release.ts +179 -0
- package/connectors/connect-databricks/src/api/client.ts +213 -0
- package/connectors/connect-databricks/src/api/example.ts +48 -0
- package/connectors/connect-databricks/src/api/index.ts +51 -0
- package/connectors/connect-databricks/src/cli/index.ts +254 -0
- package/connectors/connect-databricks/src/index.ts +103 -0
- package/connectors/connect-databricks/src/types/index.ts +237 -0
- package/connectors/connect-databricks/src/utils/auth.ts +274 -0
- package/connectors/connect-databricks/src/utils/bulk.ts +212 -0
- package/connectors/connect-databricks/src/utils/config.ts +326 -0
- package/connectors/connect-databricks/src/utils/output.ts +175 -0
- package/connectors/connect-databricks/src/utils/settings.ts +114 -0
- package/connectors/connect-databricks/src/utils/storage.ts +198 -0
- package/connectors/connect-databricks/tsconfig.json +16 -0
- package/connectors/connect-datadog/.env.example +11 -0
- package/connectors/connect-datadog/CLAUDE.md +170 -0
- package/connectors/connect-datadog/README.md +193 -0
- package/connectors/connect-datadog/package.json +53 -0
- package/connectors/connect-datadog/src/api/client.ts +150 -0
- package/connectors/connect-datadog/src/api/index.ts +537 -0
- package/connectors/connect-datadog/src/cli/index.ts +958 -0
- package/connectors/connect-datadog/src/index.ts +26 -0
- package/connectors/connect-datadog/src/types/index.ts +654 -0
- package/connectors/connect-datadog/src/utils/config.ts +219 -0
- package/connectors/connect-datadog/src/utils/output.ts +119 -0
- package/connectors/connect-datadog/tsconfig.json +16 -0
- package/connectors/connect-fathom/.env.example +11 -0
- package/connectors/connect-fathom/CLAUDE.md +272 -0
- package/connectors/connect-fathom/README.md +193 -0
- package/connectors/connect-fathom/package.json +51 -0
- package/connectors/connect-fathom/scripts/release.ts +179 -0
- package/connectors/connect-fathom/src/api/client.ts +213 -0
- package/connectors/connect-fathom/src/api/example.ts +48 -0
- package/connectors/connect-fathom/src/api/index.ts +51 -0
- package/connectors/connect-fathom/src/cli/index.ts +254 -0
- package/connectors/connect-fathom/src/index.ts +103 -0
- package/connectors/connect-fathom/src/types/index.ts +237 -0
- package/connectors/connect-fathom/src/utils/auth.ts +274 -0
- package/connectors/connect-fathom/src/utils/bulk.ts +212 -0
- package/connectors/connect-fathom/src/utils/config.ts +326 -0
- package/connectors/connect-fathom/src/utils/output.ts +175 -0
- package/connectors/connect-fathom/src/utils/settings.ts +114 -0
- package/connectors/connect-fathom/src/utils/storage.ts +198 -0
- package/connectors/connect-fathom/tsconfig.json +16 -0
- package/connectors/connect-grafana/.env.example +11 -0
- package/connectors/connect-grafana/CLAUDE.md +272 -0
- package/connectors/connect-grafana/README.md +193 -0
- package/connectors/connect-grafana/package.json +51 -0
- package/connectors/connect-grafana/scripts/release.ts +179 -0
- package/connectors/connect-grafana/src/api/client.ts +213 -0
- package/connectors/connect-grafana/src/api/example.ts +48 -0
- package/connectors/connect-grafana/src/api/index.ts +51 -0
- package/connectors/connect-grafana/src/cli/index.ts +254 -0
- package/connectors/connect-grafana/src/index.ts +103 -0
- package/connectors/connect-grafana/src/types/index.ts +237 -0
- package/connectors/connect-grafana/src/utils/auth.ts +274 -0
- package/connectors/connect-grafana/src/utils/bulk.ts +212 -0
- package/connectors/connect-grafana/src/utils/config.ts +326 -0
- package/connectors/connect-grafana/src/utils/output.ts +175 -0
- package/connectors/connect-grafana/src/utils/settings.ts +114 -0
- package/connectors/connect-grafana/src/utils/storage.ts +198 -0
- package/connectors/connect-grafana/tsconfig.json +16 -0
- package/connectors/connect-paddle/.env.example +11 -0
- package/connectors/connect-paddle/CLAUDE.md +272 -0
- package/connectors/connect-paddle/README.md +193 -0
- package/connectors/connect-paddle/package.json +51 -0
- package/connectors/connect-paddle/scripts/release.ts +179 -0
- package/connectors/connect-paddle/src/api/client.ts +213 -0
- package/connectors/connect-paddle/src/api/example.ts +48 -0
- package/connectors/connect-paddle/src/api/index.ts +51 -0
- package/connectors/connect-paddle/src/cli/index.ts +254 -0
- package/connectors/connect-paddle/src/index.ts +103 -0
- package/connectors/connect-paddle/src/types/index.ts +237 -0
- package/connectors/connect-paddle/src/utils/auth.ts +274 -0
- package/connectors/connect-paddle/src/utils/bulk.ts +212 -0
- package/connectors/connect-paddle/src/utils/config.ts +326 -0
- package/connectors/connect-paddle/src/utils/output.ts +175 -0
- package/connectors/connect-paddle/src/utils/settings.ts +114 -0
- package/connectors/connect-paddle/src/utils/storage.ts +198 -0
- package/connectors/connect-paddle/tsconfig.json +16 -0
- package/connectors/connect-snowflake/.env.example +11 -0
- package/connectors/connect-snowflake/CLAUDE.md +272 -0
- package/connectors/connect-snowflake/README.md +193 -0
- package/connectors/connect-snowflake/package.json +51 -0
- package/connectors/connect-snowflake/scripts/release.ts +179 -0
- package/connectors/connect-snowflake/src/api/client.ts +213 -0
- package/connectors/connect-snowflake/src/api/example.ts +48 -0
- package/connectors/connect-snowflake/src/api/index.ts +51 -0
- package/connectors/connect-snowflake/src/cli/index.ts +254 -0
- package/connectors/connect-snowflake/src/index.ts +103 -0
- package/connectors/connect-snowflake/src/types/index.ts +237 -0
- package/connectors/connect-snowflake/src/utils/auth.ts +274 -0
- package/connectors/connect-snowflake/src/utils/bulk.ts +212 -0
- package/connectors/connect-snowflake/src/utils/config.ts +326 -0
- package/connectors/connect-snowflake/src/utils/output.ts +175 -0
- package/connectors/connect-snowflake/src/utils/settings.ts +114 -0
- package/connectors/connect-snowflake/src/utils/storage.ts +198 -0
- package/connectors/connect-snowflake/tsconfig.json +16 -0
- package/connectors/connect-square/.env.example +11 -0
- package/connectors/connect-square/CLAUDE.md +128 -0
- package/connectors/connect-square/README.md +193 -0
- package/connectors/connect-square/package.json +52 -0
- package/connectors/connect-square/src/api/client.ts +152 -0
- package/connectors/connect-square/src/api/index.ts +343 -0
- package/connectors/connect-square/src/cli/index.ts +579 -0
- package/connectors/connect-square/src/index.ts +21 -0
- package/connectors/connect-square/src/types/index.ts +809 -0
- package/connectors/connect-square/src/utils/config.ts +209 -0
- package/connectors/connect-square/src/utils/output.ts +119 -0
- package/connectors/connect-square/tsconfig.json +16 -0
- package/dist/index.js +56 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -2801,6 +2801,62 @@ var init_registry = __esm(() => {
|
|
|
2801
2801
|
description: "Visual collaboration and whiteboarding",
|
|
2802
2802
|
category: "Business Tools",
|
|
2803
2803
|
tags: ["whiteboard", "collaboration", "design"]
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
name: "square",
|
|
2807
|
+
displayName: "Square",
|
|
2808
|
+
description: "Payments, POS, and commerce",
|
|
2809
|
+
category: "Commerce & Finance",
|
|
2810
|
+
tags: ["payments", "pos", "commerce"]
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
name: "paddle",
|
|
2814
|
+
displayName: "Paddle",
|
|
2815
|
+
description: "SaaS billing and payments",
|
|
2816
|
+
category: "Commerce & Finance",
|
|
2817
|
+
tags: ["payments", "billing", "saas"]
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
name: "chargebee",
|
|
2821
|
+
displayName: "Chargebee",
|
|
2822
|
+
description: "Subscription billing and revenue management",
|
|
2823
|
+
category: "Commerce & Finance",
|
|
2824
|
+
tags: ["billing", "subscriptions"]
|
|
2825
|
+
},
|
|
2826
|
+
{
|
|
2827
|
+
name: "fathom",
|
|
2828
|
+
displayName: "Fathom Analytics",
|
|
2829
|
+
description: "Privacy-first website analytics",
|
|
2830
|
+
category: "Data & Analytics",
|
|
2831
|
+
tags: ["analytics", "privacy"]
|
|
2832
|
+
},
|
|
2833
|
+
{
|
|
2834
|
+
name: "snowflake",
|
|
2835
|
+
displayName: "Snowflake",
|
|
2836
|
+
description: "Cloud data warehouse",
|
|
2837
|
+
category: "Data & Analytics",
|
|
2838
|
+
tags: ["data", "warehouse", "sql"]
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
name: "databricks",
|
|
2842
|
+
displayName: "Databricks",
|
|
2843
|
+
description: "Data lakehouse and ML platform",
|
|
2844
|
+
category: "Data & Analytics",
|
|
2845
|
+
tags: ["data", "ml", "lakehouse"]
|
|
2846
|
+
},
|
|
2847
|
+
{
|
|
2848
|
+
name: "datadog",
|
|
2849
|
+
displayName: "Datadog",
|
|
2850
|
+
description: "Monitoring and observability",
|
|
2851
|
+
category: "Developer Tools",
|
|
2852
|
+
tags: ["monitoring", "observability", "apm"]
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
name: "grafana",
|
|
2856
|
+
displayName: "Grafana",
|
|
2857
|
+
description: "Dashboards and observability",
|
|
2858
|
+
category: "Developer Tools",
|
|
2859
|
+
tags: ["monitoring", "dashboards", "observability"]
|
|
2804
2860
|
}
|
|
2805
2861
|
];
|
|
2806
2862
|
});
|
|
@@ -7314,7 +7370,7 @@ var PRESETS = {
|
|
|
7314
7370
|
commerce: { description: "Commerce and finance", connectors: ["stripe", "shopify", "revolut", "mercury", "pandadoc"] }
|
|
7315
7371
|
};
|
|
7316
7372
|
var program2 = new Command;
|
|
7317
|
-
program2.name("connectors").description("Install API connectors for your project").version("0.
|
|
7373
|
+
program2.name("connectors").description("Install API connectors for your project").version("0.6.0").enablePositionalOptions();
|
|
7318
7374
|
program2.command("interactive", { isDefault: true }).alias("i").description("Interactive connector browser").action(() => {
|
|
7319
7375
|
if (!isTTY) {
|
|
7320
7376
|
console.log(`Non-interactive environment detected. Use a subcommand:
|
|
@@ -8315,145 +8371,69 @@ Open this URL to authenticate:
|
|
|
8315
8371
|
}
|
|
8316
8372
|
process.exit(0);
|
|
8317
8373
|
});
|
|
8318
|
-
program2.command("init").option("--json", "Output
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8374
|
+
program2.command("init").option("--json", "Output presets and suggestions as JSON (non-interactive)", false).description("Get started with Connectors \u2014 see suggestions, presets, and next steps").action(async (options) => {
|
|
8375
|
+
const initPresets = [
|
|
8376
|
+
{ key: "ai", emoji: "\uD83E\uDD16", label: "AI & ML", connectors: ["anthropic", "openai", "groq", "mistral", "googlegemini", "elevenlabs"], description: "AI and ML models" },
|
|
8377
|
+
{ key: "communication", emoji: "\uD83D\uDCAC", label: "Communication", connectors: ["gmail", "slack", "discord", "resend", "twilio"], description: "Messaging and communication" },
|
|
8378
|
+
{ key: "devtools", emoji: "\uD83D\uDEE0", label: "Developer Tools", connectors: ["github", "vercel", "sentry", "docker", "cloudflare", "firecrawl"], description: "Developer tooling" },
|
|
8379
|
+
{ key: "commerce", emoji: "\uD83D\uDCB3", label: "Commerce", connectors: ["stripe", "shopify", "paypal", "revolut", "mercury"], description: "Commerce and finance" },
|
|
8380
|
+
{ key: "google", emoji: "\uD83D\uDCC1", label: "Google Workspace", connectors: ["gmail", "googledrive", "googlecalendar", "googledocs", "googlesheets"], description: "Google Workspace suite" }
|
|
8381
|
+
];
|
|
8382
|
+
const connectorsHome = join6(homedir3(), ".connectors");
|
|
8383
|
+
let configuredCount = 0;
|
|
8384
|
+
const configuredNames = [];
|
|
8385
|
+
try {
|
|
8386
|
+
if (existsSync6(connectorsHome)) {
|
|
8387
|
+
const entries = readdirSync4(connectorsHome).filter((e) => e.startsWith("connect-") && statSync3(join6(connectorsHome, e)).isDirectory());
|
|
8388
|
+
for (const entry of entries) {
|
|
8389
|
+
const profilesDir = join6(connectorsHome, entry, "profiles");
|
|
8390
|
+
if (existsSync6(profilesDir)) {
|
|
8391
|
+
configuredCount++;
|
|
8392
|
+
configuredNames.push(entry.replace(/^connect-/, ""));
|
|
8393
|
+
}
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8396
|
+
} catch {}
|
|
8397
|
+
const jsonData = {
|
|
8398
|
+
total: CONNECTORS.length,
|
|
8399
|
+
configured: configuredCount,
|
|
8400
|
+
configuredConnectors: configuredNames,
|
|
8401
|
+
presets: initPresets.map((p) => ({
|
|
8402
|
+
key: p.key,
|
|
8403
|
+
label: p.label,
|
|
8404
|
+
description: p.description,
|
|
8405
|
+
connectors: p.connectors
|
|
8406
|
+
}))
|
|
8407
|
+
};
|
|
8408
|
+
if (options.json || !isTTY) {
|
|
8409
|
+
console.log(JSON.stringify(jsonData, null, 2));
|
|
8330
8410
|
process.exit(0);
|
|
8331
8411
|
return;
|
|
8332
8412
|
}
|
|
8333
|
-
if (!isTTY) {
|
|
8334
|
-
console.error("Interactive mode requires a TTY. Use --json for non-interactive output.");
|
|
8335
|
-
process.exit(1);
|
|
8336
|
-
return;
|
|
8337
|
-
}
|
|
8338
|
-
function ask(question) {
|
|
8339
|
-
return new Promise((resolve) => {
|
|
8340
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
8341
|
-
rl.question(question, (answer) => {
|
|
8342
|
-
rl.close();
|
|
8343
|
-
resolve(answer.trim());
|
|
8344
|
-
});
|
|
8345
|
-
});
|
|
8346
|
-
}
|
|
8347
8413
|
console.log();
|
|
8348
|
-
console.log(chalk2.bold(
|
|
8349
|
-
console.log(chalk2.dim(`Let's get you set up with the API connectors you need.
|
|
8350
|
-
`));
|
|
8351
|
-
console.log(chalk2.bold(`Available categories:
|
|
8352
|
-
`));
|
|
8353
|
-
const categoryList = CATEGORIES.map((cat) => ({
|
|
8354
|
-
name: cat,
|
|
8355
|
-
connectors: getConnectorsByCategory(cat)
|
|
8356
|
-
}));
|
|
8357
|
-
for (let i = 0;i < categoryList.length; i++) {
|
|
8358
|
-
const c = categoryList[i];
|
|
8359
|
-
console.log(` ${chalk2.cyan(String(i + 1).padStart(2))}. ${c.name} ${chalk2.dim(`(${c.connectors.length} connectors)`)}`);
|
|
8360
|
-
}
|
|
8414
|
+
console.log(chalk2.bold(`Welcome to Connectors! ${CONNECTORS.length} API connectors ready to use.`));
|
|
8361
8415
|
console.log();
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
console.log(
|
|
8365
|
-
No categories selected. Exiting.
|
|
8366
|
-
`));
|
|
8367
|
-
process.exit(0);
|
|
8368
|
-
return;
|
|
8416
|
+
if (configuredCount > 0) {
|
|
8417
|
+
console.log(chalk2.green(` You already have ${configuredCount} connector${configuredCount === 1 ? "" : "s"} configured`) + chalk2.dim(` (${configuredNames.slice(0, 5).join(", ")}${configuredNames.length > 5 ? ", ..." : ""})`));
|
|
8418
|
+
console.log();
|
|
8369
8419
|
}
|
|
8370
|
-
|
|
8371
|
-
if (catIndices.length === 0) {
|
|
8372
|
-
console.log(chalk2.red(`
|
|
8373
|
-
No valid categories selected. Exiting.
|
|
8420
|
+
console.log(chalk2.bold(`Quick start bundles:
|
|
8374
8421
|
`));
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
const selectedCategories = catIndices.map((i) => categoryList[i]);
|
|
8379
|
-
const seen = new Set;
|
|
8380
|
-
const connectorPool = [];
|
|
8381
|
-
for (const cat of selectedCategories) {
|
|
8382
|
-
for (const c of cat.connectors) {
|
|
8383
|
-
if (!seen.has(c.name)) {
|
|
8384
|
-
seen.add(c.name);
|
|
8385
|
-
connectorPool.push({
|
|
8386
|
-
name: c.name,
|
|
8387
|
-
displayName: c.displayName,
|
|
8388
|
-
description: c.description,
|
|
8389
|
-
category: cat.name
|
|
8390
|
-
});
|
|
8391
|
-
}
|
|
8392
|
-
}
|
|
8422
|
+
for (const preset of initPresets) {
|
|
8423
|
+
console.log(` ${preset.emoji} ${chalk2.bold(preset.label)} ${chalk2.dim(`(${preset.connectors.length} connectors)`)}`);
|
|
8424
|
+
console.log(` ${chalk2.dim(preset.connectors.slice(0, 5).join(", ") + (preset.connectors.length > 5 ? ", ..." : ""))}`);
|
|
8393
8425
|
}
|
|
8394
8426
|
console.log();
|
|
8395
|
-
console.log(
|
|
8396
|
-
`));
|
|
8397
|
-
const nameWidth = Math.max(12, ...connectorPool.map((c) => c.name.length)) + 2;
|
|
8398
|
-
for (let i = 0;i < connectorPool.length; i++) {
|
|
8399
|
-
const c = connectorPool[i];
|
|
8400
|
-
console.log(` ${chalk2.cyan(String(i + 1).padStart(3))}. ${c.name.padEnd(nameWidth)}${chalk2.dim(c.description)}`);
|
|
8401
|
-
}
|
|
8427
|
+
console.log(`Run ${chalk2.cyan("connectors install --preset ai")} to install a bundle, or ${chalk2.cyan("connectors setup <name> --key <key>")} to set up a specific connector.`);
|
|
8402
8428
|
console.log();
|
|
8403
|
-
|
|
8404
|
-
if (!connAnswer) {
|
|
8405
|
-
console.log(chalk2.dim(`
|
|
8406
|
-
No connectors selected. Exiting.
|
|
8407
|
-
`));
|
|
8408
|
-
process.exit(0);
|
|
8409
|
-
return;
|
|
8410
|
-
}
|
|
8411
|
-
let toInstall;
|
|
8412
|
-
if (connAnswer.toLowerCase() === "all") {
|
|
8413
|
-
toInstall = connectorPool.map((c) => c.name);
|
|
8414
|
-
} else {
|
|
8415
|
-
const connIndices = connAnswer.split(",").map((s) => parseInt(s.trim(), 10) - 1).filter((i) => i >= 0 && i < connectorPool.length);
|
|
8416
|
-
if (connIndices.length === 0) {
|
|
8417
|
-
console.log(chalk2.red(`
|
|
8418
|
-
No valid connectors selected. Exiting.
|
|
8419
|
-
`));
|
|
8420
|
-
process.exit(1);
|
|
8421
|
-
return;
|
|
8422
|
-
}
|
|
8423
|
-
toInstall = connIndices.map((i) => connectorPool[i].name);
|
|
8424
|
-
}
|
|
8425
|
-
console.log(chalk2.bold(`
|
|
8426
|
-
Installing ${toInstall.length} connector(s)...
|
|
8429
|
+
console.log(chalk2.bold(`Next steps:
|
|
8427
8430
|
`));
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
console.log(chalk2.green(` \u2713 ${result.connector}`));
|
|
8433
|
-
succeeded.push(result.connector);
|
|
8434
|
-
} else {
|
|
8435
|
-
console.log(chalk2.red(` \u2717 ${result.connector}: ${result.error}`));
|
|
8436
|
-
}
|
|
8437
|
-
}
|
|
8438
|
-
if (succeeded.length > 0) {
|
|
8439
|
-
console.log(chalk2.bold(`
|
|
8440
|
-
Next steps:
|
|
8441
|
-
`));
|
|
8442
|
-
console.log(` ${chalk2.dim("1.")} Import in your code:`);
|
|
8443
|
-
console.log(` ${chalk2.cyan(`import { ${succeeded.slice(0, 3).join(", ")}${succeeded.length > 3 ? ", ..." : ""} } from './.connectors'`)}`);
|
|
8444
|
-
console.log();
|
|
8445
|
-
console.log(` ${chalk2.dim("2.")} Configure authentication:`);
|
|
8446
|
-
console.log(` ${chalk2.cyan("connectors auth <name>")} ${chalk2.dim("\u2014 set API keys interactively")}`);
|
|
8447
|
-
console.log(` ${chalk2.cyan("connectors serve")} ${chalk2.dim("\u2014 open dashboard for OAuth setup")}`);
|
|
8448
|
-
console.log();
|
|
8449
|
-
console.log(` ${chalk2.dim("3.")} Check connector docs:`);
|
|
8450
|
-
console.log(` ${chalk2.cyan(`connectors docs ${succeeded[0]}`)} ${chalk2.dim("\u2014 see auth & env var details")}`);
|
|
8451
|
-
console.log();
|
|
8452
|
-
console.log(` ${chalk2.dim("4.")} Verify everything works:`);
|
|
8453
|
-
console.log(` ${chalk2.cyan("connectors doctor")} ${chalk2.dim("\u2014 health check all connectors")}`);
|
|
8454
|
-
}
|
|
8431
|
+
console.log(` ${chalk2.cyan("connectors list")} ${chalk2.dim(`\u2014 browse all ${CONNECTORS.length} connectors`)}`);
|
|
8432
|
+
console.log(` ${chalk2.cyan("connectors setup <name> --key <key>")} ${chalk2.dim("\u2014 set up a connector")}`);
|
|
8433
|
+
console.log(` ${chalk2.cyan("connectors ops <name>")} ${chalk2.dim("\u2014 see what a connector can do")}`);
|
|
8434
|
+
console.log(` ${chalk2.cyan("connectors serve")} ${chalk2.dim("\u2014 open the auth dashboard")}`);
|
|
8455
8435
|
console.log();
|
|
8456
|
-
process.exit(
|
|
8436
|
+
process.exit(0);
|
|
8457
8437
|
});
|
|
8458
8438
|
var SENSITIVE_FIELDS = new Set([
|
|
8459
8439
|
"clientsecret",
|
package/bin/mcp.js
CHANGED
|
@@ -20289,6 +20289,62 @@ var CONNECTORS = [
|
|
|
20289
20289
|
description: "Visual collaboration and whiteboarding",
|
|
20290
20290
|
category: "Business Tools",
|
|
20291
20291
|
tags: ["whiteboard", "collaboration", "design"]
|
|
20292
|
+
},
|
|
20293
|
+
{
|
|
20294
|
+
name: "square",
|
|
20295
|
+
displayName: "Square",
|
|
20296
|
+
description: "Payments, POS, and commerce",
|
|
20297
|
+
category: "Commerce & Finance",
|
|
20298
|
+
tags: ["payments", "pos", "commerce"]
|
|
20299
|
+
},
|
|
20300
|
+
{
|
|
20301
|
+
name: "paddle",
|
|
20302
|
+
displayName: "Paddle",
|
|
20303
|
+
description: "SaaS billing and payments",
|
|
20304
|
+
category: "Commerce & Finance",
|
|
20305
|
+
tags: ["payments", "billing", "saas"]
|
|
20306
|
+
},
|
|
20307
|
+
{
|
|
20308
|
+
name: "chargebee",
|
|
20309
|
+
displayName: "Chargebee",
|
|
20310
|
+
description: "Subscription billing and revenue management",
|
|
20311
|
+
category: "Commerce & Finance",
|
|
20312
|
+
tags: ["billing", "subscriptions"]
|
|
20313
|
+
},
|
|
20314
|
+
{
|
|
20315
|
+
name: "fathom",
|
|
20316
|
+
displayName: "Fathom Analytics",
|
|
20317
|
+
description: "Privacy-first website analytics",
|
|
20318
|
+
category: "Data & Analytics",
|
|
20319
|
+
tags: ["analytics", "privacy"]
|
|
20320
|
+
},
|
|
20321
|
+
{
|
|
20322
|
+
name: "snowflake",
|
|
20323
|
+
displayName: "Snowflake",
|
|
20324
|
+
description: "Cloud data warehouse",
|
|
20325
|
+
category: "Data & Analytics",
|
|
20326
|
+
tags: ["data", "warehouse", "sql"]
|
|
20327
|
+
},
|
|
20328
|
+
{
|
|
20329
|
+
name: "databricks",
|
|
20330
|
+
displayName: "Databricks",
|
|
20331
|
+
description: "Data lakehouse and ML platform",
|
|
20332
|
+
category: "Data & Analytics",
|
|
20333
|
+
tags: ["data", "ml", "lakehouse"]
|
|
20334
|
+
},
|
|
20335
|
+
{
|
|
20336
|
+
name: "datadog",
|
|
20337
|
+
displayName: "Datadog",
|
|
20338
|
+
description: "Monitoring and observability",
|
|
20339
|
+
category: "Developer Tools",
|
|
20340
|
+
tags: ["monitoring", "observability", "apm"]
|
|
20341
|
+
},
|
|
20342
|
+
{
|
|
20343
|
+
name: "grafana",
|
|
20344
|
+
displayName: "Grafana",
|
|
20345
|
+
description: "Dashboards and observability",
|
|
20346
|
+
category: "Developer Tools",
|
|
20347
|
+
tags: ["monitoring", "dashboards", "observability"]
|
|
20292
20348
|
}
|
|
20293
20349
|
];
|
|
20294
20350
|
function getConnectorsByCategory(category) {
|
|
@@ -20796,7 +20852,7 @@ async function getConnectorCommandHelp(name, command) {
|
|
|
20796
20852
|
loadConnectorVersions();
|
|
20797
20853
|
var server = new McpServer({
|
|
20798
20854
|
name: "connectors",
|
|
20799
|
-
version: "0.
|
|
20855
|
+
version: "0.6.0"
|
|
20800
20856
|
});
|
|
20801
20857
|
server.registerTool("search_connectors", {
|
|
20802
20858
|
title: "Search Connectors",
|
package/bin/serve.js
CHANGED
|
@@ -894,6 +894,62 @@ var CONNECTORS = [
|
|
|
894
894
|
description: "Visual collaboration and whiteboarding",
|
|
895
895
|
category: "Business Tools",
|
|
896
896
|
tags: ["whiteboard", "collaboration", "design"]
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
name: "square",
|
|
900
|
+
displayName: "Square",
|
|
901
|
+
description: "Payments, POS, and commerce",
|
|
902
|
+
category: "Commerce & Finance",
|
|
903
|
+
tags: ["payments", "pos", "commerce"]
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
name: "paddle",
|
|
907
|
+
displayName: "Paddle",
|
|
908
|
+
description: "SaaS billing and payments",
|
|
909
|
+
category: "Commerce & Finance",
|
|
910
|
+
tags: ["payments", "billing", "saas"]
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: "chargebee",
|
|
914
|
+
displayName: "Chargebee",
|
|
915
|
+
description: "Subscription billing and revenue management",
|
|
916
|
+
category: "Commerce & Finance",
|
|
917
|
+
tags: ["billing", "subscriptions"]
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
name: "fathom",
|
|
921
|
+
displayName: "Fathom Analytics",
|
|
922
|
+
description: "Privacy-first website analytics",
|
|
923
|
+
category: "Data & Analytics",
|
|
924
|
+
tags: ["analytics", "privacy"]
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: "snowflake",
|
|
928
|
+
displayName: "Snowflake",
|
|
929
|
+
description: "Cloud data warehouse",
|
|
930
|
+
category: "Data & Analytics",
|
|
931
|
+
tags: ["data", "warehouse", "sql"]
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
name: "databricks",
|
|
935
|
+
displayName: "Databricks",
|
|
936
|
+
description: "Data lakehouse and ML platform",
|
|
937
|
+
category: "Data & Analytics",
|
|
938
|
+
tags: ["data", "ml", "lakehouse"]
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
name: "datadog",
|
|
942
|
+
displayName: "Datadog",
|
|
943
|
+
description: "Monitoring and observability",
|
|
944
|
+
category: "Developer Tools",
|
|
945
|
+
tags: ["monitoring", "observability", "apm"]
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
name: "grafana",
|
|
949
|
+
displayName: "Grafana",
|
|
950
|
+
description: "Dashboards and observability",
|
|
951
|
+
category: "Developer Tools",
|
|
952
|
+
tags: ["monitoring", "dashboards", "observability"]
|
|
897
953
|
}
|
|
898
954
|
];
|
|
899
955
|
function getConnector(name) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# API Credentials
|
|
2
|
+
# TODO: Update variable names and instructions for your API
|
|
3
|
+
# Example: PERPLEXITY_API_KEY, OPENAI_API_KEY, etc.
|
|
4
|
+
|
|
5
|
+
CONNECTOR_API_KEY=your-api-key-here
|
|
6
|
+
|
|
7
|
+
# Optional: API secret (if your API requires it)
|
|
8
|
+
# CONNECTOR_API_SECRET=your-api-secret-here
|
|
9
|
+
|
|
10
|
+
# Optional: Custom base URL (if needed)
|
|
11
|
+
# CONNECTOR_BASE_URL=https://api.example.com
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
scaffold-connector is a TypeScript template for building API connector CLIs. It provides multi-profile configuration, Bearer token authentication (customizable), OAuth2 support, and a clean CLI structure using Commander.js.
|
|
8
|
+
|
|
9
|
+
**This is a SCAFFOLD** - meant to be cloned and customized for specific APIs.
|
|
10
|
+
|
|
11
|
+
## Build & Run Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install dependencies
|
|
15
|
+
bun install
|
|
16
|
+
|
|
17
|
+
# Run CLI in development
|
|
18
|
+
bun run dev
|
|
19
|
+
|
|
20
|
+
# Build for distribution
|
|
21
|
+
bun run build
|
|
22
|
+
|
|
23
|
+
# Type check
|
|
24
|
+
bun run typecheck
|
|
25
|
+
|
|
26
|
+
# Run specific commands
|
|
27
|
+
bun run dev profile list
|
|
28
|
+
bun run dev config show
|
|
29
|
+
bun run dev example list
|
|
30
|
+
|
|
31
|
+
# Release (auto-bump patch version and publish)
|
|
32
|
+
bun run release
|
|
33
|
+
bun run release:dry # Preview only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Code Style
|
|
37
|
+
|
|
38
|
+
- TypeScript with strict mode
|
|
39
|
+
- ESM modules (type: module)
|
|
40
|
+
- Use async/await for all async operations
|
|
41
|
+
- Minimal dependencies: commander, chalk only
|
|
42
|
+
- Type annotations required everywhere
|
|
43
|
+
- Use interfaces for all API types
|
|
44
|
+
|
|
45
|
+
## Project Structure
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
src/
|
|
49
|
+
├── api/
|
|
50
|
+
│ ├── client.ts # HTTP client with auth, retry, timeout
|
|
51
|
+
│ ├── example.ts # Example API module (template)
|
|
52
|
+
│ └── index.ts # Main connector class
|
|
53
|
+
├── cli/
|
|
54
|
+
│ └── index.ts # CLI commands
|
|
55
|
+
├── types/
|
|
56
|
+
│ └── index.ts # Type definitions
|
|
57
|
+
├── utils/
|
|
58
|
+
│ ├── auth.ts # OAuth2 authentication
|
|
59
|
+
│ ├── bulk.ts # Bulk operation utilities
|
|
60
|
+
│ ├── config.ts # Multi-profile configuration
|
|
61
|
+
│ ├── output.ts # CLI output formatting
|
|
62
|
+
│ ├── settings.ts # User preferences storage
|
|
63
|
+
│ └── storage.ts # Local data storage
|
|
64
|
+
├── index.ts # Library exports
|
|
65
|
+
scripts/
|
|
66
|
+
└── release.ts # Release automation
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Key Patterns
|
|
70
|
+
|
|
71
|
+
### Multi-Profile Configuration
|
|
72
|
+
|
|
73
|
+
Profiles stored in `~/.connect/{connector-name}/profiles/`:
|
|
74
|
+
- Each profile is a separate JSON file
|
|
75
|
+
- `current_profile` file tracks active profile
|
|
76
|
+
- `--profile` flag overrides for single command
|
|
77
|
+
- Environment variables override profile config
|
|
78
|
+
|
|
79
|
+
### Authentication
|
|
80
|
+
|
|
81
|
+
**Bearer Token (Default)** in `src/api/client.ts`:
|
|
82
|
+
```typescript
|
|
83
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Supported Auth Methods:**
|
|
87
|
+
- Bearer token: `'Authorization': 'Bearer ${token}'`
|
|
88
|
+
- API Key header: `'X-API-Key': ${apiKey}`
|
|
89
|
+
- Basic auth: `'Authorization': 'Basic ' + base64(key:secret)`
|
|
90
|
+
- OAuth2: Use the auth utilities (see below)
|
|
91
|
+
|
|
92
|
+
### OAuth2 Authentication
|
|
93
|
+
|
|
94
|
+
For APIs that require OAuth2, use the auth utilities:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { getAuthUrl, startCallbackServer, getValidAccessToken } from './utils/auth';
|
|
98
|
+
|
|
99
|
+
// Start OAuth flow
|
|
100
|
+
const authUrl = getAuthUrl({ scopes: 'read write' });
|
|
101
|
+
// Open authUrl in browser
|
|
102
|
+
const result = await startCallbackServer();
|
|
103
|
+
if (result.success) {
|
|
104
|
+
saveOAuthTokens(result.tokens);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Get valid access token (auto-refreshes if needed)
|
|
108
|
+
const token = await getValidAccessToken();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Settings Storage
|
|
112
|
+
|
|
113
|
+
Store user preferences with the settings utility:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { getSetting, setSetting, loadSettings } from './utils/settings';
|
|
117
|
+
|
|
118
|
+
// Get a setting
|
|
119
|
+
const format = getSetting('defaultFormat');
|
|
120
|
+
|
|
121
|
+
// Set a setting
|
|
122
|
+
setSetting('verboseOutput', true);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Local Data Storage
|
|
126
|
+
|
|
127
|
+
Store local data (like contacts, cache) with the storage utility:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { createStorage, type Storable } from './utils/storage';
|
|
131
|
+
|
|
132
|
+
interface Contact extends Storable {
|
|
133
|
+
id: string;
|
|
134
|
+
email: string;
|
|
135
|
+
name?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const contacts = createStorage<Contact>('contacts');
|
|
139
|
+
|
|
140
|
+
// Save
|
|
141
|
+
contacts.save({ id: 'user@example.com', email: 'user@example.com', name: 'User' });
|
|
142
|
+
|
|
143
|
+
// Get
|
|
144
|
+
const contact = contacts.get('user@example.com');
|
|
145
|
+
|
|
146
|
+
// Search
|
|
147
|
+
const results = contacts.searchByText('example');
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Bulk Operations
|
|
151
|
+
|
|
152
|
+
Process multiple items with concurrency control:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { executeBulk, createProgressReporter } from './utils/bulk';
|
|
156
|
+
|
|
157
|
+
const result = await executeBulk(
|
|
158
|
+
{
|
|
159
|
+
items: users,
|
|
160
|
+
concurrency: 5,
|
|
161
|
+
dryRun: false,
|
|
162
|
+
onProgress: createProgressReporter('Updating users'),
|
|
163
|
+
},
|
|
164
|
+
async (user) => {
|
|
165
|
+
await api.updateUser(user.id, { status: 'active' });
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
console.log(`Success: ${result.success}, Failed: ${result.failed}`);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Retry and Rate Limiting
|
|
173
|
+
|
|
174
|
+
The HTTP client includes built-in retry logic:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// Retries are automatic for 429 (rate limit) and 5xx errors
|
|
178
|
+
const data = await client.get('/endpoint', { retries: 3, timeout: 30000 });
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Adding New API Modules
|
|
182
|
+
|
|
183
|
+
1. Create file in `src/api/` following `example.ts` pattern
|
|
184
|
+
2. Add to exports in `src/api/index.ts`
|
|
185
|
+
3. Add types in `src/types/index.ts`
|
|
186
|
+
4. Add CLI commands in `src/cli/index.ts`
|
|
187
|
+
|
|
188
|
+
## TODO Markers
|
|
189
|
+
|
|
190
|
+
When customizing this scaffold, search for `TODO` comments:
|
|
191
|
+
|
|
192
|
+
- `src/cli/index.ts:22-24` - CONNECTOR_NAME, VERSION, description
|
|
193
|
+
- `src/utils/config.ts:5-6` - CONNECTOR_NAME, env var prefix
|
|
194
|
+
- `src/utils/auth.ts:10-15` - OAuth URLs and scopes
|
|
195
|
+
- `src/api/client.ts:5` - DEFAULT_BASE_URL
|
|
196
|
+
- `src/api/client.ts:55-60` - Authentication method
|
|
197
|
+
- `src/api/index.ts:7` - Rename Connector class
|
|
198
|
+
- `src/types/index.ts` - Replace example types
|
|
199
|
+
|
|
200
|
+
## Environment Variables
|
|
201
|
+
|
|
202
|
+
| Variable | Description |
|
|
203
|
+
|----------|-------------|
|
|
204
|
+
| `CONNECTOR_API_KEY` | API key (overrides profile) |
|
|
205
|
+
| `CONNECTOR_TOKEN` | Token (alias for API key) |
|
|
206
|
+
| `CONNECTOR_API_SECRET` | API secret (optional) |
|
|
207
|
+
| `CONNECTOR_BASE_URL` | Override base URL |
|
|
208
|
+
|
|
209
|
+
## CLI Global Flags
|
|
210
|
+
|
|
211
|
+
| Flag | Description |
|
|
212
|
+
|------|-------------|
|
|
213
|
+
| `-k, --api-key <key>` | Override API key for this command |
|
|
214
|
+
| `-p, --profile <name>` | Use specific profile |
|
|
215
|
+
| `-f, --format <format>` | Output format (json, pretty, table) |
|
|
216
|
+
| `-v, --verbose` | Enable debug output |
|
|
217
|
+
|
|
218
|
+
## Data Storage
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
~/.connect/{connector-name}/
|
|
222
|
+
├── current_profile # Active profile name
|
|
223
|
+
├── settings.json # User preferences
|
|
224
|
+
├── data/ # Local data storage
|
|
225
|
+
│ └── {entity}/ # Entity-specific storage
|
|
226
|
+
│ └── *.json
|
|
227
|
+
└── profiles/
|
|
228
|
+
├── default.json # Default profile
|
|
229
|
+
└── {name}.json # Named profiles
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Profile JSON structure:
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"apiKey": "sk-xxx",
|
|
236
|
+
"token": "sk-xxx",
|
|
237
|
+
"apiSecret": "optional",
|
|
238
|
+
"accessToken": "oauth-access-token",
|
|
239
|
+
"refreshToken": "oauth-refresh-token",
|
|
240
|
+
"expiresAt": 1234567890,
|
|
241
|
+
"clientId": "oauth-client-id",
|
|
242
|
+
"clientSecret": "oauth-client-secret"
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Dependencies
|
|
247
|
+
|
|
248
|
+
- commander: CLI framework
|
|
249
|
+
- chalk: Terminal styling
|
|
250
|
+
|
|
251
|
+
## Error Handling
|
|
252
|
+
|
|
253
|
+
The scaffold includes enhanced error types:
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import { ConnectorApiError, parseApiError } from './types';
|
|
257
|
+
|
|
258
|
+
try {
|
|
259
|
+
await api.get('/endpoint');
|
|
260
|
+
} catch (err) {
|
|
261
|
+
if (err instanceof ConnectorApiError) {
|
|
262
|
+
if (err.isRateLimited()) {
|
|
263
|
+
// Handle rate limiting
|
|
264
|
+
}
|
|
265
|
+
if (err.isAuthError()) {
|
|
266
|
+
// Handle auth errors
|
|
267
|
+
}
|
|
268
|
+
console.log(err.getUserMessage());
|
|
269
|
+
console.log(err.documentationUrl);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|