perceptia-mcp 1.1.0 → 1.2.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/dist/cli.js +11 -5
- package/dist/setup.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,15 +4,21 @@ import { runSetup } from "./setup.js";
|
|
|
4
4
|
const args = process.argv.slice(2);
|
|
5
5
|
const command = args[0];
|
|
6
6
|
if (command === "setup") {
|
|
7
|
-
|
|
7
|
+
let apiKey = args[1];
|
|
8
8
|
if (!apiKey) {
|
|
9
|
+
const { createInterface } = await import("node:readline");
|
|
10
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
11
|
+
const ask = (q) => new Promise((res) => rl.question(q, res));
|
|
9
12
|
console.log("Perceptia MCP — Setup");
|
|
10
13
|
console.log("");
|
|
11
|
-
console.log("
|
|
14
|
+
console.log("Get your API key at https://perceptiamcp.com/dashboard");
|
|
12
15
|
console.log("");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
apiKey = (await ask("API Key (ck_live_...): ")).trim();
|
|
17
|
+
rl.close();
|
|
18
|
+
if (!apiKey) {
|
|
19
|
+
console.error("No API key provided. Exiting.");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
23
|
await runSetup(apiKey);
|
|
18
24
|
}
|
package/dist/setup.js
CHANGED
|
@@ -85,7 +85,7 @@ function setupHook(configPath, apiKey) {
|
|
|
85
85
|
if (-not $query) { exit 0 }
|
|
86
86
|
try {
|
|
87
87
|
$body = @{ query = $query } | ConvertTo-Json -Compress
|
|
88
|
-
$headers = @{ "Authorization" = "Bearer ${apiKey}"; "Content-Type" = "application/json"; "X-Fingerprint" = "hook-${apiKey.slice(-8)}" }
|
|
88
|
+
$headers = @{ "Authorization" = "Bearer ${apiKey}"; "Content-Type" = "application/json"; "X-Fingerprint" = "hook-claude-${apiKey.slice(-8)}" }
|
|
89
89
|
$r = Invoke-RestMethod -Uri "https://api.perceptiamcp.com/v1/ground" -Method POST -Body $body -Headers $headers -ErrorAction Stop
|
|
90
90
|
if ($r) { Write-Output $r }
|
|
91
91
|
} catch { exit 0 }
|
|
@@ -99,7 +99,7 @@ BODY=$(printf '{"query":"%s"}' "$QUERY")
|
|
|
99
99
|
RESULT=$(curl -s -f "https://api.perceptiamcp.com/v1/ground" \\
|
|
100
100
|
-H "Authorization: Bearer ${apiKey}" \\
|
|
101
101
|
-H "Content-Type: application/json" \\
|
|
102
|
-
-H "X-Fingerprint: hook-${apiKey.slice(-8)}" \\
|
|
102
|
+
-H "X-Fingerprint: hook-claude-${apiKey.slice(-8)}" \\
|
|
103
103
|
-d "$BODY" 2>/dev/null) || exit 0
|
|
104
104
|
[ -n "$RESULT" ] && echo "$RESULT"
|
|
105
105
|
`, "utf-8");
|