aidex-mcp 1.4.1

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 (76) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/LICENSE +21 -0
  3. package/MCP-API-REFERENCE.md +690 -0
  4. package/README.md +314 -0
  5. package/build/commands/files.d.ts +28 -0
  6. package/build/commands/files.js +124 -0
  7. package/build/commands/index.d.ts +14 -0
  8. package/build/commands/index.js +14 -0
  9. package/build/commands/init.d.ts +24 -0
  10. package/build/commands/init.js +396 -0
  11. package/build/commands/link.d.ts +45 -0
  12. package/build/commands/link.js +167 -0
  13. package/build/commands/note.d.ts +29 -0
  14. package/build/commands/note.js +105 -0
  15. package/build/commands/query.d.ts +36 -0
  16. package/build/commands/query.js +176 -0
  17. package/build/commands/scan.d.ts +25 -0
  18. package/build/commands/scan.js +104 -0
  19. package/build/commands/session.d.ts +52 -0
  20. package/build/commands/session.js +216 -0
  21. package/build/commands/signature.d.ts +52 -0
  22. package/build/commands/signature.js +171 -0
  23. package/build/commands/summary.d.ts +56 -0
  24. package/build/commands/summary.js +324 -0
  25. package/build/commands/update.d.ts +36 -0
  26. package/build/commands/update.js +273 -0
  27. package/build/constants.d.ts +10 -0
  28. package/build/constants.js +10 -0
  29. package/build/db/database.d.ts +69 -0
  30. package/build/db/database.js +126 -0
  31. package/build/db/index.d.ts +7 -0
  32. package/build/db/index.js +6 -0
  33. package/build/db/queries.d.ts +163 -0
  34. package/build/db/queries.js +273 -0
  35. package/build/db/schema.sql +136 -0
  36. package/build/index.d.ts +13 -0
  37. package/build/index.js +74 -0
  38. package/build/parser/extractor.d.ts +41 -0
  39. package/build/parser/extractor.js +249 -0
  40. package/build/parser/index.d.ts +7 -0
  41. package/build/parser/index.js +7 -0
  42. package/build/parser/languages/c.d.ts +28 -0
  43. package/build/parser/languages/c.js +70 -0
  44. package/build/parser/languages/cpp.d.ts +28 -0
  45. package/build/parser/languages/cpp.js +91 -0
  46. package/build/parser/languages/csharp.d.ts +32 -0
  47. package/build/parser/languages/csharp.js +97 -0
  48. package/build/parser/languages/go.d.ts +28 -0
  49. package/build/parser/languages/go.js +83 -0
  50. package/build/parser/languages/index.d.ts +21 -0
  51. package/build/parser/languages/index.js +107 -0
  52. package/build/parser/languages/java.d.ts +28 -0
  53. package/build/parser/languages/java.js +58 -0
  54. package/build/parser/languages/php.d.ts +28 -0
  55. package/build/parser/languages/php.js +75 -0
  56. package/build/parser/languages/python.d.ts +28 -0
  57. package/build/parser/languages/python.js +67 -0
  58. package/build/parser/languages/ruby.d.ts +28 -0
  59. package/build/parser/languages/ruby.js +68 -0
  60. package/build/parser/languages/rust.d.ts +28 -0
  61. package/build/parser/languages/rust.js +73 -0
  62. package/build/parser/languages/typescript.d.ts +28 -0
  63. package/build/parser/languages/typescript.js +82 -0
  64. package/build/parser/tree-sitter.d.ts +30 -0
  65. package/build/parser/tree-sitter.js +132 -0
  66. package/build/server/mcp-server.d.ts +7 -0
  67. package/build/server/mcp-server.js +36 -0
  68. package/build/server/tools.d.ts +18 -0
  69. package/build/server/tools.js +1245 -0
  70. package/build/viewer/git-status.d.ts +25 -0
  71. package/build/viewer/git-status.js +163 -0
  72. package/build/viewer/index.d.ts +5 -0
  73. package/build/viewer/index.js +5 -0
  74. package/build/viewer/server.d.ts +12 -0
  75. package/build/viewer/server.js +1122 -0
  76. package/package.json +66 -0
