@afterxleep/doc-bot 1.0.0 โ 1.0.2
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 +81 -274
- package/bin/doc-bot.js +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,89 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# doc-bot
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@afterxleep/doc-bot)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
A generic
|
|
6
|
+
A generic MCP (Model Context Protocol) server that provides intelligent documentation access for any project. Works with any MCP-compatible AI tools and IDEs.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## What is doc-bot?
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **๐ ๏ธ Universal**: Works with any project, any language, any framework
|
|
10
|
+
doc-bot is an intelligent documentation server that:
|
|
11
|
+
- ๐ **Searches** your project documentation instantly
|
|
12
|
+
- ๐ง **Infers** relevant docs based on your current work
|
|
13
|
+
- ๐ **Applies** global rules to every AI interaction
|
|
14
|
+
- ๐ฏ **Suggests** contextual documentation based on file patterns
|
|
15
|
+
- ๐ **Updates** automatically when docs change
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Installation
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
1. **Create your documentation folder** in your project root (see organization section below)
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Navigate to your project directory
|
|
25
|
-
cd your-project
|
|
26
|
-
|
|
27
|
-
# Run the server (installs automatically)
|
|
28
|
-
npx docbot
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
2. **Create your documentation structure:**
|
|
32
|
-
```bash
|
|
33
|
-
mkdir docbot
|
|
34
|
-
echo '{"name": "My Project Documentation", "globalRules": []}' > docbot/manifest.json
|
|
35
|
-
echo "# Getting Started" > docbot/README.md
|
|
36
|
-
```
|
|
21
|
+
2. **Add doc-bot to your MCP-compatible AI tool configuration**:
|
|
37
22
|
|
|
38
|
-
|
|
23
|
+
**For Claude Code** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
39
24
|
```json
|
|
40
25
|
{
|
|
41
26
|
"mcpServers": {
|
|
42
27
|
"docs": {
|
|
43
28
|
"command": "npx",
|
|
44
|
-
"args": ["
|
|
29
|
+
"args": ["@afterxleep/doc-bot", "--docs", "./doc-bot"]
|
|
45
30
|
}
|
|
46
31
|
}
|
|
47
32
|
}
|
|
48
33
|
```
|
|
49
34
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### Global Installation
|
|
35
|
+
**For Cursor or other MCP tools**: Add similar configuration pointing to your documentation folder
|
|
53
36
|
|
|
54
|
-
|
|
55
|
-
# Install globally
|
|
56
|
-
npm install -g docbot
|
|
37
|
+
3. **Restart your AI tool**
|
|
57
38
|
|
|
58
|
-
|
|
59
|
-
docbot
|
|
60
|
-
```
|
|
39
|
+
## How to organize your documentation
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Create a `docbot/` folder in your project root:
|
|
41
|
+
Create a `doc-bot/` folder in your project root:
|
|
65
42
|
|
|
66
43
|
```
|
|
67
44
|
your-project/
|
|
68
|
-
โโโ
|
|
69
|
-
โ โโโ manifest.json # Configuration
|
|
45
|
+
โโโ doc-bot/
|
|
46
|
+
โ โโโ manifest.json # Configuration file
|
|
70
47
|
โ โโโ core/
|
|
71
|
-
โ โ โโโ
|
|
72
|
-
โ โ
|
|
73
|
-
โ โ โโโ security.md # Security guidelines
|
|
48
|
+
โ โ โโโ coding-standards.md # Always-apply coding standards
|
|
49
|
+
โ โ โโโ security.md # Security guidelines
|
|
74
50
|
โ โโโ guides/
|
|
75
|
-
โ โ โโโ testing.md
|
|
76
|
-
โ โ
|
|
77
|
-
โ โ โโโ api-development.md # API development guide
|
|
51
|
+
โ โ โโโ testing.md # Testing strategies
|
|
52
|
+
โ โ โโโ api-development.md # API development guide
|
|
78
53
|
โ โโโ reference/
|
|
79
|
-
โ
|
|
80
|
-
โ โโโ best-practices.md # Best practices by topic
|
|
54
|
+
โ โโโ troubleshooting.md # Common issues and solutions
|
|
81
55
|
โโโ package.json
|
|
82
56
|
```
|
|
83
57
|
|
|
84
|
-
|
|
58
|
+
**Note:** You can use any folder name - just specify it in your MCP configuration:
|
|
59
|
+
```json
|
|
60
|
+
"args": ["@afterxleep/doc-bot", "--docs", "./my-custom-docs"]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Documentation types:
|
|
85
64
|
|
|
86
|
-
|
|
65
|
+
- **Core docs** (`core/`): Critical guidelines that should always be considered
|
|
66
|
+
- **Guides** (`guides/`): Step-by-step instructions for specific tasks
|
|
67
|
+
- **Reference** (`reference/`): Quick lookups and troubleshooting
|
|
68
|
+
|
|
69
|
+
## The manifest file
|
|
70
|
+
|
|
71
|
+
The `doc-bot/manifest.json` file controls how your documentation works:
|
|
87
72
|
|
|
88
73
|
```json
|
|
89
74
|
{
|
|
@@ -98,262 +83,84 @@ your-project/
|
|
|
98
83
|
"*.test.js": ["guides/testing.md"],
|
|
99
84
|
"*.spec.js": ["guides/testing.md"],
|
|
100
85
|
"src/components/*": ["guides/react-components.md"],
|
|
101
|
-
"src/api/*": ["guides/api-development.md"]
|
|
102
|
-
"*.md": ["guides/documentation.md"],
|
|
103
|
-
"package.json": ["guides/dependencies.md"]
|
|
86
|
+
"src/api/*": ["guides/api-development.md"]
|
|
104
87
|
},
|
|
105
88
|
"inference": {
|
|
106
89
|
"keywords": {
|
|
107
90
|
"testing": ["guides/testing.md"],
|
|
108
91
|
"deployment": ["guides/deployment.md"],
|
|
109
|
-
"api": ["guides/api-development.md"]
|
|
110
|
-
"security": ["core/security.md"],
|
|
111
|
-
"performance": ["guides/performance.md"]
|
|
92
|
+
"api": ["guides/api-development.md"]
|
|
112
93
|
},
|
|
113
94
|
"patterns": {
|
|
114
95
|
"describe(": ["guides/testing.md"],
|
|
115
96
|
"it(": ["guides/testing.md"],
|
|
116
|
-
"fetch(": ["guides/api-development.md"]
|
|
117
|
-
"console.error": ["reference/troubleshooting.md"],
|
|
118
|
-
"try {": ["reference/error-handling.md"]
|
|
97
|
+
"fetch(": ["guides/api-development.md"]
|
|
119
98
|
}
|
|
120
99
|
}
|
|
121
100
|
}
|
|
122
101
|
```
|
|
123
102
|
|
|
124
|
-
### Configuration
|
|
125
|
-
|
|
126
|
-
- **`globalRules`**: Documentation that applies to all interactions
|
|
127
|
-
- **`contextualRules`**: Documentation triggered by specific file patterns
|
|
128
|
-
- **`inference.keywords`**: Documentation triggered by keywords in queries
|
|
129
|
-
- **`inference.patterns`**: Documentation triggered by code patterns
|
|
130
|
-
|
|
131
|
-
## ๐ง CLI Options
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
docbot [options]
|
|
135
|
-
|
|
136
|
-
Options:
|
|
137
|
-
-p, --port <port> Port to run server on (default: 3000)
|
|
138
|
-
-d, --docs <path> Path to docs folder (default: ./docbot)
|
|
139
|
-
-c, --config <path> Path to manifest file (default: ./docbot/manifest.json)
|
|
140
|
-
-v, --verbose Enable verbose logging
|
|
141
|
-
-w, --watch Watch for file changes
|
|
142
|
-
-h, --help Show help
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## ๐ฏ How It Works
|
|
146
|
-
|
|
147
|
-
### 1. Global Rules (Always Apply)
|
|
148
|
-
Documents listed in `globalRules` are automatically included in every AI interaction:
|
|
149
|
-
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"globalRules": [
|
|
153
|
-
"core/coding-standards.md",
|
|
154
|
-
"core/security.md"
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### 2. Contextual Rules (File-Based)
|
|
160
|
-
When you're working on specific files, relevant documentation is automatically suggested:
|
|
161
|
-
|
|
162
|
-
```json
|
|
163
|
-
{
|
|
164
|
-
"contextualRules": {
|
|
165
|
-
"*.test.js": ["guides/testing.md"],
|
|
166
|
-
"src/components/*": ["guides/react-components.md"]
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 3. Smart Inference
|
|
172
|
-
The server analyzes your queries and code to suggest relevant documentation:
|
|
173
|
-
|
|
174
|
-
- **Keywords**: "testing" โ `guides/testing.md`
|
|
175
|
-
- **Code Patterns**: `describe(` โ `guides/testing.md`
|
|
176
|
-
- **File Extensions**: `.py` โ Python-related docs
|
|
177
|
-
|
|
178
|
-
## ๐ Documentation Format
|
|
179
|
-
|
|
180
|
-
### Frontmatter Support
|
|
181
|
-
Add metadata to your documentation:
|
|
182
|
-
|
|
183
|
-
```markdown
|
|
184
|
-
---
|
|
185
|
-
title: Testing Guide
|
|
186
|
-
description: Comprehensive testing strategies
|
|
187
|
-
category: guides
|
|
188
|
-
tags: [testing, jest, react]
|
|
189
|
-
alwaysApply: false
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
# Testing Guide
|
|
193
|
-
|
|
194
|
-
Your documentation content here...
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Supported Formats
|
|
198
|
-
- **Markdown** (`.md`)
|
|
199
|
-
- **MDX** (`.mdx`)
|
|
200
|
-
- **Cursor Rules** (`.mdc`)
|
|
201
|
-
|
|
202
|
-
## ๐ ๏ธ Available Tools
|
|
203
|
-
|
|
204
|
-
When using with Claude Code or other MCP clients:
|
|
205
|
-
|
|
206
|
-
### `search_documentation`
|
|
207
|
-
```javascript
|
|
208
|
-
// Search all documentation
|
|
209
|
-
search_documentation({ query: "testing best practices" })
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### `get_relevant_docs`
|
|
213
|
-
```javascript
|
|
214
|
-
// Get context-aware suggestions
|
|
215
|
-
get_relevant_docs({
|
|
216
|
-
context: {
|
|
217
|
-
query: "How to test React components",
|
|
218
|
-
filePath: "src/components/UserProfile.test.tsx",
|
|
219
|
-
codeSnippet: "describe('UserProfile', () => {"
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
```
|
|
103
|
+
### Configuration explained:
|
|
223
104
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
```
|
|
105
|
+
- **`globalRules`**: Documents that apply to every AI interaction
|
|
106
|
+
- **`contextualRules`**: Documents triggered by specific file patterns (e.g., test files โ testing guide)
|
|
107
|
+
- **`inference.keywords`**: Documents suggested when certain words appear in queries
|
|
108
|
+
- **`inference.patterns`**: Documents suggested when certain code patterns are detected
|
|
229
109
|
|
|
230
|
-
|
|
231
|
-
```javascript
|
|
232
|
-
// Get file-specific documentation
|
|
233
|
-
get_file_docs({ filePath: "src/api/users.js" })
|
|
234
|
-
```
|
|
110
|
+
## Development setup
|
|
235
111
|
|
|
236
|
-
|
|
112
|
+
### Running locally
|
|
237
113
|
|
|
238
|
-
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
"contextualRules": {
|
|
243
|
-
"src/components/*": ["guides/components.md"],
|
|
244
|
-
"*.test.tsx": ["guides/testing.md"]
|
|
245
|
-
},
|
|
246
|
-
"inference": {
|
|
247
|
-
"keywords": {
|
|
248
|
-
"hook": ["guides/hooks.md"],
|
|
249
|
-
"state": ["guides/state-management.md"]
|
|
250
|
-
},
|
|
251
|
-
"patterns": {
|
|
252
|
-
"useState": ["guides/hooks.md"],
|
|
253
|
-
"useEffect": ["guides/hooks.md"]
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Node.js API Project
|
|
260
|
-
```json
|
|
261
|
-
{
|
|
262
|
-
"globalRules": ["core/api-standards.md", "core/security.md"],
|
|
263
|
-
"contextualRules": {
|
|
264
|
-
"routes/*": ["guides/routing.md"],
|
|
265
|
-
"middleware/*": ["guides/middleware.md"],
|
|
266
|
-
"*.test.js": ["guides/testing.md"]
|
|
267
|
-
},
|
|
268
|
-
"inference": {
|
|
269
|
-
"keywords": {
|
|
270
|
-
"authentication": ["guides/auth.md"],
|
|
271
|
-
"database": ["guides/database.md"]
|
|
272
|
-
},
|
|
273
|
-
"patterns": {
|
|
274
|
-
"app.get": ["guides/routing.md"],
|
|
275
|
-
"app.post": ["guides/routing.md"]
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## ๐ Integration with IDEs
|
|
282
|
-
|
|
283
|
-
### Claude Code
|
|
284
|
-
1. Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
285
|
-
```json
|
|
286
|
-
{
|
|
287
|
-
"mcpServers": {
|
|
288
|
-
"docs": {
|
|
289
|
-
"command": "npx",
|
|
290
|
-
"args": ["docbot"]
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
114
|
+
1. **Clone the repository:**
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/afterxleep/doc-bot.git
|
|
117
|
+
cd doc-bot
|
|
294
118
|
```
|
|
295
119
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
Use with Claude Code extension or MCP-compatible extensions
|
|
120
|
+
2. **Install dependencies:**
|
|
121
|
+
```bash
|
|
122
|
+
npm install
|
|
123
|
+
```
|
|
301
124
|
|
|
302
|
-
|
|
125
|
+
3. **Run the server:**
|
|
126
|
+
```bash
|
|
127
|
+
npm start
|
|
128
|
+
```
|
|
303
129
|
|
|
304
|
-
|
|
130
|
+
4. **Run tests:**
|
|
305
131
|
```bash
|
|
306
|
-
|
|
307
|
-
echo '{"name": "Test Docs", "globalRules": ["test.md"]}' > docbot/manifest.json
|
|
308
|
-
echo "# Test Document\nThis is a test." > docbot/test.md
|
|
132
|
+
npm test
|
|
309
133
|
```
|
|
310
134
|
|
|
311
|
-
|
|
135
|
+
5. **Run with file watching:**
|
|
312
136
|
```bash
|
|
313
|
-
|
|
137
|
+
npm start -- --watch
|
|
314
138
|
```
|
|
315
139
|
|
|
316
|
-
|
|
317
|
-
- Ask: "What documentation is available?"
|
|
318
|
-
- Try: "Show me the global rules"
|
|
140
|
+
### Testing your setup
|
|
319
141
|
|
|
320
|
-
|
|
142
|
+
Ask your AI assistant something like "What documentation is available?" to test that doc-bot is working.
|
|
321
143
|
|
|
322
|
-
|
|
144
|
+
### CLI Options
|
|
323
145
|
|
|
324
|
-
### Development Setup
|
|
325
146
|
```bash
|
|
326
|
-
|
|
327
|
-
git clone https://github.com/yourusername/docbot.git
|
|
328
|
-
cd docbot
|
|
329
|
-
|
|
330
|
-
# Install dependencies
|
|
331
|
-
npm install
|
|
147
|
+
doc-bot [options]
|
|
332
148
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
149
|
+
Options:
|
|
150
|
+
-d, --docs <path> Path to docs folder (required)
|
|
151
|
+
-c, --config <path> Path to manifest file (default: <docs-path>/manifest.json)
|
|
152
|
+
-p, --port <port> Port to run server on (default: 3000)
|
|
153
|
+
-v, --verbose Enable verbose logging
|
|
154
|
+
-w, --watch Watch for file changes
|
|
155
|
+
-h, --help Show help
|
|
338
156
|
```
|
|
339
157
|
|
|
340
|
-
##
|
|
158
|
+
## License
|
|
341
159
|
|
|
342
160
|
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
343
161
|
|
|
344
|
-
##
|
|
345
|
-
|
|
346
|
-
- Built on the [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
|
347
|
-
- Inspired by the need for intelligent, context-aware documentation
|
|
348
|
-
- Thanks to the Claude Code and Cursor teams for MCP support
|
|
349
|
-
|
|
350
|
-
## ๐ Links
|
|
351
|
-
|
|
352
|
-
- [npm package](https://www.npmjs.com/package/docbot)
|
|
353
|
-
- [GitHub repository](https://github.com/yourusername/docbot)
|
|
354
|
-
- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
|
355
|
-
- [Claude Code documentation](https://docs.anthropic.com/claude/docs/claude-code)
|
|
356
|
-
|
|
357
|
-
---
|
|
162
|
+
## Links
|
|
358
163
|
|
|
359
|
-
|
|
164
|
+
- [npm package](https://www.npmjs.com/package/@afterxleep/doc-bot)
|
|
165
|
+
- [GitHub repository](https://github.com/afterxleep/doc-bot)
|
|
166
|
+
- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)
|
package/bin/doc-bot.js
CHANGED
|
@@ -8,10 +8,10 @@ const { DocsServer } = require('../src/index.js');
|
|
|
8
8
|
program
|
|
9
9
|
.name('doc-bot')
|
|
10
10
|
.description('Generic MCP server for intelligent documentation access')
|
|
11
|
-
.version('1.0.
|
|
11
|
+
.version('1.0.2')
|
|
12
12
|
.option('-p, --port <port>', 'Port to run server on', '3000')
|
|
13
|
-
.
|
|
14
|
-
.option('-c, --config <path>', 'Path to manifest file'
|
|
13
|
+
.requiredOption('-d, --docs <path>', 'Path to docs folder')
|
|
14
|
+
.option('-c, --config <path>', 'Path to manifest file')
|
|
15
15
|
.option('-v, --verbose', 'Enable verbose logging')
|
|
16
16
|
.option('-w, --watch', 'Watch for file changes')
|
|
17
17
|
.parse();
|
|
@@ -20,19 +20,19 @@ const options = program.opts();
|
|
|
20
20
|
|
|
21
21
|
async function main() {
|
|
22
22
|
const docsPath = path.resolve(options.docs);
|
|
23
|
-
const configPath = path.resolve(options.config);
|
|
23
|
+
const configPath = options.config ? path.resolve(options.config) : path.resolve(options.docs, 'manifest.json');
|
|
24
24
|
|
|
25
|
-
// Check if
|
|
25
|
+
// Check if documentation folder exists
|
|
26
26
|
if (!await fs.pathExists(docsPath)) {
|
|
27
27
|
console.error(`โ Documentation folder not found: ${docsPath}`);
|
|
28
28
|
console.log('');
|
|
29
|
-
console.log('๐ To get started, create
|
|
29
|
+
console.log('๐ To get started, create your documentation folder:');
|
|
30
30
|
console.log('');
|
|
31
|
-
console.log(
|
|
32
|
-
console.log(
|
|
33
|
-
console.log(
|
|
31
|
+
console.log(` mkdir ${path.basename(docsPath)}`);
|
|
32
|
+
console.log(` echo '{"name": "My Project Documentation", "globalRules": []}' > ${path.basename(docsPath)}/manifest.json`);
|
|
33
|
+
console.log(` echo "# Getting Started" > ${path.basename(docsPath)}/README.md`);
|
|
34
34
|
console.log('');
|
|
35
|
-
console.log('Then
|
|
35
|
+
console.log('Then configure your MCP client to use this folder.');
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
|