aidex-mcp 1.4.2 → 1.5.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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to AiDex will be documented in this file.
4
4
 
5
+ ## [1.5.0] - 2026-01-31
6
+
7
+ ### Added
8
+ - **`aidex setup`**: Auto-register AiDex as MCP server in all detected AI clients
9
+ - Supports: Claude Code, Claude Desktop, Cursor, Windsurf
10
+ - Cross-platform: Windows, macOS, Linux
11
+ - **`aidex unsetup`**: Remove AiDex registration from all clients
12
+ - **Postinstall hint**: Shows `Run "aidex setup"` after npm install
13
+
5
14
  ## [1.4.2] - 2026-01-31
6
15
 
7
16
  ### Added
package/README.md CHANGED
@@ -106,13 +106,16 @@ The index lives in `.aidex/index.db` (SQLite) - fast, portable, no external depe
106
106
 
107
107
  ## Quick Start
108
108
 
109
- ### 1. Install
109
+ ### 1. Install & Register
110
110
 
111
111
  ```bash
112
112
  npm install -g aidex-mcp
113
+ aidex setup
113
114
  ```
114
115
 
115
- ### 2. Register with your AI assistant
116
+ `aidex setup` automatically detects and registers AiDex with your installed AI clients (Claude Code, Claude Desktop, Cursor, Windsurf). To unregister: `aidex unsetup`.
117
+
118
+ ### 2. Or register manually with your AI assistant
116
119
 
117
120
  **For Claude Code** (`~/.claude/settings.json` or `~/.claude.json`):