@@ -0,0 +1,690 @@
1
+ # AiDex MCP API Reference
2
+
3
+ Complete reference for all AiDex MCP tools.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [Indexing](#indexing)
10
+ - [aidex_init](#aidex_init)
11
+ - [aidex_update](#aidex_update)
12
+ - [aidex_remove](#aidex_remove)
13
+ - [Querying](#querying)
14
+ - [aidex_query](#aidex_query)
15
+ - [aidex_signature](#aidex_signature)
16
+ - [aidex_signatures](#aidex_signatures)
17
+ - [Project Info](#project-info)
18
+ - [aidex_status](#aidex_status)
19
+ - [aidex_summary](#aidex_summary)
20
+ - [aidex_tree](#aidex_tree)
21
+ - [aidex_files](#aidex_files)
22
+ - [aidex_describe](#aidex_describe)
23
+ - [Cross-Project](#cross-project)
24
+ - [aidex_link](#aidex_link)
25
+ - [aidex_unlink](#aidex_unlink)
26
+ - [aidex_links](#aidex_links)
27
+ - [aidex_scan](#aidex_scan)
28
+ - [Session Management](#session-management)
29
+ - [aidex_session](#aidex_session)
30
+ - [aidex_note](#aidex_note)
31
+ - [aidex_viewer](#aidex_viewer)
32
+
33
+ ---
34
+
35
+ ## Indexing
36
+
37
+ ### aidex_init
38
+
39
+ Initialize or re-index a project. Creates `.aidex/` directory with SQLite database.
40
+
41
+ **Parameters:**
42
+
43
+ | Name | Type | Required | Description |
44
+ |------|------|----------|-------------|
45
+ | `path` | string | ✅ | Absolute path to the project directory |
46
+ | `name` | string | - | Custom project name (default: directory name) |
47
+ | `exclude` | string[] | - | Additional glob patterns to exclude (e.g., `["**/test/**"]`) |
48
+
49
+ **Returns:**
50
+ - Files indexed count
51
+ - Items/methods/types found
52
+ - Duration in ms
53
+ - Warnings (if any)
54
+
55
+ **Example:**
56
+ ```json
57
+ {
58
+ "path": "/home/user/myproject",
59
+ "exclude": ["**/vendor/**", "**/dist/**"]
60
+ }
61
+ ```
62
+
63
+ ---
64
+
65
+ ### aidex_update
66
+
67
+ Re-index a single file after editing. Detects unchanged files via hash comparison.
68
+
69
+ **Parameters:**
70
+
71
+ | Name | Type | Required | Description |
72
+ |------|------|----------|-------------|
73
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
74
+ | `file` | string | ✅ | Relative path to file within project |
75
+
76
+ **Returns:**
77
+ - Items added/removed
78
+ - Methods/types updated
79
+ - Duration in ms
80
+ - "File unchanged" if hash matches
81
+
82
+ **Example:**
83
+ ```json
84
+ {
85
+ "path": "/home/user/myproject",
86
+ "file": "src/Engine.cs"
87
+ }
88
+ ```
89
+
90
+ ---
91
+
92
+ ### aidex_remove
93
+
94
+ Remove a deleted file from the index.
95
+
96
+ **Parameters:**
97
+
98
+ | Name | Type | Required | Description |
99
+ |------|------|----------|-------------|
100
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
101
+ | `file` | string | ✅ | Relative path to file to remove |
102
+
103
+ **Returns:**
104
+ - Success/failure status
105
+ - Items removed count
106
+
107
+ **Example:**
108
+ ```json
109
+ {
110
+ "path": "/home/user/myproject",
111
+ "file": "src/OldFile.cs"
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Querying
118
+
119
+ ### aidex_query
120
+
121
+ Search for terms/identifiers in the index. **Primary search tool** - use instead of grep/glob.
122
+
123
+ **Parameters:**
124
+
125
+ | Name | Type | Required | Description |
126
+ |------|------|----------|-------------|
127
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
128
+ | `term` | string | ✅ | The term to search for |
129
+ | `mode` | string | - | Search mode: `exact` (default), `contains`, `starts_with` |
130
+ | `file_filter` | string | - | Glob pattern to filter files (e.g., `"src/commands/**"`) |
131
+ | `type_filter` | string[] | - | Filter by line type: `code`, `comment`, `method`, `struct`, `property` |
132
+ | `modified_since` | string | - | Only matches after this time. Formats: `2h`, `30m`, `1d`, `1w`, or ISO date |
133
+ | `modified_before` | string | - | Only matches before this time. Same formats as above |
134
+ | `limit` | number | - | Maximum results (default: 100) |
135
+
136
+ **Returns:**
137
+ - Matches grouped by file with line numbers and types
138
+ - Total match count
139
+ - Truncation indicator if limit reached
140
+
141
+ **Examples:**
142
+
143
+ ```json
144
+ // Find exact term
145
+ { "path": ".", "term": "PlayerHealth" }
146
+
147
+ // Find anything containing "Update"
148
+ { "path": ".", "term": "Update", "mode": "contains" }
149
+
150
+ // Find recent changes
151
+ { "path": ".", "term": "render", "modified_since": "2h" }
152
+
153
+ // Filter by file location
154
+ { "path": ".", "term": "API", "file_filter": "src/server/**" }
155
+
156
+ // Filter by code type
157
+ { "path": ".", "term": "Calculate", "type_filter": ["method"] }
158
+ ```
159
+
160
+ ---
161
+
162
+ ### aidex_signature
163
+
164
+ Get the signature of a single file: types, methods, header comments. **Use instead of reading entire files** when you only need structure.
165
+
166
+ **Parameters:**
167
+
168
+ | Name | Type | Required | Description |
169
+ |------|------|----------|-------------|
170
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
171
+ | `file` | string | ✅ | Relative path to file (e.g., `"src/Core/Engine.cs"`) |
172
+
173
+ **Returns:**
174
+ - Header comments (if any)
175
+ - Types: classes, structs, interfaces, enums with line numbers
176
+ - Methods: prototypes with visibility, static/async modifiers, line numbers
177
+
178
+ **Example:**
179
+ ```json
180
+ {
181
+ "path": "/home/user/myproject",
182
+ "file": "src/Core/Engine.cs"
183
+ }
184
+ ```
185
+
186
+ **Output example:**
187
+ ```
188
+ # Signature: src/Core/Engine.cs
189
+
190
+ ## Header Comments
191
+ Game engine core implementation
192
+
193
+ ## Types (2)
194
+ - class Engine (line 15)
195
+ - struct Config (line 8)
196
+
197
+ ## Methods (5)
198
+ - [public] void Initialize() :20
199
+ - [public async] Task LoadAsync(string path) :45
200
+ - [private] void Update(float delta) :78
201
+ ```
202
+
203
+ ---
204
+
205
+ ### aidex_signatures
206
+
207
+ Get signatures for multiple files at once using glob pattern. Efficient for exploring codebase structure.
208
+
209
+ **Parameters:**
210
+
211
+ | Name | Type | Required | Description |
212
+ |------|------|----------|-------------|
213
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
214
+ | `pattern` | string | - | Glob pattern (e.g., `"src/**/*.cs"`, `"**/*.ts"`) |
215
+ | `files` | string[] | - | Explicit list of file paths (alternative to pattern) |
216
+
217
+ *Note: Provide either `pattern` OR `files`, not both.*
218
+
219
+ **Returns:**
220
+ - Compact summary per file: types and method counts
221
+ - Method list with modifiers and line numbers
222
+
223
+ **Examples:**
224
+ ```json
225
+ // All TypeScript files
226
+ { "path": ".", "pattern": "**/*.ts" }
227
+
228
+ // Specific directory
229
+ { "path": ".", "pattern": "src/commands/**/*.ts" }
230
+
231
+ // Explicit file list
232
+ { "path": ".", "files": ["src/index.ts", "src/server/tools.ts"] }
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Project Info
238
+
239
+ ### aidex_status
240
+
241
+ Get index statistics for a project.
242
+
243
+ **Parameters:**
244
+
245
+ | Name | Type | Required | Description |
246
+ |------|------|----------|-------------|
247
+ | `path` | string | - | Path to project (optional - shows server status if omitted) |
248
+
249
+ **Returns:**
250
+ - Schema version
251
+ - Counts: files, lines, items, occurrences, methods, types, dependencies
252
+ - Database size in bytes
253
+ - Database path
254
+
255
+ **Example:**
256
+ ```json
257
+ { "path": "/home/user/myproject" }
258
+ ```
259
+
260
+ ---
261
+
262
+ ### aidex_summary
263
+
264
+ Get project overview including auto-detected entry points and main types.
265
+
266
+ **Parameters:**
267
+
268
+ | Name | Type | Required | Description |
269
+ |------|------|----------|-------------|
270
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
271
+
272
+ **Returns:**
273
+ - Project name
274
+ - Language breakdown
275
+ - Entry points (main files, index files)
276
+ - Main types (most referenced classes)
277
+ - Custom summary content (from `summary.md`)
278
+
279
+ **Example:**
280
+ ```json
281
+ { "path": "/home/user/myproject" }
282
+ ```
283
+
284
+ ---
285
+
286
+ ### aidex_tree
287
+
288
+ Get file tree with optional statistics per file.
289
+
290
+ **Parameters:**
291
+
292
+ | Name | Type | Required | Description |
293
+ |------|------|----------|-------------|
294
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
295
+ | `subpath` | string | - | Subdirectory to list (default: project root) |
296
+ | `depth` | number | - | Maximum depth to traverse (default: unlimited) |
297
+ | `include_stats` | boolean | - | Include item/method/type counts per file |
298
+
299
+ **Returns:**
300
+ - Hierarchical file tree
301
+ - Optional: counts per file
302
+
303
+ **Examples:**
304
+ ```json
305
+ // Full tree
306
+ { "path": "." }
307
+
308
+ // Specific directory with stats
309
+ { "path": ".", "subpath": "src/commands", "include_stats": true }
310
+
311
+ // Shallow tree
312
+ { "path": ".", "depth": 2 }
313
+ ```
314
+
315
+ ---
316
+
317
+ ### aidex_files
318
+
319
+ List all project files by type. Includes non-code files (config, docs, assets). Supports time-based filtering to find recently changed files.
320
+
321
+ **Parameters:**
322
+
323
+ | Name | Type | Required | Description |
324
+ |------|------|----------|-------------|
325
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
326
+ | `type` | string | - | Filter by type: `dir`, `code`, `config`, `doc`, `asset`, `test`, `other` |
327
+ | `pattern` | string | - | Glob pattern filter (e.g., `"**/*.md"`, `"src/**/*.ts"`) |
328
+ | `modified_since` | string | - | Only files indexed after this time. Formats: `30m`, `2h`, `1d`, `1w`, or ISO date |
329
+
330
+ **Returns:**
331
+ - Files grouped by directory
332
+ - Type statistics
333
+ - Indexed indicator (✓) for code files
334
+ - `lastIndexed` timestamp (when `modified_since` is used)
335
+
336
+ **Examples:**
337
+ ```json
338
+ // All config files
339
+ { "path": ".", "type": "config" }
340
+
341
+ // All markdown files
342
+ { "path": ".", "pattern": "**/*.md" }
343
+
344
+ // All test files
345
+ { "path": ".", "type": "test" }
346
+
347
+ // Files changed in the last 30 minutes (this session)
348
+ { "path": ".", "modified_since": "30m" }
349
+
350
+ // Files changed in the last 2 hours
351
+ { "path": ".", "modified_since": "2h" }
352
+ ```
353
+
354
+ **File type detection:**
355
+
356
+ | Type | Extensions/Patterns |
357
+ |------|---------------------|
358
+ | `code` | `.cs`, `.ts`, `.js`, `.py`, `.rs`, `.go`, `.java`, `.c`, `.cpp`, `.php`, `.rb` |
359
+ | `config` | `.json`, `.yaml`, `.yml`, `.toml`, `.xml`, `.ini`, `.env` |
360
+ | `doc` | `.md`, `.txt`, `.rst`, `.adoc` |
361
+ | `asset` | `.png`, `.jpg`, `.svg`, `.ico`, `.woff`, `.ttf` |
362
+ | `test` | Files in `test/`, `tests/`, `__tests__/` or with `.test.`, `.spec.` |
363
+ | `other` | Everything else |
364
+
365
+ ---
366
+
367
+ ### aidex_describe
368
+
369
+ Add or update sections in the project summary (`summary.md`).
370
+
371
+ **Parameters:**
372
+
373
+ | Name | Type | Required | Description |
374
+ |------|------|----------|-------------|
375
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
376
+ | `section` | string | ✅ | Section to update: `purpose`, `architecture`, `concepts`, `patterns`, `notes` |
377
+ | `content` | string | ✅ | Content to add |
378
+ | `replace` | boolean | - | Replace existing content (default: append) |
379
+
380
+ **Example:**
381
+ ```json
382
+ {
383
+ "path": ".",
384
+ "section": "architecture",
385
+ "content": "This project uses a layered architecture with commands, services, and repositories.",
386
+ "replace": true
387
+ }
388
+ ```
389
+
390
+ ---
391
+
392
+ ## Cross-Project
393
+
394
+ ### aidex_link
395
+
396
+ Link another indexed project as a dependency. Enables cross-project queries.
397
+
398
+ **Parameters:**
399
+
400
+ | Name | Type | Required | Description |
401
+ |------|------|----------|-------------|
402
+ | `path` | string | ✅ | Path to current project |
403
+ | `dependency` | string | ✅ | Path to dependency project (must have `.aidex`) |
404
+ | `name` | string | - | Display name for the dependency |
405
+
406
+ **Returns:**
407
+ - Link status
408
+ - Files available in dependency
409
+
410
+ **Example:**
411
+ ```json
412
+ {
413
+ "path": "/home/user/myapp",
414
+ "dependency": "/home/user/shared-lib",
415
+ "name": "SharedLib"
416
+ }
417
+ ```
418
+
419
+ ---
420
+
421
+ ### aidex_unlink
422
+
423
+ Remove a linked dependency.
424
+
425
+ **Parameters:**
426
+
427
+ | Name | Type | Required | Description |
428
+ |------|------|----------|-------------|
429
+ | `path` | string | ✅ | Path to current project |
430
+ | `dependency` | string | ✅ | Path to dependency to unlink |
431
+
432
+ **Example:**
433
+ ```json
434
+ {
435
+ "path": "/home/user/myapp",
436
+ "dependency": "/home/user/shared-lib"
437
+ }
438
+ ```
439
+
440
+ ---
441
+
442
+ ### aidex_links
443
+
444
+ List all linked dependencies.
445
+
446
+ **Parameters:**
447
+
448
+ | Name | Type | Required | Description |
449
+ |------|------|----------|-------------|
450
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
451
+
452
+ **Returns:**
453
+ - List of linked projects with:
454
+ - Name
455
+ - Path
456
+ - File count
457
+ - Availability status
458
+
459
+ **Example:**
460
+ ```json
461
+ { "path": "/home/user/myapp" }
462
+ ```
463
+
464
+ ---
465
+
466
+ ### aidex_scan
467
+
468
+ Find all projects with AiDex indexes in a directory tree.
469
+
470
+ **Parameters:**
471
+
472
+ | Name | Type | Required | Description |
473
+ |------|------|----------|-------------|
474
+ | `path` | string | ✅ | Root path to scan |
475
+ | `max_depth` | number | - | Maximum depth to scan (default: 10) |
476
+
477
+ **Returns:**
478
+ - List of indexed projects with:
479
+ - Name
480
+ - Path
481
+ - Statistics (files, items, methods, types)
482
+ - Last indexed timestamp
483
+
484
+ **Example:**
485
+ ```json
486
+ {
487
+ "path": "/home/user/projects",
488
+ "max_depth": 5
489
+ }
490
+ ```
491
+
492
+ ---
493
+
494
+ ## Session Management
495
+
496
+ ### aidex_session
497
+
498
+ Start or continue a session. **Call at the start of every new chat session!**
499
+
500
+ **Parameters:**
501
+
502
+ | Name | Type | Required | Description |
503
+ |------|------|----------|-------------|
504
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
505
+
506
+ **What it does:**
507
+
508
+ 1. **Detects new session** - If >5 minutes since last activity
509
+ 2. **Records session times** - Stores `last_session_start` and `last_session_end`
510
+ 3. **Detects external changes** - Files modified outside sessions (hash comparison)
511
+ 4. **Auto-reindexes** - Modified files are automatically updated
512
+ 5. **Returns session note** - If one exists
513
+
514
+ **Returns:**
515
+ - `isNewSession`: boolean
516
+ - `sessionInfo`: last session start/end times, current session start
517
+ - `externalChanges`: list of modified/deleted files
518
+ - `reindexed`: list of auto-reindexed files
519
+ - `note`: session note (if set)
520
+
521
+ **Example:**
522
+ ```json
523
+ { "path": "." }
524
+ ```
525
+
526
+ **Output example:**
527
+ ```
528
+ 🆕 **New Session Started**
529
+
530
+ ## Last Session
531
+ - **Start:** 2026-01-27T10:00:00.000Z
532
+ - **End:** 2026-01-27T12:30:00.000Z
533
+ - **Duration:** 2h 30m
534
+
535
+ 💡 Query last session changes with:
536
+ `aidex_query({ term: "...", modified_since: "1706349600000", modified_before: "1706358600000" })`
537
+
538
+ ## External Changes Detected
539
+ Found 3 file(s) changed outside of session:
540
+
541
+ - ✏️ src/index.ts (modified)
542
+ - ✏️ src/utils.ts (modified)
543
+ - 🗑️ src/old-file.ts (deleted)
544
+
545
+ ✅ Auto-reindexed 2 file(s)
546
+
547
+ ## 📝 Session Note
548
+ Test the new feature after restart
549
+ ```
550
+
551
+ ---
552
+
553
+ ### aidex_note
554
+
555
+ Read or write session notes. Persists in the database between sessions.
556
+
557
+ **Parameters:**
558
+
559
+ | Name | Type | Required | Description |
560
+ |------|------|----------|-------------|
561
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
562
+ | `note` | string | - | Note to save. If omitted, reads current note |
563
+ | `append` | boolean | - | Append to existing note instead of replacing (default: false) |
564
+ | `clear` | boolean | - | Clear the note (default: false) |
565
+
566
+ **Operations:**
567
+
568
+ | Parameters | Action |
569
+ |------------|--------|
570
+ | `{ path }` | Read current note |
571
+ | `{ path, note: "..." }` | Write/replace note |
572
+ | `{ path, note: "...", append: true }` | Append to note |
573
+ | `{ path, clear: true }` | Delete note |
574
+
575
+ **Examples:**
576
+ ```json
577
+ // Read note
578
+ { "path": "." }
579
+
580
+ // Write note
581
+ { "path": ".", "note": "Test glob fix after restart" }
582
+
583
+ // Append to note
584
+ { "path": ".", "note": "Also check edge cases", "append": true }
585
+
586
+ // Clear note
587
+ { "path": ".", "clear": true }
588
+ ```
589
+
590
+ ---
591
+
592
+ ### aidex_viewer
593
+
594
+ Open an interactive project tree viewer in the browser. Provides visual exploration with live updates.
595
+
596
+ **Parameters:**
597
+
598
+ | Name | Type | Required | Description |
599
+ |------|------|----------|-------------|
600
+ | `path` | string | ✅ | Path to project with `.aidex` directory |
601
+ | `action` | string | - | `open` (default) or `close` |
602
+
603
+ **Features:**
604
+
605
+ - **Interactive file tree** - Click directories to expand, click files to view signatures
606
+ - **Live reload** - File changes detected automatically via chokidar file watcher
607
+ - **Signature display** - Shows types (classes, interfaces) and methods with line numbers
608
+ - **WebSocket updates** - Real-time sync between file changes and browser
609
+
610
+ **Server:**
611
+ - Runs on `http://localhost:3333`
612
+ - Persistent until explicitly closed or MCP server restart
613
+
614
+ **Examples:**
615
+ ```json
616
+ // Open viewer
617
+ { "path": "." }
618
+
619
+ // Close viewer
620
+ { "path": ".", "action": "close" }
621
+ ```
622
+
623
+ **Output example:**
624
+ ```
625
+ 🖥️ Viewer opened at http://localhost:3333
626
+ ```
627
+
628
+ ---
629
+
630
+ ## Time Format Reference
631
+
632
+ Used by `aidex_query` parameters `modified_since` and `modified_before`:
633
+
634
+ | Format | Example | Meaning |
635
+ |--------|---------|---------|
636
+ | Minutes | `30m` | 30 minutes ago |
637
+ | Hours | `2h` | 2 hours ago |
638
+ | Days | `1d` | 1 day ago |
639
+ | Weeks | `1w` | 1 week ago |
640
+ | ISO Date | `2026-01-27` | Specific date (midnight) |
641
+ | ISO DateTime | `2026-01-27T14:30:00` | Specific date and time |
642
+ | Unix timestamp | `1706349600000` | Milliseconds since epoch |
643
+
644
+ ---
645
+
646
+ ## Supported Languages
647
+
648
+ | Language | Extensions | Parser |
649
+ |----------|------------|--------|
650
+ | C# | `.cs` | tree-sitter-c-sharp |
651
+ | TypeScript | `.ts`, `.tsx` | tree-sitter-typescript |
652
+ | JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | tree-sitter-javascript |
653
+ | Rust | `.rs` | tree-sitter-rust |
654
+ | Python | `.py`, `.pyw` | tree-sitter-python |
655
+ | C | `.c`, `.h` | tree-sitter-c |
656
+ | C++ | `.cpp`, `.cc`, `.cxx`, `.hpp`, `.hxx` | tree-sitter-cpp |
657
+ | Java | `.java` | tree-sitter-java |
658
+ | Go | `.go` | tree-sitter-go |
659
+ | PHP | `.php` | tree-sitter-php |
660
+ | Ruby | `.rb`, `.rake` | tree-sitter-ruby |
661
+
662
+ ---
663
+
664
+ ## Database Schema
665
+
666
+ SQLite database at `.aidex/index.db`:
667
+
668
+ | Table | Purpose |
669
+ |-------|---------|
670
+ | `files` | Indexed files with path, hash, last_indexed timestamp |
671
+ | `lines` | Line objects with type (code/comment/method/struct) and hash |
672
+ | `items` | Unique terms/identifiers (case-insensitive) |
673
+ | `occurrences` | Term locations (item_id, file_id, line_id) |
674
+ | `signatures` | Header comments per file |
675
+ | `methods` | Method prototypes with visibility, static/async flags |
676
+ | `types` | Classes, structs, interfaces, enums |
677
+ | `dependencies` | Linked projects |
678
+ | `project_files` | All files with type classification |
679
+ | `metadata` | Key-value store (session times, notes, etc.) |
680
+
681
+ ---
682
+
683
+ ## Best Practices
684
+
685
+ 1. **Start sessions with `aidex_session`** - Detects external changes automatically
686
+ 2. **Use `aidex_query` instead of grep** - 50x less tokens, precise results
687
+ 3. **Use `aidex_signature` instead of reading files** - Get structure without implementation
688
+ 4. **Leave session notes** - Context persists between chat sessions
689
+ 5. **Re-index after edits** - Call `aidex_update` for modified files
690
+ 6. **Link related projects** - Query across multiple codebases