@vesxo/connect 1.0.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/index.js +100 -0
- package/package.json +19 -0
package/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const token = args.find(arg => arg.startsWith('--token='))?.split('=')[1];
|
|
9
|
+
|
|
10
|
+
if (!token) {
|
|
11
|
+
console.error('Hata: Lütfen --token=ANAH_TARINIZ şeklinde anahtarınızı belirtin.');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Claude Config Yolunu Bul (Windows & Mac)
|
|
16
|
+
const configPath = os.platform() === 'win32'
|
|
17
|
+
? path.join(process.env.APPDATA, 'Claude', 'claude_desktop_config.json')
|
|
18
|
+
: path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
19
|
+
|
|
20
|
+
const installDir = path.join(os.homedir(), '.vesxo');
|
|
21
|
+
const bridgePath = path.join(installDir, 'mcp-bridge.mjs');
|
|
22
|
+
|
|
23
|
+
// 1. .vesxo klasörünü oluştur
|
|
24
|
+
if (!fs.existsSync(installDir)) fs.mkdirSync(installDir);
|
|
25
|
+
|
|
26
|
+
// 2. Bridge dosyasını oluştur (Şablon)
|
|
27
|
+
const bridgeContent = `
|
|
28
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
29
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
30
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
31
|
+
import axios from "axios";
|
|
32
|
+
import os from "os";
|
|
33
|
+
import crypto from "crypto";
|
|
34
|
+
|
|
35
|
+
const GATEWAY_URL = "https://agentora.vercel.app";
|
|
36
|
+
const API_TOKEN = "${token}";
|
|
37
|
+
|
|
38
|
+
const generateFingerprint = () => {
|
|
39
|
+
const raw = \`\${os.platform()}-\${os.arch()}-\${os.hostname()}\`;
|
|
40
|
+
return crypto.createHash('sha256').update(raw).digest('hex');
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const FINGERPRINT = generateFingerprint();
|
|
44
|
+
const DEVICE_NAME = \`\${os.hostname()} (\${os.platform()})\`;
|
|
45
|
+
|
|
46
|
+
const server = new Server({
|
|
47
|
+
name: "vesxo-guardian",
|
|
48
|
+
version: "1.0.0",
|
|
49
|
+
}, {
|
|
50
|
+
capabilities: { tools: {} },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
54
|
+
tools: [
|
|
55
|
+
{ name: "vesxo_handshake", description: "Vesxo ile güvenli bağ kurar.", inputSchema: { type: "object" } },
|
|
56
|
+
{ name: "gmail_list", description: "Mailleri listeler.", inputSchema: { type: "object" } }
|
|
57
|
+
]
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
61
|
+
const { name, arguments: args } = req.params;
|
|
62
|
+
let action = name === "vesxo_handshake" ? "handshake" : name;
|
|
63
|
+
let endpoint = name === "vesxo_handshake" ? "handshake" : "gmail";
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const res = await axios.post(\`\${GATEWAY_URL}/api/gateway/\${endpoint}?action=\${action}\`, args || {}, {
|
|
67
|
+
headers: {
|
|
68
|
+
"Authorization": \`Bearer \${API_TOKEN}\`,
|
|
69
|
+
"x-vesxo-fingerprint": FINGERPRINT
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
|
|
73
|
+
} catch (err) {
|
|
74
|
+
return { content: [{ type: "text", text: "Hata: " + (err.response?.data?.message || err.message) }] };
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const transport = new StdioServerTransport();
|
|
79
|
+
await server.connect(transport);
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
fs.writeFileSync(bridgePath, bridgeContent.trim());
|
|
83
|
+
|
|
84
|
+
// 3. Claude Config Güncelle
|
|
85
|
+
let config = { mcpServers: {} };
|
|
86
|
+
if (fs.existsSync(configPath)) {
|
|
87
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
config.mcpServers.vesxo = {
|
|
91
|
+
command: "node",
|
|
92
|
+
args: [bridgePath]
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
96
|
+
|
|
97
|
+
console.log('✅ VESXO KURULUMU TAMAMLANDI!');
|
|
98
|
+
console.log('1. Claude Desktop uygulamasını kapatıp açın.');
|
|
99
|
+
console.log('2. İlk olarak "vesxo_handshake" komutunu çalıştırın.');
|
|
100
|
+
console.log('3. Dashboard üzerinden onay verip kullanmaya başlayın.');
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vesxo/connect",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Connect your Claude Desktop to Vesxo Agentic Gateway",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vesxo-connect": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
11
|
+
"axios": "^1.6.0"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18.0.0"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
}
|
|
19
|
+
}
|