@hasna/connectors 0.0.4 → 0.0.6
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 +126 -2
- package/bin/mcp.js +20228 -0
- package/dist/index.js +44 -1
- package/package.json +11 -5
package/dist/index.js
CHANGED
|
@@ -495,7 +495,7 @@ function loadConnectorVersions() {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
// src/lib/installer.ts
|
|
498
|
-
import { existsSync as existsSync2, cpSync, mkdirSync, writeFileSync } from "fs";
|
|
498
|
+
import { existsSync as existsSync2, cpSync, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
499
499
|
import { join as join2, dirname as dirname2 } from "path";
|
|
500
500
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
501
501
|
var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
|
|
@@ -588,6 +588,48 @@ function getInstalledConnectors(targetDir = process.cwd()) {
|
|
|
588
588
|
return f.startsWith("connect-") && statSync(fullPath).isDirectory();
|
|
589
589
|
}).map((f) => f.replace("connect-", ""));
|
|
590
590
|
}
|
|
591
|
+
function getConnectorDocs(name) {
|
|
592
|
+
const connectorPath = getConnectorPath(name);
|
|
593
|
+
const claudeMdPath = join2(connectorPath, "CLAUDE.md");
|
|
594
|
+
if (!existsSync2(claudeMdPath))
|
|
595
|
+
return null;
|
|
596
|
+
const raw = readFileSync2(claudeMdPath, "utf-8");
|
|
597
|
+
return {
|
|
598
|
+
overview: extractSection(raw, "Project Overview"),
|
|
599
|
+
auth: extractSection(raw, "Authentication"),
|
|
600
|
+
envVars: parseEnvVarsTable(extractSection(raw, "Environment Variables")),
|
|
601
|
+
cliCommands: extractSection(raw, "CLI Commands"),
|
|
602
|
+
dataStorage: extractSection(raw, "Data Storage"),
|
|
603
|
+
raw
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function extractSection(markdown, heading) {
|
|
607
|
+
const regex = new RegExp(`^##\\s+${escapeRegex(heading)}\\s*$`, "m");
|
|
608
|
+
const match = regex.exec(markdown);
|
|
609
|
+
if (!match)
|
|
610
|
+
return "";
|
|
611
|
+
const start = match.index + match[0].length;
|
|
612
|
+
const nextHeading = markdown.slice(start).search(/^##\s/m);
|
|
613
|
+
const content = nextHeading === -1 ? markdown.slice(start) : markdown.slice(start, start + nextHeading);
|
|
614
|
+
return content.trim();
|
|
615
|
+
}
|
|
616
|
+
function escapeRegex(str) {
|
|
617
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
618
|
+
}
|
|
619
|
+
function parseEnvVarsTable(section) {
|
|
620
|
+
if (!section)
|
|
621
|
+
return [];
|
|
622
|
+
const vars = [];
|
|
623
|
+
const lines = section.split(`
|
|
624
|
+
`);
|
|
625
|
+
for (const line of lines) {
|
|
626
|
+
const match = line.match(/\|\s*`([^`]+)`\s*\|\s*(.+?)\s*\|/);
|
|
627
|
+
if (match && match[1] !== "Variable") {
|
|
628
|
+
vars.push({ variable: match[1], description: match[2].trim() });
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return vars;
|
|
632
|
+
}
|
|
591
633
|
function removeConnector(name, targetDir = process.cwd()) {
|
|
592
634
|
const { rmSync } = __require("fs");
|
|
593
635
|
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
@@ -609,6 +651,7 @@ export {
|
|
|
609
651
|
getInstalledConnectors,
|
|
610
652
|
getConnectorsByCategory,
|
|
611
653
|
getConnectorPath,
|
|
654
|
+
getConnectorDocs,
|
|
612
655
|
getConnector,
|
|
613
656
|
connectorExists,
|
|
614
657
|
CONNECTORS,
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/connectors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Open source connector library - Install API connectors with a single command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"connectors": "./bin/index.js"
|
|
7
|
+
"connectors": "./bin/index.js",
|
|
8
|
+
"connectors-mcp": "./bin/mcp.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"bin/",
|
|
@@ -21,9 +22,10 @@
|
|
|
21
22
|
"main": "./dist/index.js",
|
|
22
23
|
"types": "./dist/index.d.ts",
|
|
23
24
|
"scripts": {
|
|
24
|
-
"build": "bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/index.ts --outdir ./dist --target bun",
|
|
25
|
+
"build": "bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun",
|
|
25
26
|
"dev": "bun run ./src/cli/index.tsx",
|
|
26
27
|
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "bun test",
|
|
27
29
|
"prepublishOnly": "bun run build"
|
|
28
30
|
},
|
|
29
31
|
"keywords": [
|
|
@@ -35,7 +37,9 @@
|
|
|
35
37
|
"figma",
|
|
36
38
|
"stripe",
|
|
37
39
|
"github",
|
|
38
|
-
"openai"
|
|
40
|
+
"openai",
|
|
41
|
+
"mcp",
|
|
42
|
+
"model-context-protocol"
|
|
39
43
|
],
|
|
40
44
|
"author": "Hasna",
|
|
41
45
|
"license": "MIT",
|
|
@@ -45,6 +49,7 @@
|
|
|
45
49
|
"typescript": "^5"
|
|
46
50
|
},
|
|
47
51
|
"dependencies": {
|
|
52
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
48
53
|
"chalk": "^5.3.0",
|
|
49
54
|
"commander": "^12.1.0",
|
|
50
55
|
"conf": "^13.0.1",
|
|
@@ -52,7 +57,8 @@
|
|
|
52
57
|
"ink-select-input": "^6.0.0",
|
|
53
58
|
"ink-spinner": "^5.0.0",
|
|
54
59
|
"ink-text-input": "^6.0.0",
|
|
55
|
-
"react": "^18.2.0"
|
|
60
|
+
"react": "^18.2.0",
|
|
61
|
+
"zod": "3"
|
|
56
62
|
},
|
|
57
63
|
"engines": {
|
|
58
64
|
"bun": ">=1.0.0"
|