phantom-secrets-mcp 0.2.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.
Files changed (3) hide show
  1. package/bin/cli.js +106 -0
  2. package/install.js +2 -0
  3. package/package.json +30 -0
package/bin/cli.js ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const { existsSync, mkdirSync, unlinkSync } = require("fs");
5
+ const { join } = require("path");
6
+ const https = require("https");
7
+ const { execSync } = require("child_process");
8
+
9
+ const VERSION = "0.2.1";
10
+ const REPO = "ashlrai/phantom-secrets";
11
+ const BINARY_NAME = "phantom-mcp";
12
+ const CACHE_DIR = join(
13
+ process.env.HOME || process.env.USERPROFILE || "/tmp",
14
+ ".phantom-secrets",
15
+ "bin"
16
+ );
17
+
18
+ function getPlatformTarget() {
19
+ const platform = process.platform;
20
+ const arch = process.arch;
21
+
22
+ if (platform === "darwin" && arch === "arm64")
23
+ return "aarch64-apple-darwin";
24
+ if (platform === "darwin" && arch === "x64")
25
+ return "x86_64-apple-darwin";
26
+ if (platform === "linux" && arch === "x64")
27
+ return "x86_64-unknown-linux-gnu";
28
+ if (platform === "linux" && arch === "arm64")
29
+ return "aarch64-unknown-linux-gnu";
30
+
31
+ console.error(
32
+ `Unsupported platform: ${platform}-${arch}. Install from source: cargo install phantom --git https://github.com/${REPO}`
33
+ );
34
+ process.exit(1);
35
+ }
36
+
37
+ function getBinaryPath() {
38
+ return join(CACHE_DIR, BINARY_NAME);
39
+ }
40
+
41
+ function download(url) {
42
+ return new Promise((resolve, reject) => {
43
+ https.get(url, (res) => {
44
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
45
+ return download(res.headers.location).then(resolve).catch(reject);
46
+ }
47
+ if (res.statusCode !== 200) {
48
+ return reject(new Error(`HTTP ${res.statusCode}`));
49
+ }
50
+ const chunks = [];
51
+ res.on("data", (chunk) => chunks.push(chunk));
52
+ res.on("end", () => resolve(Buffer.concat(chunks)));
53
+ res.on("error", reject);
54
+ }).on("error", reject);
55
+ });
56
+ }
57
+
58
+ async function ensureBinary() {
59
+ const binaryPath = getBinaryPath();
60
+
61
+ if (existsSync(binaryPath)) {
62
+ return binaryPath;
63
+ }
64
+
65
+ const target = getPlatformTarget();
66
+ const tarball = `phantom-${target}.tar.gz`;
67
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${tarball}`;
68
+
69
+ console.error(`Downloading phantom-mcp v${VERSION} for ${target}...`);
70
+ mkdirSync(CACHE_DIR, { recursive: true });
71
+
72
+ const tarPath = join(CACHE_DIR, tarball);
73
+
74
+ try {
75
+ const data = await download(url);
76
+ require("fs").writeFileSync(tarPath, data);
77
+
78
+ execSync(`tar xzf "${tarPath}" -C "${CACHE_DIR}"`, { stdio: "pipe" });
79
+ execSync(`chmod +x "${binaryPath}"`, { stdio: "pipe" });
80
+
81
+ unlinkSync(tarPath);
82
+
83
+ console.error(`Installed phantom-mcp to ${binaryPath}`);
84
+ } catch (err) {
85
+ console.error(`Failed to download phantom-mcp: ${err.message}`);
86
+ console.error(
87
+ `Install from source: cargo install phantom --git https://github.com/${REPO}`
88
+ );
89
+ process.exit(1);
90
+ }
91
+
92
+ return binaryPath;
93
+ }
94
+
95
+ async function main() {
96
+ const binary = await ensureBinary();
97
+ const args = process.argv.slice(2);
98
+
99
+ try {
100
+ execFileSync(binary, args, { stdio: "inherit" });
101
+ } catch (err) {
102
+ process.exit(err.status || 1);
103
+ }
104
+ }
105
+
106
+ main();
package/install.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ console.log("phantom-secrets-mcp will download on first use.");
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "phantom-secrets-mcp",
3
+ "version": "0.2.1",
4
+ "description": "MCP server for Phantom Secrets — lets AI tools manage API keys safely",
5
+ "bin": {
6
+ "phantom-secrets-mcp": "bin/cli.js",
7
+ "phantom-mcp": "bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node install.js"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/ashlrai/phantom-secrets"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "secrets",
20
+ "security",
21
+ "ai-safety",
22
+ "claude",
23
+ "cursor",
24
+ "phantom"
25
+ ],
26
+ "author": "Ashlar AI",
27
+ "license": "MIT",
28
+ "homepage": "https://phm.dev/",
29
+ "mcpName": "io.github.ashlrai/phantom-secrets-mcp"
30
+ }