perceptia-mcp 1.1.0 → 1.3.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 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
- const apiKey = args[1];
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("Usage: npx perceptia-mcp setup <API_KEY>");
14
+ console.log("Get your API key at https://perceptiamcp.com/dashboard");
12
15
  console.log("");
13
- console.log(" API_KEY Your Perceptia API key (starts with ck_live_)");
14
- console.log(" Get one at https://perceptiamcp.com/dashboard");
15
- process.exit(1);
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
@@ -81,11 +81,14 @@ function setupHook(configPath, apiKey) {
81
81
  const scriptName = isWin ? "perceptia-ground.ps1" : "perceptia-ground.sh";
82
82
  const scriptPath = path.join(hooksDir, scriptName);
83
83
  if (isWin) {
84
- fs.writeFileSync(scriptPath, `$query = $env:CLAUDE_USER_PROMPT
85
- if (-not $query) { exit 0 }
84
+ fs.writeFileSync(scriptPath, `$json = [Console]::In.ReadToEnd()
85
+ if (-not $json) { exit 0 }
86
86
  try {
87
+ $data = $json | ConvertFrom-Json
88
+ $query = $data.prompt
89
+ if (-not $query) { exit 0 }
87
90
  $body = @{ query = $query } | ConvertTo-Json -Compress
88
- $headers = @{ "Authorization" = "Bearer ${apiKey}"; "Content-Type" = "application/json"; "X-Fingerprint" = "hook-${apiKey.slice(-8)}" }
91
+ $headers = @{ "Authorization" = "Bearer ${apiKey}"; "Content-Type" = "application/json"; "X-Fingerprint" = "hook-claude-${apiKey.slice(-8)}" }
89
92
  $r = Invoke-RestMethod -Uri "https://api.perceptiamcp.com/v1/ground" -Method POST -Body $body -Headers $headers -ErrorAction Stop
90
93
  if ($r) { Write-Output $r }
91
94
  } catch { exit 0 }
@@ -93,13 +96,15 @@ try {
93
96
  }
94
97
  else {
95
98
  fs.writeFileSync(scriptPath, `#!/bin/bash
96
- QUERY="$CLAUDE_USER_PROMPT"
99
+ JSON=$(cat)
100
+ [ -z "$JSON" ] && exit 0
101
+ QUERY=$(echo "$JSON" | jq -r '.prompt // empty' 2>/dev/null)
97
102
  [ -z "$QUERY" ] && exit 0
98
- BODY=$(printf '{"query":"%s"}' "$QUERY")
103
+ BODY=$(jq -n --arg q "$QUERY" '{query: $q}')
99
104
  RESULT=$(curl -s -f "https://api.perceptiamcp.com/v1/ground" \\
100
105
  -H "Authorization: Bearer ${apiKey}" \\
101
106
  -H "Content-Type: application/json" \\
102
- -H "X-Fingerprint: hook-${apiKey.slice(-8)}" \\
107
+ -H "X-Fingerprint: hook-claude-${apiKey.slice(-8)}" \\
103
108
  -d "$BODY" 2>/dev/null) || exit 0
104
109
  [ -n "$RESULT" ] && echo "$RESULT"
105
110
  `, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perceptia-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "MCP server for Perceptia grounding API — one command setup for Claude, Cursor, and more",
5
5
  "type": "module",
6
6
  "bin": {