ai-readme-mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Draco Cheng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,496 @@
1
+ # AI_README MCP Server
2
+
3
+ > Intelligent context management for AI_README.md files in your projects
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)](https://www.typescriptlang.org/)
7
+ [![Node](https://img.shields.io/badge/Node.js-18+-green)](https://nodejs.org/)
8
+
9
+ ## πŸ“‹ Overview
10
+
11
+ AI_README MCP Server is a Model Context Protocol (MCP) server that automatically manages and syncs AI_README.md files across your projects. It enables AI assistants to intelligently read and update relevant context documentation when modifying code.
12
+
13
+ ## ✨ Features
14
+
15
+ ### Available Now
16
+
17
+ - πŸ” **Automatic Discovery** - Scan and index all AI_README.md files in your project (Phase 1)
18
+ - 🎯 **Smart Context Routing** - Find relevant README content based on file paths (Phase 1)
19
+ - πŸ”„ **Update & Sync** - AI can both read and update AI_README files (Phase 2)
20
+ - πŸ“¦ **Easy Integration** - Works seamlessly with Claude Code and other MCP clients
21
+ - πŸ§ͺ **Well Tested** - 36 unit tests, 100% passing
22
+
23
+ ### Coming Soon
24
+
25
+ - βœ… **Validation & Health Checks** - Ensure README consistency and integrity (Phase 3)
26
+ - 🎬 **Watch Mode** - Auto-sync changes to README files (Phase 4)
27
+
28
+ ## πŸš€ Quick Start
29
+
30
+ ### Installation
31
+
32
+ **Option 1: Using npx (Recommended - After npm publish)**
33
+
34
+ No installation needed! Just configure and use via npx:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "ai-readme-manager": {
40
+ "command": "npx",
41
+ "args": ["-y", "ai-readme-mcp"]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ The `-y` flag automatically accepts the npx prompt.
48
+
49
+ **Option 2: Global Installation (After npm publish)**
50
+
51
+ ```bash
52
+ npm install -g ai-readme-mcp
53
+ ```
54
+
55
+ Then configure:
56
+
57
+ ```json
58
+ {
59
+ "mcpServers": {
60
+ "ai-readme-manager": {
61
+ "command": "ai-readme-mcp"
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ **Option 3: Local Development (Current)**
68
+
69
+ > **Note:** Use this method before npm package is published.
70
+
71
+ ```bash
72
+ # Clone this repository to a permanent location
73
+ git clone https://github.com/Draco-Cheng/ai-readme-mcp.git ~/ai-readme-mcp
74
+ cd ~/ai-readme-mcp
75
+
76
+ # Install and build
77
+ npm install
78
+ npm run build
79
+ ```
80
+
81
+ Then see configuration section below for manual setup.
82
+
83
+ ### Configuration for Claude Code (VSCode Extension)
84
+
85
+ **Option 1: Using CLI (Recommended)**
86
+
87
+ In your project directory, run:
88
+
89
+ ```bash
90
+ # If you cloned to ~/ai-readme-mcp:
91
+ claude mcp add --transport stdio ai-readme-manager --scope project -- node ~/ai-readme-mcp/dist/index.js
92
+
93
+ # Or use absolute path:
94
+ claude mcp add --transport stdio ai-readme-manager --scope project -- node /path/to/ai-readme-mcp/dist/index.js
95
+ ```
96
+
97
+ This creates a `.mcp.json` file in your project root.
98
+
99
+ **Option 2: Manual Configuration**
100
+
101
+ Create `.mcp.json` in your project root:
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "ai-readme-manager": {
107
+ "type": "stdio",
108
+ "command": "node",
109
+ "args": ["/absolute/path/to/ai-readme-mcp/dist/index.js"]
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ Replace `/absolute/path/to/ai-readme-mcp` with your actual installation path.
116
+
117
+ **Path examples:**
118
+ - **Windows:** `"C:\\Users\\YourName\\ai-readme-mcp\\dist\\index.js"`
119
+ - **macOS/Linux:** `"~/ai-readme-mcp/dist/index.js"` or `"/home/username/ai-readme-mcp/dist/index.js"`
120
+
121
+ > πŸ’‘ **Tip:** Clone to a permanent location like `~/ai-readme-mcp` so the path stays consistent across projects.
122
+
123
+ **Verify Installation:**
124
+
125
+ ```bash
126
+ claude mcp get ai-readme-manager
127
+ ```
128
+
129
+ You should see `Status: βœ“ Connected`
130
+
131
+ ### Configuration for Cursor
132
+
133
+ Add to Cursor's MCP configuration file:
134
+
135
+ **Windows:** `%APPDATA%\Cursor\User\mcp.json`
136
+ **macOS/Linux:** `~/.cursor/mcp.json`
137
+
138
+ **After npm publish (Recommended):**
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "ai-readme-manager": {
144
+ "command": "npx",
145
+ "args": ["-y", "ai-readme-mcp"]
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ **Or if globally installed:**
152
+
153
+ ```json
154
+ {
155
+ "mcpServers": {
156
+ "ai-readme-manager": {
157
+ "command": "ai-readme-mcp"
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ **Current (local development):**
164
+
165
+ ```json
166
+ {
167
+ "mcpServers": {
168
+ "ai-readme-manager": {
169
+ "command": "node",
170
+ "args": [
171
+ "D:\\Home\\WorkSpace\\playground\\ai-readme-mcp\\dist\\index.js"
172
+ ]
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ **Verify Installation:**
179
+
180
+ After configuring, restart Cursor completely. The MCP server should be available to AI assistants in Cursor.
181
+
182
+ ### Configuration for Claude Desktop Application
183
+
184
+ Add to `claude_desktop_config.json`:
185
+
186
+ **Windows:** `%APPDATA%\claude\claude_desktop_config.json`
187
+ **macOS/Linux:** `~/.config/claude/config.json` or `~/Library/Application Support/Claude/config.json`
188
+
189
+ **After npm publish (Recommended):**
190
+
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "ai-readme-manager": {
195
+ "command": "npx",
196
+ "args": ["-y", "ai-readme-mcp"]
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ **Or if globally installed:**
203
+
204
+ ```json
205
+ {
206
+ "mcpServers": {
207
+ "ai-readme-manager": {
208
+ "command": "ai-readme-mcp"
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ **Current (local development):**
215
+
216
+ ```json
217
+ {
218
+ "mcpServers": {
219
+ "ai-readme-manager": {
220
+ "command": "node",
221
+ "args": ["/absolute/path/to/ai-readme-mcp/dist/index.js"]
222
+ }
223
+ }
224
+ }
225
+ ```
226
+
227
+ ### Create Your First AI_README
228
+
229
+ Create `AI_README.md` in your project root:
230
+
231
+ ```markdown
232
+ # My Project
233
+
234
+ ## Architecture
235
+ - Framework: React + Express
236
+ - Database: PostgreSQL
237
+
238
+ ## Coding Conventions
239
+ - Use TypeScript for all files
240
+ - Components in PascalCase
241
+ - Test coverage: 80%+
242
+
243
+ ## Testing
244
+ Run tests with: `npm test`
245
+ ```
246
+
247
+ ### Test the Integration
248
+
249
+ Restart Claude Code, then ask:
250
+
251
+ > "I'm about to create a new component. What conventions should I follow?"
252
+
253
+ Claude will use the MCP server to retrieve your AI_README context!
254
+
255
+ For detailed setup instructions, see [Quick Start Guide](./docs/QUICK_START.md).
256
+
257
+ ## πŸ—οΈ Project Structure
258
+
259
+ ```
260
+ ai-readme-mcp/
261
+ β”œβ”€β”€ src/
262
+ β”‚ β”œβ”€β”€ index.ts # MCP Server entry point
263
+ β”‚ β”œβ”€β”€ tools/ # MCP Tools implementation
264
+ β”‚ β”œβ”€β”€ core/ # Core logic (scanner, router, updater)
265
+ β”‚ β”œβ”€β”€ types/ # TypeScript type definitions
266
+ β”‚ └── utils/ # Utility functions
267
+ β”œβ”€β”€ tests/
268
+ β”‚ β”œβ”€β”€ unit/ # Unit tests
269
+ β”‚ β”œβ”€β”€ integration/ # Integration tests
270
+ β”‚ └── fixtures/ # Test fixtures
271
+ └── docs/ # Documentation
272
+ ```
273
+
274
+ ## πŸ› οΈ Development
275
+
276
+ ### Prerequisites
277
+
278
+ - Node.js 18+
279
+ - npm/pnpm/yarn
280
+ - TypeScript 5+
281
+
282
+ ### Setup
283
+
284
+ ```bash
285
+ # Clone the repository
286
+ git clone https://github.com/Draco-Cheng/ai-readme-mcp.git
287
+ cd ai-readme-mcp
288
+
289
+ # Install dependencies
290
+ npm install
291
+
292
+ # Run type checking
293
+ npm run typecheck
294
+
295
+ # Run tests
296
+ npm test
297
+
298
+ # Build the project
299
+ npm run build
300
+
301
+ # Development mode with watch
302
+ npm run dev
303
+ ```
304
+
305
+ ## πŸ“š Documentation
306
+
307
+ - **[Quick Start Guide](./docs/QUICK_START.md)** - Get started in 10 minutes
308
+ - **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute
309
+ - [Project Specification](./docs/SPEC.md) - Complete technical specification
310
+ - [AI_README Templates](./docs/templates/) - Example templates for your projects
311
+
312
+ ## πŸ› οΈ Available MCP Tools
313
+
314
+ ### `discover_ai_readmes`
315
+
316
+ Scans your project and discovers all AI_README.md files.
317
+
318
+ ```typescript
319
+ // Parameters
320
+ {
321
+ projectRoot: string; // Required: Project root directory
322
+ excludePatterns?: string[]; // Optional: Glob patterns to exclude
323
+ }
324
+
325
+ // Returns
326
+ {
327
+ projectRoot: string;
328
+ totalFound: number;
329
+ readmeFiles: Array<{
330
+ path: string;
331
+ scope: string;
332
+ level: number;
333
+ patterns: string[];
334
+ }>;
335
+ lastUpdated: string;
336
+ }
337
+ ```
338
+
339
+ ### `get_context_for_file`
340
+
341
+ Gets relevant AI_README context for a specific file path.
342
+
343
+ ```typescript
344
+ // Parameters
345
+ {
346
+ projectRoot: string; // Required: Project root directory
347
+ filePath: string; // Required: File path relative to root
348
+ includeRoot?: boolean; // Optional: Include root README (default: true)
349
+ excludePatterns?: string[]; // Optional: Glob patterns to exclude
350
+ }
351
+
352
+ // Returns
353
+ {
354
+ filePath: string;
355
+ totalContexts: number;
356
+ contexts: Array<{
357
+ path: string;
358
+ relevance: 'root' | 'direct' | 'parent';
359
+ distance: number;
360
+ content: string;
361
+ }>;
362
+ formattedPrompt: string; // Ready-to-use formatted context
363
+ }
364
+ ```
365
+
366
+ ### `update_ai_readme`
367
+
368
+ Update an AI_README.md file with specified operations.
369
+
370
+ ```typescript
371
+ // Parameters
372
+ {
373
+ readmePath: string; // Required: Path to AI_README.md file
374
+ operations: Array<{ // Required: Update operations to perform
375
+ type: 'append' | 'prepend' | 'replace' | 'insert-after' | 'insert-before';
376
+ content: string; // Content to add or replace
377
+ section?: string; // Section heading (for insert operations)
378
+ searchText?: string; // Text to search for (for replace)
379
+ }>;
380
+ }
381
+
382
+ // Returns
383
+ {
384
+ success: boolean;
385
+ readmePath: string;
386
+ changes: Array<{
387
+ operation: string;
388
+ section?: string;
389
+ linesAdded: number;
390
+ linesRemoved: number;
391
+ }>;
392
+ summary: string; // Includes reminder to use git diff
393
+ error?: string; // Error message if failed
394
+ }
395
+ ```
396
+
397
+ **Note:** Changes are written directly to the file. Use Git for version control:
398
+ - Review changes: `git diff AI_README.md`
399
+ - Undo changes: `git checkout AI_README.md`
400
+ - Commit changes: `git add AI_README.md && git commit -m "Update AI_README"`
401
+ ```
402
+
403
+ **Example Usage:**
404
+
405
+ ```typescript
406
+ // Append new section
407
+ {
408
+ readmePath: "apps/frontend/AI_README.md",
409
+ operations: [{
410
+ type: "append",
411
+ content: "## Performance\n- Use React.memo for expensive components"
412
+ }]
413
+ }
414
+
415
+ // Insert after specific section
416
+ {
417
+ readmePath: "AI_README.md",
418
+ operations: [{
419
+ type: "insert-after",
420
+ section: "## Coding Conventions",
421
+ content: "### Code Style\n- Use TypeScript strict mode\n- Prefer const over let"
422
+ }]
423
+ }
424
+
425
+ // Replace specific text
426
+ {
427
+ readmePath: "AI_README.md",
428
+ operations: [{
429
+ type: "replace",
430
+ searchText: "Run tests with npm test",
431
+ content: "Run tests with: `npm test` or `npm run test:watch`"
432
+ }]
433
+ }
434
+ ```
435
+
436
+ ## πŸ—ΊοΈ Development Roadmap
437
+
438
+ ### Phase 0: Initial Setup βœ… COMPLETED
439
+ - [x] Project structure
440
+ - [x] TypeScript configuration
441
+ - [x] Build tooling (tsup)
442
+ - [x] Testing setup (Node.js native test runner)
443
+ - [x] Basic type definitions
444
+
445
+ ### Phase 1: MVP (Core Features) βœ… COMPLETED
446
+ - [x] Implement AIReadmeScanner
447
+ - [x] Implement ContextRouter
448
+ - [x] Create `discover_ai_readmes` tool
449
+ - [x] Create `get_context_for_file` tool
450
+ - [x] Write comprehensive tests (26 tests, all passing)
451
+ - [x] MCP server integration
452
+ - [x] Documentation and templates
453
+
454
+ ### Phase 2: Update & Sync βœ… COMPLETED
455
+ - [x] Implement ReadmeUpdater
456
+ - [x] Create `update_ai_readme` tool
457
+ - [x] Support 5 operation types (append, prepend, replace, insert-after, insert-before)
458
+ - [x] Write comprehensive tests (36 tests total, all passing)
459
+
460
+ ### Phase 3: Validation & Quality πŸ“‹ NEXT
461
+ - [ ] Implement ReadmeValidator
462
+ - [ ] Create `validate_ai_readmes` tool
463
+ - [ ] Health check functionality
464
+
465
+ ### Phase 4: Advanced Features
466
+ - [ ] Watch mode for auto-sync
467
+ - [ ] Performance optimization and caching
468
+ - [ ] VSCode Extension
469
+
470
+ ### Phase 5: Distribution
471
+ - [ ] Publish to npm registry
472
+ - [ ] Add npx support for easier installation
473
+ - [ ] CI/CD pipeline for automated releases
474
+
475
+ ## 🀝 Contributing
476
+
477
+ Contributions are welcome! Please feel free to submit a Pull Request.
478
+
479
+ ## πŸ“„ License
480
+
481
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
482
+
483
+ ## πŸ”— Related Resources
484
+
485
+ - [Model Context Protocol Specification](https://spec.modelcontextprotocol.io/)
486
+ - [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
487
+ - [Claude Code MCP Documentation](https://docs.claude.com/en/docs/claude-code/mcp)
488
+
489
+ ## πŸ“§ Contact
490
+
491
+ - GitHub Issues: https://github.com/Draco-Cheng/ai-readme-mcp/issues
492
+ - Project Link: https://github.com/Draco-Cheng/ai-readme-mcp
493
+
494
+ ---
495
+
496
+ **Status:** 🚧 In Development | **Version:** 0.1.0 | **Last Updated:** 2025-11-05
@@ -0,0 +1,2 @@
1
+
2
+ export { }