ai-readme-mcp 0.2.0 → 0.3.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.
- package/README.md +235 -30
- package/dist/index.js +361 -42
- package/dist/index.js.map +1 -1
- package/docs/templates/basic.md +55 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI_README MCP Server
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> A smart documentation system that helps AI assistants understand and follow your project's conventions
|
|
4
4
|
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
@@ -8,19 +8,51 @@
|
|
|
8
8
|
|
|
9
9
|
## 📋 Overview
|
|
10
10
|
|
|
11
|
-
AI_README MCP Server is a Model Context Protocol (MCP) server that
|
|
11
|
+
**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.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**Works with:** Cursor, Claude Code, and other MCP-compatible AI tools.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🎯 The Problem
|
|
18
|
+
|
|
19
|
+
When working with AI assistants (like Claude, GPT, or other AI coding tools), you've probably experienced:
|
|
20
|
+
|
|
21
|
+
- ❌ **Inconsistent code style** - AI generates code that doesn't match your project's conventions
|
|
22
|
+
- ❌ **Repeated instructions** - You have to tell the AI the same rules over and over
|
|
23
|
+
- ❌ **Team inconsistency** - Different team members get different AI outputs
|
|
24
|
+
- ❌ **Context loss** - AI forgets your project's specific patterns and best practices
|
|
25
|
+
- ❌ **Outdated documentation** - Project conventions change, but documentation lags behind
|
|
26
|
+
|
|
27
|
+
## 💡 The Solution
|
|
28
|
+
|
|
29
|
+
**AI_README.md** - A dedicated guide file specifically designed for AI assistants to read.
|
|
30
|
+
|
|
31
|
+
Think of it as:
|
|
32
|
+
- 📖 A "style guide" that AI reads before writing code
|
|
33
|
+
- 🎓 An "onboarding document" that teaches AI your project's conventions
|
|
34
|
+
- 🔧 A "configuration file" for AI behavior in your codebase
|
|
35
|
+
|
|
36
|
+
### How It Works
|
|
37
|
+
|
|
38
|
+
1. **Create** `AI_README.md` files in your project (root or specific directories)
|
|
39
|
+
2. **Document** your conventions: coding standards, architecture patterns, naming rules, testing requirements
|
|
40
|
+
3. **AI reads it automatically** before making changes - ensuring consistent, high-quality output
|
|
41
|
+
4. **Keep it in sync** - AI can update the README as your project evolves
|
|
42
|
+
|
|
43
|
+
### What This MCP Server Does
|
|
16
44
|
|
|
17
|
-
|
|
18
|
-
- **📈 Improve AI output quality** - By providing clear, structured context, AI generates more accurate and consistent code that matches your project's style
|
|
19
|
-
- **🎯 Maintain consistency across teams** - When multiple developers use AI assistants, AI_README ensures everyone gets the same guidelines and standards
|
|
20
|
-
- **⚡ Save time on onboarding** - New team members and AI assistants instantly understand project conventions without lengthy explanations
|
|
21
|
-
- **🔄 Keep documentation in sync** - AI can automatically update README files as the project evolves, maintaining up-to-date documentation
|
|
45
|
+
This MCP (Model Context Protocol) server automates the entire workflow:
|
|
22
46
|
|
|
23
|
-
|
|
47
|
+
- 🔍 **Auto-discovers** all AI_README.md files in your project
|
|
48
|
+
- 🎯 **Routes context** - AI gets the most relevant README for the code it's editing
|
|
49
|
+
- ✏️ **Updates automatically** - AI can add new conventions it discovers while coding
|
|
50
|
+
- ✅ **Validates quality** - Ensures READMEs are concise and optimized for AI consumption
|
|
51
|
+
- 🤖 **Smart generation** - Auto-creates AI_README based on your project structure
|
|
52
|
+
|
|
53
|
+
**Result:** Every AI interaction in your project follows your team's standards and produces consistent, high-quality code.
|
|
54
|
+
|
|
55
|
+
---
|
|
24
56
|
|
|
25
57
|
## ✨ Features
|
|
26
58
|
|
|
@@ -28,15 +60,17 @@ Think of it as a **"style guide and context manager for AI"** - ensuring every A
|
|
|
28
60
|
- 🎯 **Smart Context Routing** - Find relevant README content based on file paths
|
|
29
61
|
- 🔄 **Update & Sync** - AI can both read and update AI_README files
|
|
30
62
|
- ✅ **Validation & Quality** - Ensure README consistency with token limits and structure checks
|
|
31
|
-
-
|
|
63
|
+
- 🤖 **Smart Initialization** - Auto-generate AI_README files based on project analysis
|
|
64
|
+
- 🏗️ **Monorepo Support** - Place AI_README.md files at different folder levels; the tool automatically finds and uses the most relevant one
|
|
32
65
|
- 📦 **Easy Integration** - Works seamlessly with Cursor, Claude Code, and other MCP clients
|
|
33
66
|
|
|
67
|
+
---
|
|
34
68
|
|
|
35
69
|
## 🚀 Quick Start
|
|
36
70
|
|
|
37
71
|
### Installation
|
|
38
72
|
|
|
39
|
-
**Option 1: Using npx (Recommended
|
|
73
|
+
**Option 1: Using npx (Recommended)**
|
|
40
74
|
|
|
41
75
|
No installation needed! Just configure and use via npx:
|
|
42
76
|
|
|
@@ -53,7 +87,7 @@ No installation needed! Just configure and use via npx:
|
|
|
53
87
|
|
|
54
88
|
The `-y` flag automatically accepts the npx prompt.
|
|
55
89
|
|
|
56
|
-
**Option 2: Global Installation
|
|
90
|
+
**Option 2: Global Installation**
|
|
57
91
|
|
|
58
92
|
```bash
|
|
59
93
|
npm install -g ai-readme-mcp
|
|
@@ -71,9 +105,9 @@ Then configure:
|
|
|
71
105
|
}
|
|
72
106
|
```
|
|
73
107
|
|
|
74
|
-
**Option 3: Local Development
|
|
108
|
+
**Option 3: Local Development**
|
|
75
109
|
|
|
76
|
-
> **Note:** Use this method
|
|
110
|
+
> **Note:** Use this method if you want to modify or contribute to the source code.
|
|
77
111
|
|
|
78
112
|
```bash
|
|
79
113
|
# Clone this repository to a permanent location
|
|
@@ -142,7 +176,7 @@ Add to Cursor's MCP configuration file:
|
|
|
142
176
|
**Windows:** `%APPDATA%\Cursor\User\mcp.json`
|
|
143
177
|
**macOS/Linux:** `~/.cursor/mcp.json`
|
|
144
178
|
|
|
145
|
-
**
|
|
179
|
+
**Using npx (Recommended):**
|
|
146
180
|
|
|
147
181
|
```json
|
|
148
182
|
{
|
|
@@ -155,7 +189,7 @@ Add to Cursor's MCP configuration file:
|
|
|
155
189
|
}
|
|
156
190
|
```
|
|
157
191
|
|
|
158
|
-
**
|
|
192
|
+
**If globally installed:**
|
|
159
193
|
|
|
160
194
|
```json
|
|
161
195
|
{
|
|
@@ -167,16 +201,14 @@ Add to Cursor's MCP configuration file:
|
|
|
167
201
|
}
|
|
168
202
|
```
|
|
169
203
|
|
|
170
|
-
**
|
|
204
|
+
**For local development:**
|
|
171
205
|
|
|
172
206
|
```json
|
|
173
207
|
{
|
|
174
208
|
"mcpServers": {
|
|
175
209
|
"ai-readme-manager": {
|
|
176
210
|
"command": "node",
|
|
177
|
-
"args": [
|
|
178
|
-
"D:\\Home\\WorkSpace\\playground\\ai-readme-mcp\\dist\\index.js"
|
|
179
|
-
]
|
|
211
|
+
"args": ["/path/to/ai-readme-mcp/dist/index.js"]
|
|
180
212
|
}
|
|
181
213
|
}
|
|
182
214
|
}
|
|
@@ -193,7 +225,7 @@ Add to `claude_desktop_config.json`:
|
|
|
193
225
|
**Windows:** `%APPDATA%\claude\claude_desktop_config.json`
|
|
194
226
|
**macOS/Linux:** `~/.config/claude/config.json` or `~/Library/Application Support/Claude/config.json`
|
|
195
227
|
|
|
196
|
-
**
|
|
228
|
+
**Using npx (Recommended):**
|
|
197
229
|
|
|
198
230
|
```json
|
|
199
231
|
{
|
|
@@ -206,7 +238,7 @@ Add to `claude_desktop_config.json`:
|
|
|
206
238
|
}
|
|
207
239
|
```
|
|
208
240
|
|
|
209
|
-
**
|
|
241
|
+
**If globally installed:**
|
|
210
242
|
|
|
211
243
|
```json
|
|
212
244
|
{
|
|
@@ -218,14 +250,14 @@ Add to `claude_desktop_config.json`:
|
|
|
218
250
|
}
|
|
219
251
|
```
|
|
220
252
|
|
|
221
|
-
**
|
|
253
|
+
**For local development:**
|
|
222
254
|
|
|
223
255
|
```json
|
|
224
256
|
{
|
|
225
257
|
"mcpServers": {
|
|
226
258
|
"ai-readme-manager": {
|
|
227
259
|
"command": "node",
|
|
228
|
-
"args": ["/
|
|
260
|
+
"args": ["/path/to/ai-readme-mcp/dist/index.js"]
|
|
229
261
|
}
|
|
230
262
|
}
|
|
231
263
|
}
|
|
@@ -233,7 +265,20 @@ Add to `claude_desktop_config.json`:
|
|
|
233
265
|
|
|
234
266
|
### Create Your First AI_README
|
|
235
267
|
|
|
236
|
-
|
|
268
|
+
You can use the `init_ai_readme` MCP tool to automatically generate a customized AI_README.md based on your project:
|
|
269
|
+
|
|
270
|
+
**Smart Mode (Default)**:
|
|
271
|
+
The tool automatically detects your project and generates relevant content:
|
|
272
|
+
- Detects project type (library/application/monorepo)
|
|
273
|
+
- Identifies language (TypeScript, Python, Go, Rust, Java, etc.)
|
|
274
|
+
- Recognizes framework (React, Vue, Next.js, Express, NestJS, etc.)
|
|
275
|
+
- Analyzes directory structure
|
|
276
|
+
- Generates framework-specific conventions
|
|
277
|
+
|
|
278
|
+
Ask your AI assistant:
|
|
279
|
+
> "Please use init_ai_readme to create an AI_README.md for this project"
|
|
280
|
+
|
|
281
|
+
Or create manually:
|
|
237
282
|
|
|
238
283
|
```markdown
|
|
239
284
|
# My Project
|
|
@@ -251,16 +296,59 @@ Create `AI_README.md` in your project root:
|
|
|
251
296
|
Run tests with: `npm test`
|
|
252
297
|
```
|
|
253
298
|
|
|
299
|
+
### Multi-Level AI_README (Not Just for Monorepos!)
|
|
300
|
+
|
|
301
|
+
**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.
|
|
302
|
+
|
|
303
|
+
**Why multi-level?**
|
|
304
|
+
- 🎯 **Avoid bloated root README** - Keep each README focused and concise
|
|
305
|
+
- 📍 **Precise context** - AI gets only the relevant conventions for the code it's working on
|
|
306
|
+
- 🔧 **Flexible organization** - Organize by feature, module, or any structure that makes sense
|
|
307
|
+
|
|
308
|
+
Simply place `AI_README.md` files at different folder levels:
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
my-monorepo/
|
|
312
|
+
├── AI_README.md # Root-level conventions (applies to all)
|
|
313
|
+
├── apps/
|
|
314
|
+
│ ├── frontend/
|
|
315
|
+
│ │ ├── AI_README.md # Frontend-specific conventions
|
|
316
|
+
│ │ └── src/components/Button.tsx
|
|
317
|
+
│ └── backend/
|
|
318
|
+
│ ├── AI_README.md # Backend-specific conventions
|
|
319
|
+
│ └── src/api/users.ts
|
|
320
|
+
└── packages/
|
|
321
|
+
└── shared/
|
|
322
|
+
├── AI_README.md # Shared library conventions
|
|
323
|
+
└── src/utils.ts
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Smart Empty README Handling:**
|
|
327
|
+
- 📝 If you create an empty `AI_README.md` in a subdirectory, the tool can auto-fill it with relevant conventions
|
|
328
|
+
- 🔗 For subdirectories with parent READMEs, generates differential content (only module-specific conventions)
|
|
329
|
+
- 📋 For root directories, generates full project analysis
|
|
330
|
+
- Ask your AI: "This AI_README.md is empty, can you help fill it?"
|
|
331
|
+
|
|
332
|
+
When AI works on a file, it automatically gets:
|
|
333
|
+
- The **most relevant** AI_README (closest parent directory)
|
|
334
|
+
- Plus the **root-level** AI_README (for project-wide standards)
|
|
335
|
+
|
|
336
|
+
For example, when editing `apps/frontend/src/components/Button.tsx`:
|
|
337
|
+
- ✅ Gets `apps/frontend/AI_README.md` (React component standards)
|
|
338
|
+
- ✅ Gets root `AI_README.md` (project-wide Git, testing conventions)
|
|
339
|
+
|
|
254
340
|
### Test the Integration
|
|
255
341
|
|
|
256
|
-
Restart
|
|
342
|
+
Restart your IDE, then ask your AI assistant:
|
|
257
343
|
|
|
258
344
|
> "I'm about to create a new component. What conventions should I follow?"
|
|
259
345
|
|
|
260
|
-
|
|
346
|
+
The AI will automatically retrieve your AI_README context!
|
|
261
347
|
|
|
262
348
|
For detailed setup instructions, see [Quick Start Guide](./docs/QUICK_START.md).
|
|
263
349
|
|
|
350
|
+
---
|
|
351
|
+
|
|
264
352
|
## 🏗️ Project Structure
|
|
265
353
|
|
|
266
354
|
```
|
|
@@ -309,15 +397,73 @@ npm run build
|
|
|
309
397
|
npm run dev
|
|
310
398
|
```
|
|
311
399
|
|
|
400
|
+
---
|
|
401
|
+
|
|
312
402
|
## 📚 Documentation
|
|
313
403
|
|
|
314
404
|
- **[Quick Start Guide](./docs/QUICK_START.md)** - Get started in 10 minutes
|
|
315
405
|
- **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute
|
|
316
406
|
- [Project Specification](./docs/SPEC.md) - Complete technical specification
|
|
317
|
-
|
|
407
|
+
|
|
408
|
+
---
|
|
318
409
|
|
|
319
410
|
## 🛠️ Available MCP Tools
|
|
320
411
|
|
|
412
|
+
### `init_ai_readme`
|
|
413
|
+
|
|
414
|
+
Initialize a new AI_README.md file with smart content generation based on project analysis.
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
// Parameters
|
|
418
|
+
{
|
|
419
|
+
targetPath: string; // Required: Directory where AI_README.md will be created
|
|
420
|
+
projectName?: string; // Optional: Project name (auto-detected if not provided)
|
|
421
|
+
overwrite?: boolean; // Optional: Overwrite existing file (default: false)
|
|
422
|
+
smart?: boolean; // Optional: Enable smart content generation (default: true)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Returns
|
|
426
|
+
{
|
|
427
|
+
success: boolean;
|
|
428
|
+
readmePath: string;
|
|
429
|
+
action: 'created' | 'filled' | 'overwritten';
|
|
430
|
+
projectInfo?: {
|
|
431
|
+
projectName: string;
|
|
432
|
+
projectType: 'library' | 'application' | 'monorepo' | 'unknown';
|
|
433
|
+
language: string;
|
|
434
|
+
framework?: string;
|
|
435
|
+
packageManager?: string;
|
|
436
|
+
hasTests: boolean;
|
|
437
|
+
mainDirs: string[];
|
|
438
|
+
};
|
|
439
|
+
message: string;
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Smart Mode Features**:
|
|
444
|
+
- Auto-detects project type, language, and framework
|
|
445
|
+
- Generates framework-specific conventions (React, Vue, Python, etc.)
|
|
446
|
+
- For subdirectories with parent READMEs, generates differential content
|
|
447
|
+
- Handles empty files (< 50 chars) by auto-filling them
|
|
448
|
+
- Analyzes directory structure and dependencies
|
|
449
|
+
|
|
450
|
+
**Example Usage**:
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
// Create smart README for React project
|
|
454
|
+
{
|
|
455
|
+
targetPath: "/path/to/react-app",
|
|
456
|
+
smart: true
|
|
457
|
+
}
|
|
458
|
+
// Result: Auto-detects React, generates component naming conventions, etc.
|
|
459
|
+
|
|
460
|
+
// Fill empty subdirectory README
|
|
461
|
+
{
|
|
462
|
+
targetPath: "/path/to/monorepo/apps/frontend"
|
|
463
|
+
}
|
|
464
|
+
// Result: Generates differential content extending root README
|
|
465
|
+
```
|
|
466
|
+
|
|
321
467
|
### `discover_ai_readmes`
|
|
322
468
|
|
|
323
469
|
Scans your project and discovers all AI_README.md files.
|
|
@@ -440,6 +586,63 @@ Update an AI_README.md file with specified operations.
|
|
|
440
586
|
}
|
|
441
587
|
```
|
|
442
588
|
|
|
589
|
+
### `validate_ai_readmes`
|
|
590
|
+
|
|
591
|
+
Validate all AI_README.md files in your project for quality and token efficiency.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
// Parameters
|
|
595
|
+
{
|
|
596
|
+
projectRoot: string; // Required: Project root directory
|
|
597
|
+
excludePatterns?: string[]; // Optional: Glob patterns to exclude
|
|
598
|
+
config?: { // Optional: Custom validation config
|
|
599
|
+
maxTokens?: number;
|
|
600
|
+
rules?: {
|
|
601
|
+
requireH1?: boolean;
|
|
602
|
+
requireSections?: string[];
|
|
603
|
+
allowCodeBlocks?: boolean;
|
|
604
|
+
maxLineLength?: number;
|
|
605
|
+
};
|
|
606
|
+
tokenLimits?: {
|
|
607
|
+
excellent?: number; // Default: 200
|
|
608
|
+
good?: number; // Default: 400
|
|
609
|
+
warning?: number; // Default: 600
|
|
610
|
+
error?: number; // Default: 1000
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// Returns
|
|
616
|
+
{
|
|
617
|
+
valid: boolean;
|
|
618
|
+
totalFiles: number;
|
|
619
|
+
results: Array<{
|
|
620
|
+
path: string;
|
|
621
|
+
valid: boolean;
|
|
622
|
+
tokens: number;
|
|
623
|
+
rating: 'excellent' | 'good' | 'needs-improvement' | 'too-long';
|
|
624
|
+
issues: string[];
|
|
625
|
+
suggestions: string[];
|
|
626
|
+
}>;
|
|
627
|
+
summary: string;
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
**Validation Features**:
|
|
632
|
+
- Token counting for AI consumption optimization
|
|
633
|
+
- Structure validation (H1 heading, sections)
|
|
634
|
+
- Line length checks (default: 100 chars)
|
|
635
|
+
- Code block detection (disabled by default for strict mode)
|
|
636
|
+
- Quality ratings based on token count
|
|
637
|
+
|
|
638
|
+
**Default Token Limits (Strict Mode)**:
|
|
639
|
+
- 🌟 Excellent: < 200 tokens
|
|
640
|
+
- ✅ Good: < 400 tokens
|
|
641
|
+
- ⚠️ Needs improvement: < 600 tokens
|
|
642
|
+
- ❌ Too long: > 1000 tokens
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
443
646
|
## 🚀 What's Next
|
|
444
647
|
|
|
445
648
|
We're actively working on new features:
|
|
@@ -451,6 +654,8 @@ We're actively working on new features:
|
|
|
451
654
|
|
|
452
655
|
Want to contribute? Check out our [Contributing Guide](./CONTRIBUTING.md)!
|
|
453
656
|
|
|
657
|
+
---
|
|
658
|
+
|
|
454
659
|
## 🤝 Contributing
|
|
455
660
|
|
|
456
661
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
@@ -472,4 +677,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
472
677
|
|
|
473
678
|
---
|
|
474
679
|
|
|
475
|
-
**Status:** ✅ Published | **Version:** 0.
|
|
680
|
+
**Status:** ✅ Published | **Version:** 0.3.1 | **Last Updated:** 2025-11-08
|