@signaliz/sdk 1.0.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/README.md +98 -0
- package/dist/chunk-R657OZE7.mjs +543 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +599 -0
- package/dist/cli.mjs +62 -0
- package/dist/index.d.mts +311 -0
- package/dist/index.d.ts +311 -0
- package/dist/index.js +570 -0
- package/dist/index.mjs +8 -0
- package/dist/mcp-config.d.mts +1 -0
- package/dist/mcp-config.d.ts +1 -0
- package/dist/mcp-config.js +687 -0
- package/dist/mcp-config.mjs +126 -0
- package/package.json +35 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
Signaliz
|
|
4
|
+
} from "./chunk-R657OZE7.mjs";
|
|
5
|
+
|
|
6
|
+
// src/mcp-config.ts
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import * as os from "os";
|
|
10
|
+
import * as readline from "readline";
|
|
11
|
+
var MCP_ENDPOINT = "https://api.signaliz.com/functions/v1/signaliz-mcp";
|
|
12
|
+
function detectAgent() {
|
|
13
|
+
const home = os.homedir();
|
|
14
|
+
const claudePath = path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
15
|
+
if (fs.existsSync(path.dirname(claudePath))) {
|
|
16
|
+
return { name: "Claude Desktop", configPath: claudePath, wrapperKey: "mcpServers" };
|
|
17
|
+
}
|
|
18
|
+
const cursorPath = path.join(process.cwd(), ".cursor", "mcp.json");
|
|
19
|
+
if (fs.existsSync(path.dirname(cursorPath))) {
|
|
20
|
+
return { name: "Cursor", configPath: cursorPath, wrapperKey: "mcpServers" };
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
name: "generic MCP client",
|
|
24
|
+
configPath: path.join(process.cwd(), ".mcp", "config.json"),
|
|
25
|
+
wrapperKey: "mcpServers"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function prompt(question) {
|
|
29
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
rl.question(question, (answer) => {
|
|
32
|
+
rl.close();
|
|
33
|
+
resolve(answer.trim());
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function generateMcpConfig(apiKey) {
|
|
38
|
+
return {
|
|
39
|
+
signaliz: {
|
|
40
|
+
transport: "streamable-http",
|
|
41
|
+
url: `${MCP_ENDPOINT}?api_key=${apiKey}`
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async function handleSetup(apiKey) {
|
|
46
|
+
const agent = detectAgent();
|
|
47
|
+
if (!agent) {
|
|
48
|
+
console.error("\u274C Could not detect agent environment.");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const mcpConfig = generateMcpConfig(apiKey);
|
|
52
|
+
let existingConfig = {};
|
|
53
|
+
if (fs.existsSync(agent.configPath)) {
|
|
54
|
+
try {
|
|
55
|
+
existingConfig = JSON.parse(fs.readFileSync(agent.configPath, "utf-8"));
|
|
56
|
+
} catch {
|
|
57
|
+
existingConfig = {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!existingConfig[agent.wrapperKey]) {
|
|
61
|
+
existingConfig[agent.wrapperKey] = {};
|
|
62
|
+
}
|
|
63
|
+
existingConfig[agent.wrapperKey].signaliz = mcpConfig.signaliz;
|
|
64
|
+
fs.mkdirSync(path.dirname(agent.configPath), { recursive: true });
|
|
65
|
+
fs.writeFileSync(agent.configPath, JSON.stringify(existingConfig, null, 2));
|
|
66
|
+
console.log(`
|
|
67
|
+
\u2705 Signaliz connected to ${agent.name}.`);
|
|
68
|
+
console.log(` Config written to: ${agent.configPath}`);
|
|
69
|
+
console.log(` Restart ${agent.name} to activate.
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
async function handleTest(apiKey) {
|
|
73
|
+
const signaliz = new Signaliz({ apiKey });
|
|
74
|
+
try {
|
|
75
|
+
const ws = await signaliz.getWorkspace();
|
|
76
|
+
console.log(`\u2705 Connected to workspace: ${ws.name} (${ws.creditsRemaining.toLocaleString()} credits remaining)`);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.error(`\u274C Connection failed: ${e.message}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function handleTools(apiKey) {
|
|
83
|
+
const signaliz = new Signaliz({ apiKey });
|
|
84
|
+
try {
|
|
85
|
+
const tools = await signaliz.listTools();
|
|
86
|
+
console.log(`
|
|
87
|
+
\u{1F4CB} Available tools (${tools.length}):
|
|
88
|
+
`);
|
|
89
|
+
console.log("Name".padEnd(40) + "Category".padEnd(15) + "Credits".padEnd(10) + "Description");
|
|
90
|
+
console.log("\u2500".repeat(100));
|
|
91
|
+
for (const t of tools) {
|
|
92
|
+
console.log(
|
|
93
|
+
(t.name ?? "").padEnd(40) + (t.category ?? "-").padEnd(15) + String(t.costCredits ?? "-").padEnd(10) + (t.description ?? "").slice(0, 60)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.error(`\u274C Failed to list tools: ${e.message}`);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function main() {
|
|
102
|
+
const command = process.argv[2];
|
|
103
|
+
let apiKey = process.env.SIGNALIZ_API_KEY;
|
|
104
|
+
if (!apiKey && command !== "test" && command !== "tools") {
|
|
105
|
+
apiKey = await prompt("Enter your Signaliz API key (sk_...): ");
|
|
106
|
+
}
|
|
107
|
+
if (!apiKey) {
|
|
108
|
+
console.error("\u274C API key is required. Set SIGNALIZ_API_KEY or enter it when prompted.");
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
switch (command) {
|
|
112
|
+
case "test":
|
|
113
|
+
await handleTest(apiKey);
|
|
114
|
+
break;
|
|
115
|
+
case "tools":
|
|
116
|
+
await handleTools(apiKey);
|
|
117
|
+
break;
|
|
118
|
+
default:
|
|
119
|
+
await handleSetup(apiKey);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
main().catch((e) => {
|
|
124
|
+
console.error(e);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@signaliz/sdk",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Signaliz SDK — GTM intelligence for AI agents",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"signaliz": "./dist/cli.js",
|
|
10
|
+
"signaliz-mcp": "./dist/mcp-config.js"
|
|
11
|
+
},
|
|
12
|
+
"files": ["dist", "README.md"],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"generate-types": "tsx scripts/generate-types.ts",
|
|
15
|
+
"build": "npm run generate-types && tsup src/index.ts src/cli.ts src/mcp-config.ts --format cjs,esm --dts --clean",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": ["signaliz", "mcp", "ai-agents", "gtm", "email-finder", "enrichment"],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/signaliz/sdk"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^24.0.0",
|
|
30
|
+
"openapi-typescript": "^7.4.0",
|
|
31
|
+
"tsup": "^8.0.0",
|
|
32
|
+
"tsx": "^4.19.0",
|
|
33
|
+
"typescript": "^5.3.0"
|
|
34
|
+
}
|
|
35
|
+
}
|