@toleno/mcp 1.0.5 → 1.0.6

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/README.md +4 -1
  2. package/package.json +1 -1
  3. package/setup.js +59 -45
package/README.md CHANGED
@@ -59,10 +59,13 @@ npx @toleno/mcp setup --key tlno_your_key_here
59
59
 
60
60
  | OS | Config file |
61
61
  |----|-------------|
62
- | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
62
+ | Windows (classic) | `%APPDATA%\Claude\claude_desktop_config.json` |
63
+ | Windows (Store app) | `%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude\claude_desktop_config.json` |
63
64
  | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
64
65
  | Linux | `~/.config/Claude/claude_desktop_config.json` |
65
66
 
67
+ > **Tip:** `npx @toleno/mcp setup` auto-detects both Windows paths and writes to all of them.
68
+
66
69
  ```json
67
70
  {
68
71
  "mcpServers": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toleno/mcp",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Toleno Network MCP Server — Manage your Toleno account with Claude AI.",
5
5
  "mcpName": "io.github.tolenonetwork/toleno-mcp",
6
6
  "main": "index.js",
package/setup.js CHANGED
@@ -13,12 +13,16 @@ const readline = require('readline');
13
13
  const https = require('https');
14
14
 
15
15
  // ── Config file paths per OS ─────────────────────────────────────────────────
16
- function getConfigPath() {
16
+ // Returns an array of all possible config paths so we can write to ALL of them.
17
+ // This ensures both classic (EXE) and Windows Store (MSIX) installs are covered.
18
+ function getConfigPaths() {
17
19
  const platform = process.platform;
18
20
  const home = process.env.HOME || process.env.USERPROFILE || '';
19
21
 
20
22
  if (platform === 'win32') {
21
- // 1) Windows Store (MSIX) kurulumu — önce bunu kontrol et
23
+ const paths = [];
24
+
25
+ // 1) Windows Store (MSIX) kurulumu
22
26
  const localAppData = process.env.LOCALAPPDATA || path.join(home, 'AppData', 'Local');
23
27
  const packagesDir = path.join(localAppData, 'Packages');
24
28
  if (fs.existsSync(packagesDir)) {
@@ -26,23 +30,23 @@ function getConfigPath() {
26
30
  const entries = fs.readdirSync(packagesDir);
27
31
  const claudePackage = entries.find(e => e.startsWith('Claude_'));
28
32
  if (claudePackage) {
29
- const storePath = path.join(packagesDir, claudePackage, 'LocalCache', 'Roaming', 'Claude', 'claude_desktop_config.json');
30
- if (fs.existsSync(storePath) || !fs.existsSync(path.join(home, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json'))) {
31
- return storePath;
32
- }
33
+ paths.push(path.join(packagesDir, claudePackage, 'LocalCache', 'Roaming', 'Claude', 'claude_desktop_config.json'));
33
34
  }
34
35
  } catch {}
35
36
  }
37
+
36
38
  // 2) Klasik kurulum (Program Files / EXE installer)
37
39
  const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
38
- return path.join(appData, 'Claude', 'claude_desktop_config.json');
40
+ paths.push(path.join(appData, 'Claude', 'claude_desktop_config.json'));
41
+
42
+ return paths;
39
43
  }
40
44
  if (platform === 'darwin') {
41
- return path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
45
+ return [path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')];
42
46
  }
43
47
  // Linux
44
48
  const configDir = process.env.XDG_CONFIG_HOME || path.join(home, '.config');
45
- return path.join(configDir, 'Claude', 'claude_desktop_config.json');
49
+ return [path.join(configDir, 'Claude', 'claude_desktop_config.json')];
46
50
  }
47
51
 
48
52
  // ── API key validation ───────────────────────────────────────────────────────
@@ -115,49 +119,59 @@ async function setup() {
115
119
  }
116
120
  console.log('✓');
117
121
 
118
- // 3) Find config file
119
- const configPath = getConfigPath();
120
- const configDir = path.dirname(configPath);
121
- console.log(` Config file: ${configPath}`);
122
-
123
- // 4) Read existing config or create new
124
- let config = {};
125
- if (fs.existsSync(configPath)) {
126
- try {
127
- const raw = fs.readFileSync(configPath, 'utf-8');
128
- config = JSON.parse(raw);
129
- console.log(' Existing config found — merging...');
130
- } catch (err) {
131
- console.error(`\n ✗ Could not parse existing config: ${err.message}`);
132
- console.error(' Please fix the JSON manually or delete the file and retry.');
133
- process.exit(1);
134
- }
135
- } else {
136
- console.log(' No existing config — creating new...');
137
- // Ensure directory exists
138
- fs.mkdirSync(configDir, { recursive: true });
139
- }
140
-
141
- // 5) Add/update Toleno entry
142
- if (!config.mcpServers) {
143
- config.mcpServers = {};
144
- }
145
-
122
+ // 3) Find all config paths (both Store and classic on Windows)
123
+ const configPaths = getConfigPaths();
146
124
  const SERVER_KEY = 'Toleno Network';
147
- const hadExisting = !!config.mcpServers[SERVER_KEY];
148
- config.mcpServers[SERVER_KEY] = {
125
+ const mcpEntry = {
149
126
  command: 'npx',
150
127
  args: ['-y', '@toleno/mcp'],
151
- env: {
152
- TOLENO_API_KEY: apiKey
153
- }
128
+ env: { TOLENO_API_KEY: apiKey }
154
129
  };
155
130
 
156
- // 6) Write config
157
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
131
+ let writtenCount = 0;
132
+
133
+ for (const configPath of configPaths) {
134
+ const configDir = path.dirname(configPath);
135
+ console.log(` Config: ${configPath}`);
136
+
137
+ // 4) Read existing config or create new
138
+ let config = {};
139
+ if (fs.existsSync(configPath)) {
140
+ try {
141
+ const raw = fs.readFileSync(configPath, 'utf-8');
142
+ config = JSON.parse(raw);
143
+ } catch (err) {
144
+ console.log(` ⚠ Could not parse — skipping (${err.message})`);
145
+ continue;
146
+ }
147
+ } else {
148
+ // Ensure directory exists
149
+ try {
150
+ fs.mkdirSync(configDir, { recursive: true });
151
+ } catch {
152
+ console.log(` ⚠ Could not create directory — skipping`);
153
+ continue;
154
+ }
155
+ }
156
+
157
+ // 5) Add/update Toleno entry
158
+ if (!config.mcpServers) config.mcpServers = {};
159
+ const hadExisting = !!config.mcpServers[SERVER_KEY];
160
+ config.mcpServers[SERVER_KEY] = mcpEntry;
161
+
162
+ // 6) Write config
163
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
164
+ console.log(` ✓ ${hadExisting ? 'Updated' : 'Added'}`);
165
+ writtenCount++;
166
+ }
167
+
168
+ if (writtenCount === 0) {
169
+ console.error('\n ✗ Could not write to any Claude Desktop config file.');
170
+ process.exit(1);
171
+ }
158
172
 
159
173
  console.log('');
160
- console.log(` ✓ ${hadExisting ? 'Updated' : 'Added'} Toleno MCP server to Claude Desktop config`);
174
+ console.log(` ✓ Wrote to ${writtenCount} config file${writtenCount > 1 ? 's' : ''}`);
161
175
  console.log('');
162
176
  console.log(' ┌─────────────────────────────────────────┐');
163
177
  console.log(' │ Now restart Claude Desktop to connect! │');