aidex-mcp 1.4.1 → 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,25 @@
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
+
14
+ ## [1.4.2] - 2026-01-31
15
+
16
+ ### Added
17
+ - **npm package**: Published as `aidex-mcp` on npm (`npm install -g aidex-mcp`)
18
+ - **Dual CLI commands**: Both `aidex` and `aidex-mcp` work as command names
19
+ - **npm-publish.bat**: Script for easy npm publishing
20
+
21
+ ### Changed
22
+ - README updated with npm install instructions
23
+
5
24
  ## [1.4.1] - 2026-01-31
6
25
 
7
26
  ### Fixed
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # AiDex
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/aidex-mcp.svg)](https://www.npmjs.com/package/aidex-mcp)
3
4
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
4
5
  [![Node.js 18+](https://img.shields.io/badge/Node.js-18%2B-brightgreen.svg)](https://nodejs.org/)
5
6
  [![MCP Server](https://img.shields.io/badge/MCP-Server-blue.svg)](https://modelcontextprotocol.io/)
@@ -105,15 +106,16 @@ The index lives in `.aidex/index.db` (SQLite) - fast, portable, no external depe
105
106
 
106
107
  ## Quick Start
107
108
 
108
- ### 1. Install
109
+ ### 1. Install & Register
109
110
 
110
111
  ```bash
111
- git clone https://github.com/CSCSoftware/AiDex.git
112
- cd AiDex
113
- npm install && npm run build
112
+ npm install -g aidex-mcp
113
+ aidex setup
114
114
  ```
115
115
 
116
- ### 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
117
119
 
118
120
  **For Claude Code** (`~/.claude/settings.json` or `~/.claude.json`):
119
121
  ```json
@@ -121,8 +123,7 @@ npm install && npm run build
121
123
  "mcpServers": {
122
124
  "aidex": {
123
125
  "type": "stdio",
124
- "command": "node",
125
- "args": ["/path/to/AiDex/build/index.js"],
126
+ "command": "aidex",
126
127
  "env": {}
127
128
  }
128
129
  }
@@ -134,13 +135,14 @@ npm install && npm run build
134
135
  {
135
136
  "mcpServers": {
136
137
  "aidex": {
137
- "command": "node",
138
- "args": ["/path/to/AiDex/build/index.js"]
138
+ "command": "aidex"
139
139
  }
140
140
  }
141
141
  }
142
142
  ```
143
143
 
144
+ > **Note:** Both `aidex` and `aidex-mcp` work as command names.
145
+
144
146
  > **Important:** The server name in your config determines the MCP tool prefix. Use `"aidex"` as shown above — this gives you tool names like `aidex_query`, `aidex_signature`, etc. Using a different name (e.g., `"codegraph"`) would change the prefix accordingly.
145
147
 
146
148
  **For other MCP clients**: See your client's documentation for MCP server configuration.
@@ -263,10 +265,12 @@ Close with `aidex_viewer({ path: ".", action: "close" })`
263
265
  ## CLI Usage
264
266
 
265
267
  ```bash
266
- node build/index.js scan Q:/develop # Find all indexed projects
267
- node build/index.js init ./myproject # Index a project from command line
268
+ aidex scan Q:/develop # Find all indexed projects
269
+ aidex init ./myproject # Index a project from command line
268
270
  ```
269
271
 
272
+ > `aidex-mcp` works as an alias for `aidex`.
273
+
270
274
  ## Performance
271
275
 
272
276
  | Project | Files | Items | Index Time | Query Time |
@@ -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,10 +1,11 @@
1
1
  {
2
2
  "name": "aidex-mcp",
3
- "version": "1.4.1",
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": {
7
- "aidex": "build/index.js"
7
+ "aidex": "build/index.js",
8
+ "aidex-mcp": "build/index.js"
8
9
  },
9
10
  "type": "module",
10
11
  "scripts": {
@@ -15,6 +16,7 @@
15
16
  "dev": "tsc && node build/index.js",
16
17
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
17
18
  "clean": "rimraf build",
19
+ "postinstall": "node scripts/postinstall.mjs",
18
20
  "prepublishOnly": "npm run build"
19
21
  },
20
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');