ai-readme-mcp 0.4.6 → 0.4.7
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/README.md +755 -744
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,744 +1,755 @@
|
|
|
1
|
-
# AI_README MCP Server
|
|
2
|
-
|
|
3
|
-
> A smart documentation system that helps AI assistants understand and follow your project's conventions
|
|
4
|
-
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
**
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
-
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
|
|
310
|
-
##
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
-
|
|
363
|
-
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
npm
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
#
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
//
|
|
551
|
-
{
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
section?: string;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
```
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
-
|
|
719
|
-
-
|
|
720
|
-
-
|
|
721
|
-
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
-
|
|
1
|
+
# AI_README MCP Server
|
|
2
|
+
|
|
3
|
+
> A smart documentation system that helps AI assistants understand and follow your project's conventions
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
## 📑 Quick Navigation
|
|
10
|
+
|
|
11
|
+
- Installation & Setup
|
|
12
|
+
- [For Claude Code](#for-claude-code-vscode-extension)
|
|
13
|
+
- [For Cursor](#for-cursor)
|
|
14
|
+
- [For GitHub Copilot](#for-github-copilot-vscode-1102)
|
|
15
|
+
- [For Claude Desktop](#for-claude-desktop-application)
|
|
16
|
+
- [Alternative Installation Methods](#alternative-installation-methods)
|
|
17
|
+
- [Create Your First AI_README](#create-your-first-ai_readme)
|
|
18
|
+
- [Multi-Level AI_README](#multi-level-ai_readme-not-just-for-monorepos)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📋 Overview
|
|
23
|
+
|
|
24
|
+
**AI_README MCP Server** is a Model Context Protocol (MCP) server that helps AI assistants understand your project conventions through dedicated `AI_README.md` guide files. It automatically discovers, routes, and manages these files so AI can generate consistent, high-quality code that matches your team's standards.
|
|
25
|
+
|
|
26
|
+
**Works with:** GitHub Copilot (VSCode 1.102+), Claude Code, Cursor, and other MCP-compatible AI tools.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🎯 The Problem
|
|
31
|
+
|
|
32
|
+
When working with AI assistants (like Claude, GPT, or other AI coding tools), you've probably experienced:
|
|
33
|
+
|
|
34
|
+
- ❌ **Inconsistent code style** - AI generates code that doesn't match your project's conventions
|
|
35
|
+
- ❌ **Repeated instructions** - You have to tell the AI the same rules over and over
|
|
36
|
+
- ❌ **Team inconsistency** - Different team members get different AI outputs, leading to fragmented code quality
|
|
37
|
+
- ❌ **Context loss** - AI forgets your project's specific patterns and best practices
|
|
38
|
+
- ❌ **No single source of truth** - Team conventions exist in Slack messages, PRs, and people's heads, not in a format AI can use
|
|
39
|
+
|
|
40
|
+
## 💡 The Solution
|
|
41
|
+
|
|
42
|
+
**AI_README.md** - A dedicated guide file specifically designed for AI assistants to read.
|
|
43
|
+
|
|
44
|
+
Think of it as:
|
|
45
|
+
- 📖 A "style guide" that AI reads before writing code
|
|
46
|
+
- 🎓 An "onboarding document" that teaches AI your project's conventions
|
|
47
|
+
- 🔧 A "configuration file" for AI behavior in your codebase
|
|
48
|
+
- 🤝 A **"team contract"** that ensures every developer's AI assistant follows the same standards
|
|
49
|
+
|
|
50
|
+
### How It Works
|
|
51
|
+
|
|
52
|
+
1. **Create** `AI_README.md` files in your project (root or specific directories)
|
|
53
|
+
2. **Document** your conventions: coding standards, architecture patterns, naming rules, testing requirements
|
|
54
|
+
3. **Commit to git** - Share conventions with your entire team
|
|
55
|
+
4. **AI reads it automatically** before making changes - ensuring every team member's AI follows the same rules
|
|
56
|
+
5. **Keep it in sync** - AI can update the README as your project evolves
|
|
57
|
+
|
|
58
|
+
### What This MCP Server Does
|
|
59
|
+
|
|
60
|
+
This MCP (Model Context Protocol) server automates the entire workflow:
|
|
61
|
+
|
|
62
|
+
- 🔍 **Auto-discovers** all AI_README.md files in your project
|
|
63
|
+
- 🎯 **Routes context** - AI gets the most relevant README for the code it's editing
|
|
64
|
+
- 🚀 **Guided initialization** - `init_ai_readme` scans for empty files and guides AI through population
|
|
65
|
+
- ✏️ **Updates automatically** - AI can add new conventions it discovers while coding
|
|
66
|
+
- ✅ **Validates quality** - Ensures READMEs are concise and optimized for AI consumption
|
|
67
|
+
|
|
68
|
+
**Result:** Every AI interaction in your project follows your team's standards and produces consistent, high-quality code.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ✨ Features
|
|
73
|
+
|
|
74
|
+
- 🔍 **Automatic Discovery** - Scan and index all AI_README.md files in your project
|
|
75
|
+
- 🎯 **Smart Context Routing** - Find relevant README content based on file paths
|
|
76
|
+
- 🤝 **Team Consistency** - Every team member's AI assistant reads the same conventions from git, ensuring uniform code quality
|
|
77
|
+
- 🚀 **Guided Initialization** - `init_ai_readme` tool scans for empty files and guides AI through population
|
|
78
|
+
- 🔄 **Update & Sync** - AI can both read and update AI_README files
|
|
79
|
+
- ✅ **Validation & Quality** - Ensure README consistency with token limits and structure checks
|
|
80
|
+
- 🏗️ **Monorepo Support** - Place AI_README.md files at different folder levels; the tool automatically finds and uses the most relevant one
|
|
81
|
+
- 📦 **Easy Integration** - Works seamlessly with Cursor, Claude Code, and other MCP clients
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🚀 Installation & Setup
|
|
86
|
+
|
|
87
|
+
### For Claude Code (VSCode Extension)
|
|
88
|
+
|
|
89
|
+
**Step 1: Add MCP Server**
|
|
90
|
+
|
|
91
|
+
In your project directory, run:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
claude mcp add --scope project ai-readme-manager npx -- -y ai-readme-mcp
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This creates a `.mcp.json` file that uses `npx` to run the package - no installation or path configuration needed!
|
|
98
|
+
|
|
99
|
+
**Step 2: Enable Project MCP Servers**
|
|
100
|
+
|
|
101
|
+
Create or edit `.claude/settings.local.json` in your project:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"enableAllProjectMcpServers": true
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Step 3: Auto-approve MCP Tools (Optional but Recommended)**
|
|
110
|
+
|
|
111
|
+
To avoid "Yes/No" prompts every time and enable "Yes, Do not ask again" option, add the tools to your allow list.
|
|
112
|
+
|
|
113
|
+
In `.claude/settings.local.json`, add:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"permissions": {
|
|
118
|
+
"allow": [
|
|
119
|
+
"mcp__ai-readme-manager__discover_ai_readmes",
|
|
120
|
+
"mcp__ai-readme-manager__get_context_for_file",
|
|
121
|
+
"mcp__ai-readme-manager__update_ai_readme",
|
|
122
|
+
"mcp__ai-readme-manager__validate_ai_readmes",
|
|
123
|
+
"mcp__ai-readme-manager__init_ai_readme"
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"enableAllProjectMcpServers": true
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **Note:** Without this configuration, you'll be prompted for approval every time Claude uses these tools, and the "Do not ask again" option won't appear.
|
|
131
|
+
|
|
132
|
+
**Step 4: Verify Installation**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
claude mcp get ai-readme-manager
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You should see `Status: ✓ Connected`
|
|
139
|
+
|
|
140
|
+
### For Cursor
|
|
141
|
+
|
|
142
|
+
Add to Cursor's MCP configuration file:
|
|
143
|
+
- **Windows:** `%APPDATA%\Cursor\User\mcp.json`
|
|
144
|
+
- **macOS/Linux:** `~/.cursor/mcp.json`
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mcpServers": {
|
|
149
|
+
"ai-readme-manager": {
|
|
150
|
+
"command": "npx",
|
|
151
|
+
"args": ["-y", "ai-readme-mcp"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
After configuring, restart Cursor completely.
|
|
158
|
+
|
|
159
|
+
### For GitHub Copilot (VSCode 1.102+)
|
|
160
|
+
|
|
161
|
+
**Requirements:**
|
|
162
|
+
- VSCode 1.102 or later
|
|
163
|
+
- GitHub Copilot & Copilot Chat extensions installed
|
|
164
|
+
|
|
165
|
+
**Option 1: Using VSCode Settings UI**
|
|
166
|
+
|
|
167
|
+
1. Open VSCode Settings (Ctrl+,)
|
|
168
|
+
2. Search for "MCP"
|
|
169
|
+
3. Click "Edit in settings.json"
|
|
170
|
+
4. Add the MCP server configuration
|
|
171
|
+
|
|
172
|
+
**Option 2: Manual Configuration**
|
|
173
|
+
|
|
174
|
+
Add to your VSCode `settings.json`:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"github.copilot.chat.mcp.servers": {
|
|
179
|
+
"ai-readme-manager": {
|
|
180
|
+
"command": "npx",
|
|
181
|
+
"args": ["-y", "ai-readme-mcp"]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
After configuring, restart VSCode and you'll see the MCP tools available in GitHub Copilot Chat!
|
|
188
|
+
|
|
189
|
+
### For Claude Desktop Application
|
|
190
|
+
|
|
191
|
+
Add to `claude_desktop_config.json`:
|
|
192
|
+
- **Windows:** `%APPDATA%\claude\claude_desktop_config.json`
|
|
193
|
+
- **macOS:** `~/Library/Application Support/Claude/config.json`
|
|
194
|
+
- **Linux:** `~/.config/claude/config.json`
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"mcpServers": {
|
|
199
|
+
"ai-readme-manager": {
|
|
200
|
+
"command": "npx",
|
|
201
|
+
"args": ["-y", "ai-readme-mcp"]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Alternative Installation Methods
|
|
208
|
+
|
|
209
|
+
The above methods use `npx` (recommended). If you prefer other approaches, you can use these configurations in your MCP config file:
|
|
210
|
+
- **Claude Code:** `.mcp.json` (project root)
|
|
211
|
+
- **Cursor:** `%APPDATA%\Cursor\User\mcp.json` (Windows) or `~/.cursor/mcp.json` (macOS/Linux)
|
|
212
|
+
- **Claude Desktop:** `claude_desktop_config.json` (see paths above)
|
|
213
|
+
|
|
214
|
+
**Option 1: Using npx (Recommended)**
|
|
215
|
+
|
|
216
|
+
No installation needed! Just configure and use via npx:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"mcpServers": {
|
|
221
|
+
"ai-readme-manager": {
|
|
222
|
+
"command": "npx",
|
|
223
|
+
"args": ["-y", "ai-readme-mcp"]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
> The `-y` flag automatically accepts the npx prompt.
|
|
230
|
+
|
|
231
|
+
**Option 2: Global Installation**
|
|
232
|
+
|
|
233
|
+
Install once globally, use everywhere:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npm install -g ai-readme-mcp
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Then configure:
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"mcpServers": {
|
|
244
|
+
"ai-readme-manager": {
|
|
245
|
+
"command": "ai-readme-mcp"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
> **Pros:** Faster startup (no npx download). **Cons:** Need to manually update when new versions release.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Create Your First AI_README
|
|
256
|
+
|
|
257
|
+
You have two main approaches to create and populate AI_README files:
|
|
258
|
+
|
|
259
|
+
### Option 1: Automated Initialization (Recommended)
|
|
260
|
+
|
|
261
|
+
Use the `init_ai_readme` tool to automatically scan and populate empty AI_README files:
|
|
262
|
+
|
|
263
|
+
**Step 1:** Create empty AI_README.md files where needed
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Example: Create empty AI_READMEs in different directories
|
|
267
|
+
touch AI_README.md
|
|
268
|
+
touch apps/backend/AI_README.md
|
|
269
|
+
touch apps/frontend/AI_README.md
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Step 2:** Trigger the initialization
|
|
273
|
+
|
|
274
|
+
In your AI assistant (Claude Code, Cursor, etc.), simply say:
|
|
275
|
+
|
|
276
|
+
> "Please run init_ai_readme for this project"
|
|
277
|
+
|
|
278
|
+
Or more explicitly:
|
|
279
|
+
|
|
280
|
+
> "Initialize AI_README files"
|
|
281
|
+
> "Help me populate the empty AI_README files"
|
|
282
|
+
|
|
283
|
+
**What happens:**
|
|
284
|
+
- 🔍 Scans your project for empty AI_README files
|
|
285
|
+
- 📝 Creates root-level AI_README if none exist
|
|
286
|
+
- 📋 Provides detailed step-by-step instructions for each file
|
|
287
|
+
- 🤖 AI assistant will then:
|
|
288
|
+
- Explore relevant directories
|
|
289
|
+
- Analyze your codebase (tech stack, patterns, conventions)
|
|
290
|
+
- Populate each AI_README with relevant documentation
|
|
291
|
+
|
|
292
|
+
**When to use `init_ai_readme`:**
|
|
293
|
+
- First time setting up AI_README in your project
|
|
294
|
+
- After creating new empty AI_README.md files in subdirectories
|
|
295
|
+
- When `get_context_for_file` detects empty AI_README files
|
|
296
|
+
- To batch-process multiple empty AI_README files
|
|
297
|
+
|
|
298
|
+
### Option 2: Manual Creation
|
|
299
|
+
|
|
300
|
+
Create and write AI_README.md files yourself:
|
|
301
|
+
|
|
302
|
+
```markdown
|
|
303
|
+
# My Project
|
|
304
|
+
|
|
305
|
+
## Tech Stack
|
|
306
|
+
- Framework: React + Express
|
|
307
|
+
- Database: PostgreSQL
|
|
308
|
+
- Testing: Jest + Vitest
|
|
309
|
+
|
|
310
|
+
## Architecture Patterns
|
|
311
|
+
- Follows MVC pattern for backend
|
|
312
|
+
- Component-based architecture for frontend
|
|
313
|
+
- RESTful API design
|
|
314
|
+
|
|
315
|
+
## Coding Conventions
|
|
316
|
+
- Use TypeScript for all files
|
|
317
|
+
- Components in PascalCase
|
|
318
|
+
- Functions and variables in camelCase
|
|
319
|
+
- Test coverage: 80%+ required
|
|
320
|
+
|
|
321
|
+
## Testing
|
|
322
|
+
Run tests with: `npm test`
|
|
323
|
+
Write tests alongside source files
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Best Practices:**
|
|
327
|
+
- Keep it concise (< 400 tokens is ideal)
|
|
328
|
+
- Focus on conventions, not documentation
|
|
329
|
+
- Update as your project evolves
|
|
330
|
+
- Use AI to help maintain it
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Multi-Level AI_README (Not Just for Monorepos!)
|
|
335
|
+
|
|
336
|
+
**The power of this tool is multi-level documentation** - not just for monorepos, but for **any project** that wants to organize conventions by module or feature.
|
|
337
|
+
|
|
338
|
+
**Why multi-level?**
|
|
339
|
+
- 🎯 **Avoid bloated root README** - Keep each README focused and concise
|
|
340
|
+
- 📍 **Precise context** - AI gets only the relevant conventions for the code it's working on
|
|
341
|
+
- 🔧 **Flexible organization** - Organize by feature, module, or any structure that makes sense
|
|
342
|
+
|
|
343
|
+
Simply place `AI_README.md` files at different folder levels:
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
my-monorepo/
|
|
347
|
+
├── AI_README.md # Root-level conventions (applies to all)
|
|
348
|
+
├── apps/
|
|
349
|
+
│ ├── frontend/
|
|
350
|
+
│ │ ├── AI_README.md # Frontend-specific conventions
|
|
351
|
+
│ │ └── src/components/Button.tsx
|
|
352
|
+
│ └── backend/
|
|
353
|
+
│ ├── AI_README.md # Backend-specific conventions
|
|
354
|
+
│ └── src/api/users.ts
|
|
355
|
+
└── packages/
|
|
356
|
+
└── shared/
|
|
357
|
+
├── AI_README.md # Shared library conventions
|
|
358
|
+
└── src/utils.ts
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Smart Empty README Handling:**
|
|
362
|
+
- 📝 Create empty `AI_README.md` files in subdirectories where you need specific conventions
|
|
363
|
+
- 🚀 Run `init_ai_readme` tool (just tell your AI: "Please initialize AI_README files")
|
|
364
|
+
- 🤖 AI automatically analyzes each directory and populates conventions
|
|
365
|
+
- 🔗 For subdirectories with parent READMEs, generates differential content (only module-specific conventions)
|
|
366
|
+
- 📋 For root directories, generates full project analysis
|
|
367
|
+
|
|
368
|
+
When AI works on a file, it automatically gets:
|
|
369
|
+
- The **most relevant** AI_README (closest parent directory)
|
|
370
|
+
- Plus the **root-level** AI_README (for project-wide standards)
|
|
371
|
+
|
|
372
|
+
For example, when editing `apps/frontend/src/components/Button.tsx`:
|
|
373
|
+
- ✅ Gets `apps/frontend/AI_README.md` (React component standards)
|
|
374
|
+
- ✅ Gets root `AI_README.md` (project-wide Git, testing conventions)
|
|
375
|
+
|
|
376
|
+
### Test the Integration
|
|
377
|
+
|
|
378
|
+
Restart your IDE, then ask your AI assistant:
|
|
379
|
+
|
|
380
|
+
> "I'm about to create a new component. What conventions should I follow?"
|
|
381
|
+
|
|
382
|
+
The AI will automatically retrieve your AI_README context!
|
|
383
|
+
|
|
384
|
+
For detailed setup instructions, see [Quick Start Guide](./docs/QUICK_START.md).
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## 🏗️ Project Structure
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
ai-readme-mcp/
|
|
392
|
+
├── src/
|
|
393
|
+
│ ├── index.ts # MCP Server entry point
|
|
394
|
+
│ ├── tools/ # MCP Tools implementation
|
|
395
|
+
│ ├── core/ # Core logic (scanner, router, updater)
|
|
396
|
+
│ ├── types/ # TypeScript type definitions
|
|
397
|
+
│ └── utils/ # Utility functions
|
|
398
|
+
├── tests/
|
|
399
|
+
│ ├── unit/ # Unit tests
|
|
400
|
+
│ ├── integration/ # Integration tests
|
|
401
|
+
│ └── fixtures/ # Test fixtures
|
|
402
|
+
└── docs/ # Documentation
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## 🛠️ Development
|
|
406
|
+
|
|
407
|
+
### Prerequisites
|
|
408
|
+
|
|
409
|
+
- Node.js 18+
|
|
410
|
+
- npm/pnpm/yarn
|
|
411
|
+
- TypeScript 5+
|
|
412
|
+
|
|
413
|
+
### Setup
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# Clone the repository
|
|
417
|
+
git clone https://github.com/Draco-Cheng/ai-readme-mcp.git
|
|
418
|
+
cd ai-readme-mcp
|
|
419
|
+
|
|
420
|
+
# Install dependencies
|
|
421
|
+
npm install
|
|
422
|
+
|
|
423
|
+
# Run type checking
|
|
424
|
+
npm run typecheck
|
|
425
|
+
|
|
426
|
+
# Run tests
|
|
427
|
+
npm test
|
|
428
|
+
|
|
429
|
+
# Build the project
|
|
430
|
+
npm run build
|
|
431
|
+
|
|
432
|
+
# Development mode with watch
|
|
433
|
+
npm run dev
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Local Development Configuration
|
|
437
|
+
|
|
438
|
+
If you're developing or modifying the source code, configure your MCP client to use your local build:
|
|
439
|
+
|
|
440
|
+
**For Claude Code - Add with CLI:**
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Linux/macOS:
|
|
444
|
+
claude mcp add --transport stdio ai-readme-manager --scope project -- node ~/ai-readme-mcp/dist/index.js
|
|
445
|
+
|
|
446
|
+
# Windows:
|
|
447
|
+
claude mcp add --transport stdio ai-readme-manager --scope project -- node C:\Users\YourName\ai-readme-mcp\dist\index.js
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**For Claude Code - Manual `.mcp.json`:**
|
|
451
|
+
|
|
452
|
+
```json
|
|
453
|
+
{
|
|
454
|
+
"mcpServers": {
|
|
455
|
+
"ai-readme-manager": {
|
|
456
|
+
"type": "stdio",
|
|
457
|
+
"command": "node",
|
|
458
|
+
"args": ["/absolute/path/to/ai-readme-mcp/dist/index.js"]
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**For Cursor or Claude Desktop:**
|
|
465
|
+
|
|
466
|
+
```json
|
|
467
|
+
{
|
|
468
|
+
"mcpServers": {
|
|
469
|
+
"ai-readme-manager": {
|
|
470
|
+
"command": "node",
|
|
471
|
+
"args": ["/absolute/path/to/ai-readme-mcp/dist/index.js"]
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Path examples:**
|
|
478
|
+
- **Windows:** `"C:\\Users\\YourName\\ai-readme-mcp\\dist\\index.js"` (use `\\` for escaping)
|
|
479
|
+
- **macOS/Linux:** `"/home/username/ai-readme-mcp/dist/index.js"`
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
## 📚 Documentation
|
|
484
|
+
|
|
485
|
+
- **[Quick Start Guide](./docs/QUICK_START.md)** - Get started in 10 minutes
|
|
486
|
+
- **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute
|
|
487
|
+
- [Project Specification](./docs/SPEC.md) - Complete technical specification
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## 🛠️ Available MCP Tools
|
|
492
|
+
|
|
493
|
+
### `discover_ai_readmes`
|
|
494
|
+
|
|
495
|
+
Scans your project and discovers all AI_README.md files.
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
// Parameters
|
|
499
|
+
{
|
|
500
|
+
projectRoot: string; // Required: Project root directory
|
|
501
|
+
excludePatterns?: string[]; // Optional: Glob patterns to exclude
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Returns
|
|
505
|
+
{
|
|
506
|
+
projectRoot: string;
|
|
507
|
+
totalFound: number;
|
|
508
|
+
readmeFiles: Array<{
|
|
509
|
+
path: string;
|
|
510
|
+
scope: string;
|
|
511
|
+
level: number;
|
|
512
|
+
patterns: string[];
|
|
513
|
+
}>;
|
|
514
|
+
lastUpdated: string;
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### `get_context_for_file`
|
|
519
|
+
|
|
520
|
+
Gets relevant AI_README context for a specific file path.
|
|
521
|
+
|
|
522
|
+
```typescript
|
|
523
|
+
// Parameters
|
|
524
|
+
{
|
|
525
|
+
projectRoot: string; // Required: Project root directory
|
|
526
|
+
filePath: string; // Required: File path relative to root
|
|
527
|
+
includeRoot?: boolean; // Optional: Include root README (default: true)
|
|
528
|
+
excludePatterns?: string[]; // Optional: Glob patterns to exclude
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Returns
|
|
532
|
+
{
|
|
533
|
+
filePath: string;
|
|
534
|
+
totalContexts: number;
|
|
535
|
+
contexts: Array<{
|
|
536
|
+
path: string;
|
|
537
|
+
relevance: 'root' | 'direct' | 'parent';
|
|
538
|
+
distance: number;
|
|
539
|
+
content: string;
|
|
540
|
+
}>;
|
|
541
|
+
formattedPrompt: string; // Ready-to-use formatted context
|
|
542
|
+
}
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### `update_ai_readme`
|
|
546
|
+
|
|
547
|
+
Update an AI_README.md file with specified operations.
|
|
548
|
+
|
|
549
|
+
```typescript
|
|
550
|
+
// Parameters
|
|
551
|
+
{
|
|
552
|
+
readmePath: string; // Required: Path to AI_README.md file
|
|
553
|
+
operations: Array<{ // Required: Update operations to perform
|
|
554
|
+
type: 'append' | 'prepend' | 'replace' | 'insert-after' | 'insert-before';
|
|
555
|
+
content: string; // Content to add or replace
|
|
556
|
+
section?: string; // Section heading (for insert operations)
|
|
557
|
+
searchText?: string; // Text to search for (for replace)
|
|
558
|
+
}>;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// Returns
|
|
562
|
+
{
|
|
563
|
+
success: boolean;
|
|
564
|
+
readmePath: string;
|
|
565
|
+
changes: Array<{
|
|
566
|
+
operation: string;
|
|
567
|
+
section?: string;
|
|
568
|
+
linesAdded: number;
|
|
569
|
+
linesRemoved: number;
|
|
570
|
+
}>;
|
|
571
|
+
summary: string; // Includes reminder to use git diff
|
|
572
|
+
error?: string; // Error message if failed
|
|
573
|
+
}
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
**Note:** Changes are written directly to the file. Use Git for version control:
|
|
577
|
+
- Review changes: `git diff AI_README.md`
|
|
578
|
+
- Undo changes: `git checkout AI_README.md`
|
|
579
|
+
- Commit changes: `git add AI_README.md && git commit -m "Update AI_README"`
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Example Usage:**
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
// Append new section
|
|
586
|
+
{
|
|
587
|
+
readmePath: "apps/frontend/AI_README.md",
|
|
588
|
+
operations: [{
|
|
589
|
+
type: "append",
|
|
590
|
+
content: "## Performance\n- Use React.memo for expensive components"
|
|
591
|
+
}]
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Insert after specific section
|
|
595
|
+
{
|
|
596
|
+
readmePath: "AI_README.md",
|
|
597
|
+
operations: [{
|
|
598
|
+
type: "insert-after",
|
|
599
|
+
section: "## Coding Conventions",
|
|
600
|
+
content: "### Code Style\n- Use TypeScript strict mode\n- Prefer const over let"
|
|
601
|
+
}]
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// Replace specific text
|
|
605
|
+
{
|
|
606
|
+
readmePath: "AI_README.md",
|
|
607
|
+
operations: [{
|
|
608
|
+
type: "replace",
|
|
609
|
+
searchText: "Run tests with npm test",
|
|
610
|
+
content: "Run tests with: `npm test` or `npm run test:watch`"
|
|
611
|
+
}]
|
|
612
|
+
}
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### `init_ai_readme`
|
|
616
|
+
|
|
617
|
+
Initialize and populate empty AI_README files in your project.
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
// Parameters
|
|
621
|
+
{
|
|
622
|
+
projectRoot: string; // Required: Project root directory
|
|
623
|
+
excludePatterns?: string[]; // Optional: Glob patterns to exclude
|
|
624
|
+
targetPath?: string; // Optional: Specific directory to initialize
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// Returns
|
|
628
|
+
{
|
|
629
|
+
success: boolean;
|
|
630
|
+
message: string;
|
|
631
|
+
readmesToInitialize: string[]; // Paths to empty AI_README files
|
|
632
|
+
instructions: string; // Detailed step-by-step guide for populating
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
**Features:**
|
|
637
|
+
- 🔍 Scans project for empty or missing AI_README files
|
|
638
|
+
- 📝 Creates root-level AI_README if none exist
|
|
639
|
+
- 📋 Generates detailed step-by-step instructions for each file
|
|
640
|
+
- 🎯 Can target specific directories with `targetPath` parameter
|
|
641
|
+
- 🤖 Guides AI through analysis: tech stack, patterns, conventions
|
|
642
|
+
|
|
643
|
+
**Example Usage:**
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
// Initialize all empty AI_READMEs in project
|
|
647
|
+
{
|
|
648
|
+
projectRoot: "/path/to/project"
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// Initialize only in specific directory
|
|
652
|
+
{
|
|
653
|
+
projectRoot: "/path/to/project",
|
|
654
|
+
targetPath: "apps/backend"
|
|
655
|
+
}
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**Typical Workflow:**
|
|
659
|
+
1. AI assistant runs `init_ai_readme`
|
|
660
|
+
2. Receives detailed instructions for each empty file
|
|
661
|
+
3. Follows instructions:
|
|
662
|
+
- Uses `Glob` to scan directory
|
|
663
|
+
- Reads 2-5 key source files
|
|
664
|
+
- Analyzes tech stack, patterns, conventions
|
|
665
|
+
4. Uses `update_ai_readme` to populate each file
|
|
666
|
+
5. Verifies with `get_context_for_file` or `validate_ai_readmes`
|
|
667
|
+
|
|
668
|
+
### `validate_ai_readmes`
|
|
669
|
+
|
|
670
|
+
Validate all AI_README.md files in your project for quality and token efficiency.
|
|
671
|
+
|
|
672
|
+
```typescript
|
|
673
|
+
// Parameters
|
|
674
|
+
{
|
|
675
|
+
projectRoot: string; // Required: Project root directory
|
|
676
|
+
excludePatterns?: string[]; // Optional: Glob patterns to exclude
|
|
677
|
+
config?: { // Optional: Custom validation config
|
|
678
|
+
maxTokens?: number;
|
|
679
|
+
rules?: {
|
|
680
|
+
requireH1?: boolean;
|
|
681
|
+
requireSections?: string[];
|
|
682
|
+
allowCodeBlocks?: boolean;
|
|
683
|
+
maxLineLength?: number;
|
|
684
|
+
};
|
|
685
|
+
tokenLimits?: {
|
|
686
|
+
excellent?: number; // Default: 200
|
|
687
|
+
good?: number; // Default: 400
|
|
688
|
+
warning?: number; // Default: 600
|
|
689
|
+
error?: number; // Default: 1000
|
|
690
|
+
};
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Returns
|
|
695
|
+
{
|
|
696
|
+
valid: boolean;
|
|
697
|
+
totalFiles: number;
|
|
698
|
+
results: Array<{
|
|
699
|
+
path: string;
|
|
700
|
+
valid: boolean;
|
|
701
|
+
tokens: number;
|
|
702
|
+
rating: 'excellent' | 'good' | 'needs-improvement' | 'too-long';
|
|
703
|
+
issues: string[];
|
|
704
|
+
suggestions: string[];
|
|
705
|
+
}>;
|
|
706
|
+
summary: string;
|
|
707
|
+
}
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Validation Features**:
|
|
711
|
+
- Token counting for AI consumption optimization
|
|
712
|
+
- Structure validation (H1 heading, sections)
|
|
713
|
+
- Line length checks (default: 100 chars)
|
|
714
|
+
- Code block detection (disabled by default for strict mode)
|
|
715
|
+
- Quality ratings based on token count
|
|
716
|
+
|
|
717
|
+
**Default Token Limits (Strict Mode)**:
|
|
718
|
+
- 🌟 Excellent: < 200 tokens
|
|
719
|
+
- ✅ Good: < 400 tokens
|
|
720
|
+
- ⚠️ Needs improvement: < 600 tokens
|
|
721
|
+
- ❌ Too long: > 1000 tokens
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## 🚀 What's Next
|
|
726
|
+
|
|
727
|
+
We're actively working on new features:
|
|
728
|
+
|
|
729
|
+
- **Auto-populate Empty AI_README** - Automatically generate AI_README content when `get_context_for_file` detects empty files, reducing manual initialization steps
|
|
730
|
+
- **Enhanced Tool Triggering** - Improve tool descriptions and prompts to ensure AI assistants trigger tools at the right moments with better precision and reliability
|
|
731
|
+
- **CI/CD Integration** - GitHub Actions for automated README validation
|
|
732
|
+
- **VSCode Extension** - Native VSCode extension with visual UI for managing AI_README files, offering a more integrated experience alongside the current MCP server
|
|
733
|
+
|
|
734
|
+
Want to contribute? Check out our [Contributing Guide](./CONTRIBUTING.md)!
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## 🤝 Contributing
|
|
739
|
+
|
|
740
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
741
|
+
|
|
742
|
+
## 📄 License
|
|
743
|
+
|
|
744
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
745
|
+
|
|
746
|
+
## 🔗 Related Resources
|
|
747
|
+
|
|
748
|
+
- [Model Context Protocol Specification](https://spec.modelcontextprotocol.io/)
|
|
749
|
+
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
750
|
+
- [Claude Code MCP Documentation](https://docs.claude.com/en/docs/claude-code/mcp)
|
|
751
|
+
|
|
752
|
+
## 📧 Contact
|
|
753
|
+
|
|
754
|
+
- GitHub Issues: https://github.com/Draco-Cheng/ai-readme-mcp/issues
|
|
755
|
+
- Project Link: https://github.com/Draco-Cheng/ai-readme-mcp
|