@vesxo/connect 1.0.0 → 1.0.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/index.js +66 -16
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8,11 +8,11 @@ const args = process.argv.slice(2);
|
|
|
8
8
|
const token = args.find(arg => arg.startsWith('--token='))?.split('=')[1];
|
|
9
9
|
|
|
10
10
|
if (!token) {
|
|
11
|
-
console.error('
|
|
11
|
+
console.error('Error: Please provide your API token using --token=YOUR_TOKEN');
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// Claude Config
|
|
15
|
+
// Locate Claude Config Path (Windows & Mac)
|
|
16
16
|
const configPath = os.platform() === 'win32'
|
|
17
17
|
? path.join(process.env.APPDATA, 'Claude', 'claude_desktop_config.json')
|
|
18
18
|
: path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
@@ -20,10 +20,10 @@ const configPath = os.platform() === 'win32'
|
|
|
20
20
|
const installDir = path.join(os.homedir(), '.vesxo');
|
|
21
21
|
const bridgePath = path.join(installDir, 'mcp-bridge.mjs');
|
|
22
22
|
|
|
23
|
-
// 1. .vesxo
|
|
23
|
+
// 1. Create .vesxo directory
|
|
24
24
|
if (!fs.existsSync(installDir)) fs.mkdirSync(installDir);
|
|
25
25
|
|
|
26
|
-
// 2. Bridge
|
|
26
|
+
// 2. Create Bridge file (English Template)
|
|
27
27
|
const bridgeContent = `
|
|
28
28
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
29
29
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -45,43 +45,93 @@ const DEVICE_NAME = \`\${os.hostname()} (\${os.platform()})\`;
|
|
|
45
45
|
|
|
46
46
|
const server = new Server({
|
|
47
47
|
name: "vesxo-guardian",
|
|
48
|
-
version: "1.0.
|
|
48
|
+
version: "1.0.2",
|
|
49
49
|
}, {
|
|
50
50
|
capabilities: { tools: {} },
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
54
54
|
tools: [
|
|
55
|
-
{
|
|
56
|
-
|
|
55
|
+
{
|
|
56
|
+
name: "vesxo_secure_handshake",
|
|
57
|
+
description: "Initialize a secure connection with Vesxo Guardian and register this device.",
|
|
58
|
+
inputSchema: { type: "object" }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "gmail_list_messages",
|
|
62
|
+
description: "List your Gmail messages.",
|
|
63
|
+
inputSchema: { type: "object", properties: { q: { type: "string" } } }
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "gmail_send_message",
|
|
67
|
+
description: "Send a new email via Gmail.",
|
|
68
|
+
inputSchema: {
|
|
69
|
+
type: "object",
|
|
70
|
+
properties: {
|
|
71
|
+
to: { type: "string" },
|
|
72
|
+
subject: { type: "string" },
|
|
73
|
+
body: { type: "string" }
|
|
74
|
+
},
|
|
75
|
+
required: ["to", "subject", "body"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
57
78
|
]
|
|
58
79
|
}));
|
|
59
80
|
|
|
60
81
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
61
82
|
const { name, arguments: args } = req.params;
|
|
62
|
-
let action = name
|
|
63
|
-
let
|
|
83
|
+
let action = name;
|
|
84
|
+
let slug = "";
|
|
85
|
+
|
|
86
|
+
if (name === "vesxo_secure_handshake") {
|
|
87
|
+
try {
|
|
88
|
+
const res = await axios.post(\`\${GATEWAY_URL}/api/gateway/handshake\`, {
|
|
89
|
+
agent_name: DEVICE_NAME,
|
|
90
|
+
fingerprint: FINGERPRINT
|
|
91
|
+
}, {
|
|
92
|
+
headers: { "Authorization": \`Bearer \${API_TOKEN}\` }
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
content: [{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: \`🔒 GUARDIAN: \${res.data.message}\\nDevice: \${DEVICE_NAME}\\nID: \${FINGERPRINT.substring(0, 8)}...\`
|
|
98
|
+
}]
|
|
99
|
+
};
|
|
100
|
+
} catch (err) {
|
|
101
|
+
return { isError: true, content: [{ type: "text", text: "Handshake Failed: " + (err.response?.data?.message || err.message) }] };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (name.startsWith("gmail_")) { slug = "gmail"; action = name.replace("gmail_", ""); }
|
|
64
106
|
|
|
65
107
|
try {
|
|
66
|
-
const res = await axios.post(\`\${GATEWAY_URL}/api/gateway/\${
|
|
108
|
+
const res = await axios.post(\`\${GATEWAY_URL}/api/gateway/\${slug}?action=\${action}\`, args || {}, {
|
|
67
109
|
headers: {
|
|
68
110
|
"Authorization": \`Bearer \${API_TOKEN}\`,
|
|
111
|
+
"Content-Type": "application/json",
|
|
69
112
|
"x-vesxo-fingerprint": FINGERPRINT
|
|
70
113
|
}
|
|
71
114
|
});
|
|
72
115
|
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
|
|
73
116
|
} catch (err) {
|
|
74
|
-
|
|
117
|
+
if (err.response?.status === 403) {
|
|
118
|
+
return { content: [{ type: "text", text: "🚫 ACCESS DENIED: " + err.response.data.message }] };
|
|
119
|
+
}
|
|
120
|
+
return { isError: true, content: [{ type: "text", text: "Error: " + (err.response?.data?.message || err.message) }] };
|
|
75
121
|
}
|
|
76
122
|
});
|
|
77
123
|
|
|
78
124
|
const transport = new StdioServerTransport();
|
|
79
125
|
await server.connect(transport);
|
|
126
|
+
console.error("Vesxo Guardian Bridge is Live! 🛡️");
|
|
80
127
|
`;
|
|
81
128
|
|
|
82
129
|
fs.writeFileSync(bridgePath, bridgeContent.trim());
|
|
83
130
|
|
|
84
|
-
// 3. Claude Config
|
|
131
|
+
// 3. Update Claude Config
|
|
132
|
+
const configDir = path.dirname(configPath);
|
|
133
|
+
if (!fs.existsSync(configDir)) fs.mkdirSync(configDir, { recursive: true });
|
|
134
|
+
|
|
85
135
|
let config = { mcpServers: {} };
|
|
86
136
|
if (fs.existsSync(configPath)) {
|
|
87
137
|
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
@@ -94,7 +144,7 @@ config.mcpServers.vesxo = {
|
|
|
94
144
|
|
|
95
145
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
96
146
|
|
|
97
|
-
console.log('✅ VESXO
|
|
98
|
-
console.log('1. Claude Desktop
|
|
99
|
-
console.log('2.
|
|
100
|
-
console.log('3.
|
|
147
|
+
console.log('✅ VESXO INSTALLATION SUCCESSFUL!');
|
|
148
|
+
console.log('1. Restart your Claude Desktop app.');
|
|
149
|
+
console.log('2. Run "vesxo_secure_handshake" command in Claude.');
|
|
150
|
+
console.log('3. Approve the connection from your Vesxo Dashboard.');
|