118
121
  ```json
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AiDex Setup - Auto-register as MCP server in AI clients
3
+ *
4
+ * Supports: Claude Code, Claude Desktop, Cursor, Windsurf
5
+ */
6
+ export declare function setupMcpClients(): void;
7
+ export declare function unsetupMcpClients(): void;
8
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1,161 @@
1
+ /**
2
+ * AiDex Setup - Auto-register as MCP server in AI clients
3
+ *
4
+ * Supports: Claude Code, Claude Desktop, Cursor, Windsurf
5
+ */
6
+ import { existsSync, readFileSync, writeFileSync } from 'fs';
7
+ import { join } from 'path';
8
+ import { homedir, platform } from 'os';
9
+ // ============================================================
10
+ // MCP Server Entry
11
+ // ============================================================
12
+ const AIDEX_MCP_ENTRY = {
13
+ command: 'aidex',
14
+ args: []
15
+ };
16
+ // ============================================================
17
+ // Client Detection
18
+ // ============================================================
19
+ function getClients() {
20
+ const home = homedir();
21
+ const plat = platform();
22
+ const clients = [];
23
+ // Claude Code
24
+ clients.push({
25
+ name: 'Claude Code',
26
+ configPath: join(home, '.claude', 'settings.json')
27
+ });
28
+ // Claude Desktop
29
+ if (plat === 'win32') {
30
+ const appData = process.env.APPDATA || join(home, 'AppData', 'Roaming');
31
+ clients.push({
32
+ name: 'Claude Desktop',
33
+ configPath: join(appData, 'Claude', 'claude_desktop_config.json')
34
+ });
35
+ }
36
+ else if (plat === 'darwin') {
37
+ clients.push({
38
+ name: 'Claude Desktop',
39
+ configPath: join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
40
+ });
41
+ }
42
+ else {
43
+ clients.push({
44
+ name: 'Claude Desktop',
45
+ configPath: join(home, '.config', 'Claude', 'claude_desktop_config.json')
46
+ });
47
+ }
48
+ // Cursor
49
+ clients.push({
50
+ name: 'Cursor',
51
+ configPath: join(home, '.cursor', 'mcp.json')
52
+ });
53
+ // Windsurf
54
+ clients.push({
55
+ name: 'Windsurf',
56
+ configPath: join(home, '.codeium', 'windsurf', 'mcp_config.json')
57
+ });
58
+ return clients;
59
+ }
60
+ // ============================================================
61
+ // Config Read/Write
62
+ // ============================================================
63
+ function readJsonConfig(filePath) {
64
+ try {
65
+ const content = readFileSync(filePath, 'utf8');
66
+ return { success: true, data: JSON.parse(content) };
67
+ }
68
+ catch (err) {
69
+ if (err.code === 'ENOENT') {
70
+ return { success: false, error: 'not found' };
71
+ }
72
+ if (err instanceof SyntaxError) {
73
+ return { success: false, error: `invalid JSON: ${err.message}` };
74
+ }
75
+ return { success: false, error: String(err) };
76
+ }
77
+ }
78
+ function writeJsonConfig(filePath, data) {
79
+ try {
80
+ const content = JSON.stringify(data, null, 2) + '\n';
81
+ writeFileSync(filePath, content, 'utf8');
82
+ return { success: true };
83
+ }
84
+ catch (err) {
85
+ return { success: false, error: String(err) };
86
+ }
87
+ }
88
+ // ============================================================
89
+ // Setup / Unsetup
90
+ // ============================================================
91
+ export function setupMcpClients() {
92
+ const clients = getClients();
93
+ const results = [];
94
+ let registered = 0;
95
+ console.log('\nAiDex MCP Server Registration');
96
+ console.log('==============================\n');
97
+ for (const client of clients) {
98
+ if (!existsSync(client.configPath)) {
99
+ results.push({ client: client.name, status: 'skipped', configPath: client.configPath });
100
+ console.log(` - ${client.name} (not installed)`);
101
+ continue;
102
+ }
103
+ const config = readJsonConfig(client.configPath);
104
+ if (!config.success || !config.data) {
105
+ results.push({ client: client.name, status: 'error', configPath: client.configPath, message: config.error });
106
+ console.log(` ✗ ${client.name} (${config.error})`);
107
+ continue;
108
+ }
109
+ const data = config.data;
110
+ if (!data.mcpServers || typeof data.mcpServers !== 'object') {
111
+ data.mcpServers = {};
112
+ }
113
+ data.mcpServers.aidex = { ...AIDEX_MCP_ENTRY };
114
+ const writeResult = writeJsonConfig(client.configPath, data);
115
+ if (!writeResult.success) {
116
+ results.push({ client: client.name, status: 'error', configPath: client.configPath, message: writeResult.error });
117
+ console.log(` ✗ ${client.name} (${writeResult.error})`);
118
+ continue;
119
+ }
120
+ registered++;
121
+ results.push({ client: client.name, status: 'registered', configPath: client.configPath });
122
+ console.log(` ✓ ${client.name} (${client.configPath})`);
123
+ }
124
+ console.log(`\nRegistered AiDex with ${registered} client(s).\n`);
125
+ if (registered > 0) {
126
+ console.log('Restart your AI client(s) to activate AiDex.\n');
127
+ }
128
+ }
129
+ export function unsetupMcpClients() {
130
+ const clients = getClients();
131
+ let removed = 0;
132
+ console.log('\nAiDex MCP Server Unregistration');
133
+ console.log('================================\n');
134
+ for (const client of clients) {
135
+ if (!existsSync(client.configPath)) {
136
+ console.log(` - ${client.name} (not installed)`);
137
+ continue;
138
+ }
139
+ const config = readJsonConfig(client.configPath);
140
+ if (!config.success || !config.data) {
141
+ console.log(` ✗ ${client.name} (${config.error})`);
142
+ continue;
143
+ }
144
+ const data = config.data;
145
+ const servers = data.mcpServers;
146
+ if (!servers || !servers.aidex) {
147
+ console.log(` - ${client.name} (not registered)`);
148
+ continue;
149
+ }
150
+ delete servers.aidex;
151
+ const writeResult = writeJsonConfig(client.configPath, data);
152
+ if (!writeResult.success) {
153
+ console.log(` ✗ ${client.name} (${writeResult.error})`);
154
+ continue;
155
+ }
156
+ removed++;
157
+ console.log(` ✓ Removed from ${client.name}`);
158
+ }
159
+ console.log(`\nUnregistered AiDex from ${removed} client(s).\n`);
160
+ }
161
+ //# sourceMappingURL=setup.js.map
package/build/index.js CHANGED
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { createServer } from './server/mcp-server.js';
13
13
  import { scan, init } from './commands/index.js';
14
+ import { setupMcpClients, unsetupMcpClients } from './commands/setup.js';
14
15
  import { PRODUCT_NAME, PRODUCT_NAME_LOWER } from './constants.js';
15
16
  async function main() {
16
17
  const args = process.argv.slice(2);
@@ -63,6 +64,16 @@ async function main() {
63
64
  console.log(` Time: ${result.durationMs}ms`);
64
65
  return;
65
66
  }
67
+ // CLI mode: setup
68
+ if (args[0] === 'setup') {
69
+ setupMcpClients();
70
+ return;
71
+ }
72
+ // CLI mode: unsetup
73
+ if (args[0] === 'unsetup') {
74
+ unsetupMcpClients();
75
+ return;
76
+ }
66
77
  // Default: Start MCP server
67
78
  const server = createServer();
68
79
  await server.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidex-mcp",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "MCP Server providing persistent code indexing for Claude Code",
5
5
  "main": "build/index.js",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "dev": "tsc && node build/index.js",
17
17
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
18
18
  "clean": "rimraf build",
19
+ "postinstall": "node scripts/postinstall.mjs",
19
20
  "prepublishOnly": "npm run build"
20
21
  },
21
22
  "keywords": [
@@ -0,0 +1,2 @@
1
+ // Postinstall hint - shown after npm install -g aidex-mcp
2
+ console.log('\n AiDex installed! Run "aidex setup" to register with your AI clients.\n');