vault-go 0.23.0 → 0.23.2
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/mcp-clients.d.ts +12 -0
- package/dist/mcp-clients.js +146 -0
- package/package.json +3 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InstallResult, type McpClient } from "./installer.js";
|
|
2
|
+
export declare const MCP_CLIENT_LABELS: Record<McpClient, string>;
|
|
3
|
+
export interface McpClientState {
|
|
4
|
+
client: McpClient;
|
|
5
|
+
name: string;
|
|
6
|
+
detected: boolean;
|
|
7
|
+
connected: boolean;
|
|
8
|
+
evidence?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function mcpClientConnected(client: McpClient, home?: string, cwd?: string): boolean;
|
|
11
|
+
export declare function listMcpClients(home?: string, cwd?: string): McpClientState[];
|
|
12
|
+
export declare function connectMcpClient(client: McpClient, home?: string, cwd?: string): InstallResult;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir, platform } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { detectMcpClients, installMcpClient, MCP_CLIENTS, vaultDesktopDotMcpPath, vaultDesktopMcpPath, } from "./installer.js";
|
|
6
|
+
export const MCP_CLIENT_LABELS = {
|
|
7
|
+
codex: "Codex",
|
|
8
|
+
claude: "Claude Code",
|
|
9
|
+
"claude-desktop": "Claude Desktop",
|
|
10
|
+
cursor: "Cursor",
|
|
11
|
+
vscode: "VS Code",
|
|
12
|
+
copilot: "GitHub Copilot",
|
|
13
|
+
windsurf: "Windsurf",
|
|
14
|
+
roo: "Roo Code",
|
|
15
|
+
opencode: "OpenCode",
|
|
16
|
+
grok: "Grok",
|
|
17
|
+
agy: "Antigravity",
|
|
18
|
+
gemini: "Gemini CLI",
|
|
19
|
+
"vault-desktop": "Vault Desktop",
|
|
20
|
+
};
|
|
21
|
+
function vscodeMcpPaths(home) {
|
|
22
|
+
if (platform() === "darwin") {
|
|
23
|
+
return [join(home, "Library", "Application Support", "Code", "User", "mcp.json")];
|
|
24
|
+
}
|
|
25
|
+
if (platform() === "win32") {
|
|
26
|
+
return [join(process.env["APPDATA"] ?? join(home, "AppData", "Roaming"), "Code", "User", "mcp.json")];
|
|
27
|
+
}
|
|
28
|
+
return [join(home, ".config", "Code", "User", "mcp.json")];
|
|
29
|
+
}
|
|
30
|
+
function claudeDesktopConfigPath(home) {
|
|
31
|
+
if (platform() === "darwin") {
|
|
32
|
+
return join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
33
|
+
}
|
|
34
|
+
if (platform() === "win32") {
|
|
35
|
+
return join(process.env["APPDATA"] ?? join(home, "AppData", "Roaming"), "Claude", "claude_desktop_config.json");
|
|
36
|
+
}
|
|
37
|
+
return join(home, ".config", "Claude", "claude_desktop_config.json");
|
|
38
|
+
}
|
|
39
|
+
/** Where the installer writes the vault-go entry per client; toml is matched by text. */
|
|
40
|
+
function configLocations(client, home, cwd) {
|
|
41
|
+
switch (client) {
|
|
42
|
+
case "codex":
|
|
43
|
+
case "claude":
|
|
44
|
+
return [];
|
|
45
|
+
case "claude-desktop":
|
|
46
|
+
return [[claudeDesktopConfigPath(home), "mcpServers"]];
|
|
47
|
+
case "cursor":
|
|
48
|
+
return [[join(home, ".cursor", "mcp.json"), "mcpServers"]];
|
|
49
|
+
case "copilot":
|
|
50
|
+
return [[join(home, ".copilot", "mcp-config.json"), "mcpServers"]];
|
|
51
|
+
case "windsurf":
|
|
52
|
+
return [[join(home, ".codeium", "windsurf", "mcp_config.json"), "mcpServers"]];
|
|
53
|
+
case "roo":
|
|
54
|
+
return [[join(cwd, ".roo", "mcp.json"), "mcpServers"]];
|
|
55
|
+
case "vscode":
|
|
56
|
+
return vscodeMcpPaths(home).map((path) => [path, "mcpServers"]);
|
|
57
|
+
case "opencode":
|
|
58
|
+
return [[join(home, ".config", "opencode", "opencode.json"), "mcp"]];
|
|
59
|
+
case "grok":
|
|
60
|
+
return [[join(home, ".grok", "config.toml"), "toml"]];
|
|
61
|
+
case "agy":
|
|
62
|
+
return [
|
|
63
|
+
[join(home, ".gemini", "config", "mcp_config.json"), "mcpServers"],
|
|
64
|
+
[join(home, ".gemini", "antigravity", "mcp_config.json"), "mcpServers"],
|
|
65
|
+
];
|
|
66
|
+
case "gemini":
|
|
67
|
+
return [[join(home, ".gemini", "settings.json"), "mcpServers"]];
|
|
68
|
+
case "vault-desktop":
|
|
69
|
+
return [
|
|
70
|
+
[vaultDesktopMcpPath(home), "mcpServers"],
|
|
71
|
+
[vaultDesktopDotMcpPath(home), "mcpServers"],
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function serverConfiguredInJson(path, rootKey) {
|
|
76
|
+
if (!existsSync(path))
|
|
77
|
+
return false;
|
|
78
|
+
try {
|
|
79
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
80
|
+
const servers = parsed && typeof parsed === "object" ? parsed[rootKey] : undefined;
|
|
81
|
+
return Boolean(servers && typeof servers === "object" && "vault-go" in servers);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function serverConfiguredInToml(path) {
|
|
88
|
+
if (!existsSync(path))
|
|
89
|
+
return false;
|
|
90
|
+
try {
|
|
91
|
+
return readFileSync(path, "utf8").includes("mcp_servers.vault-go");
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function clientCliInstalled(client, home) {
|
|
98
|
+
if (home === homedir())
|
|
99
|
+
return clientCliWithEnv(client, process.env);
|
|
100
|
+
// Why: tests point home at a temp dir; pin each CLI's config env so the
|
|
101
|
+
// check reads the temp config, not the real one.
|
|
102
|
+
return clientCliWithEnv(client, {
|
|
103
|
+
...process.env,
|
|
104
|
+
HOME: home,
|
|
105
|
+
CODEX_HOME: join(home, ".codex"),
|
|
106
|
+
CLAUDE_CONFIG_DIR: join(home, ".claude"),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function clientCliWithEnv(client, env) {
|
|
110
|
+
try {
|
|
111
|
+
return spawnSync(client, ["mcp", "get", "vault-go"], {
|
|
112
|
+
timeout: 4000,
|
|
113
|
+
stdio: "ignore",
|
|
114
|
+
env,
|
|
115
|
+
}).status === 0;
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function mcpClientConnected(client, home = homedir(), cwd = process.cwd()) {
|
|
122
|
+
if (client === "codex" || client === "claude")
|
|
123
|
+
return clientCliInstalled(client, home);
|
|
124
|
+
for (const [path, rootKey] of configLocations(client, home, cwd)) {
|
|
125
|
+
if (rootKey === "toml" ? serverConfiguredInToml(path) : serverConfiguredInJson(path, rootKey)) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
export function listMcpClients(home = homedir(), cwd = process.cwd()) {
|
|
132
|
+
const detected = new Map(detectMcpClients(home).map((item) => [item.client, item]));
|
|
133
|
+
return MCP_CLIENTS.map((client) => {
|
|
134
|
+
const evidence = detected.get(client);
|
|
135
|
+
return {
|
|
136
|
+
client,
|
|
137
|
+
name: MCP_CLIENT_LABELS[client],
|
|
138
|
+
detected: evidence?.detected ?? false,
|
|
139
|
+
connected: mcpClientConnected(client, home, cwd),
|
|
140
|
+
...(evidence?.evidence ? { evidence: evidence.evidence } : {}),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export function connectMcpClient(client, home = homedir(), cwd = process.cwd()) {
|
|
145
|
+
return installMcpClient(client, { home, cwd });
|
|
146
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vault-go",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"description": "MCP server and installer for Vault Memory: search, capture, and use account memory across AI clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -79,6 +79,8 @@
|
|
|
79
79
|
"assets/",
|
|
80
80
|
"README.md",
|
|
81
81
|
"LICENSE",
|
|
82
|
+
"dist/mcp-clients.js",
|
|
83
|
+
"dist/mcp-clients.d.ts",
|
|
82
84
|
"dist/mcp-result.js",
|
|
83
85
|
"dist/mcp-result.d.ts",
|
|
84
86
|
"dist/parity-tools.js",
|