@devista/docs-mcp 1.0.0 → 1.0.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 +116 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# @devista/docs-mcp
|
|
2
2
|
|
|
3
|
-
A generic MCP server that
|
|
3
|
+
A generic MCP server that gives AI agents (Claude Code, Cursor, etc.) full-text search over any Markdown/MDX documentation folder. Point it at your docs and your AI assistant can search, browse, and read your project documentation during development.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
The server runs as a local process communicating over stdio (the standard MCP transport). When it starts:
|
|
8
|
+
|
|
9
|
+
1. **Freshness check** — compares modification times of your doc files against the last-built index
|
|
10
|
+
2. **Auto-rebuild** — if any file changed (or the index doesn't exist yet), it parses all Markdown/MDX files, strips MDX syntax (imports, JSX component tags), extracts frontmatter, and builds a [Flexsearch](https://github.com/nextapps-de/flexsearch) full-text search index
|
|
11
|
+
3. **Serve** — exposes three MCP tools (`search_docs`, `get_page`, `list_sections`) that agents can call to query your documentation
|
|
12
|
+
4. **Cached** — the index is stored in `.docs-mcp/` in your working directory, so subsequent startups are instant if nothing changed
|
|
13
|
+
|
|
14
|
+
The server understands standard Markdown frontmatter (`title`, `description`) and organizes pages into sections based on directory structure (e.g. `backend/payments.md` belongs to the `backend` section).
|
|
4
15
|
|
|
5
16
|
## Quick Start
|
|
6
17
|
|
|
@@ -17,20 +28,89 @@ Add to your project's `.mcp.json`:
|
|
|
17
28
|
}
|
|
18
29
|
```
|
|
19
30
|
|
|
20
|
-
That's it.
|
|
31
|
+
That's it. Restart your AI tool and the docs are queryable.
|
|
21
32
|
|
|
22
|
-
##
|
|
33
|
+
## Usage Examples
|
|
23
34
|
|
|
24
|
-
###
|
|
35
|
+
### Relative path — docs inside your project
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
When your documentation lives alongside your code:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
my-project/
|
|
41
|
+
├── src/
|
|
42
|
+
├── docs/ <-- your markdown docs
|
|
43
|
+
├── .mcp.json
|
|
44
|
+
└── package.json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"docs": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "@devista/docs-mcp", "--docs", "./docs"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Relative path — Astro/Starlight project
|
|
59
|
+
|
|
60
|
+
For documentation sites using Astro Starlight:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"docs": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "@devista/docs-mcp", "--docs", "./src/content/docs"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
30
72
|
|
|
31
|
-
###
|
|
73
|
+
### Absolute path — docs in a separate repo or folder
|
|
32
74
|
|
|
33
|
-
|
|
75
|
+
When your docs live outside the current project (e.g. a monorepo or a separate docs repo):
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"project-docs": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": [
|
|
83
|
+
"-y", "@devista/docs-mcp",
|
|
84
|
+
"--docs", "/Users/me/projects/my-docs/src/content/docs",
|
|
85
|
+
"--name", "project-docs"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Multiple documentation sources
|
|
93
|
+
|
|
94
|
+
You can register multiple instances for different doc folders:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"mcpServers": {
|
|
99
|
+
"api-docs": {
|
|
100
|
+
"command": "npx",
|
|
101
|
+
"args": ["-y", "@devista/docs-mcp", "--docs", "./docs/api", "--name", "api-docs"]
|
|
102
|
+
},
|
|
103
|
+
"architecture-docs": {
|
|
104
|
+
"command": "npx",
|
|
105
|
+
"args": ["-y", "@devista/docs-mcp", "--docs", "./docs/architecture", "--name", "architecture-docs"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Using a config file instead of CLI args
|
|
112
|
+
|
|
113
|
+
Create `.docs-mcp.json` in your project root:
|
|
34
114
|
|
|
35
115
|
```json
|
|
36
116
|
{
|
|
@@ -41,7 +121,7 @@ Create `.docs-mcp.json` in your project root for persistent settings:
|
|
|
41
121
|
}
|
|
42
122
|
```
|
|
43
123
|
|
|
44
|
-
|
|
124
|
+
Then your `.mcp.json` simplifies to:
|
|
45
125
|
|
|
46
126
|
```json
|
|
47
127
|
{
|
|
@@ -54,42 +134,49 @@ CLI args override config file values. When using a config file, your `.mcp.json`
|
|
|
54
134
|
}
|
|
55
135
|
```
|
|
56
136
|
|
|
57
|
-
|
|
137
|
+
## Configuration
|
|
138
|
+
|
|
139
|
+
### CLI Args
|
|
140
|
+
|
|
141
|
+
| Arg | Description |
|
|
142
|
+
|-----|-------------|
|
|
143
|
+
| `--docs <path>` | Path to documentation folder (required unless set in config file) |
|
|
144
|
+
| `--name <name>` | Server name shown in MCP clients (default: `docs-mcp`) |
|
|
145
|
+
|
|
146
|
+
### Config File (`.docs-mcp.json`)
|
|
147
|
+
|
|
148
|
+
| Setting | Type | Default | Description |
|
|
149
|
+
|---------|------|---------|-------------|
|
|
150
|
+
| `docs` | string | — | Path to documentation folder (required) |
|
|
151
|
+
| `include` | string[] | `["**/*.md", "**/*.mdx"]` | Glob patterns for files to index |
|
|
152
|
+
| `exclude` | string[] | `["**/node_modules/**"]` | Glob patterns for files to skip |
|
|
153
|
+
| `name` | string | `docs-mcp` | Server name shown in MCP clients |
|
|
58
154
|
|
|
59
|
-
|
|
60
|
-
|---------|---------|
|
|
61
|
-
| `include` | `["**/*.md", "**/*.mdx"]` |
|
|
62
|
-
| `exclude` | `["**/node_modules/**"]` |
|
|
63
|
-
| `name` | `docs-mcp` |
|
|
155
|
+
CLI args override config file values. Paths are resolved relative to the working directory.
|
|
64
156
|
|
|
65
157
|
## Tools
|
|
66
158
|
|
|
67
159
|
### `search_docs`
|
|
68
160
|
|
|
69
|
-
Full-text search across all documentation pages.
|
|
161
|
+
Full-text search across all documentation pages. Returns ranked results with text excerpts.
|
|
70
162
|
|
|
71
163
|
- **query** (string, required) — The search query
|
|
72
|
-
- **limit** (number, optional, default: 5) — Max results
|
|
164
|
+
- **limit** (number, optional, default: 5) — Max results to return
|
|
73
165
|
|
|
74
166
|
### `get_page`
|
|
75
167
|
|
|
76
|
-
Retrieve the full content of a specific page.
|
|
168
|
+
Retrieve the full Markdown content of a specific page, including frontmatter metadata.
|
|
77
169
|
|
|
78
|
-
- **path** (string, required) — Page path relative to docs root (e.g. `backend/payments`)
|
|
170
|
+
- **path** (string, required) — Page path relative to docs root, without extension (e.g. `backend/payments`)
|
|
79
171
|
|
|
80
172
|
### `list_sections`
|
|
81
173
|
|
|
82
|
-
List all documentation sections and their pages. No parameters.
|
|
83
|
-
|
|
84
|
-
## How It Works
|
|
85
|
-
|
|
86
|
-
1. On startup, the server checks if the search index needs rebuilding (compares file modification times)
|
|
87
|
-
2. If stale or missing, it parses all Markdown/MDX files, strips MDX syntax, and builds a [Flexsearch](https://github.com/nextapps-de/flexsearch) index
|
|
88
|
-
3. The index is stored in `.docs-mcp/` in your project root (add to `.gitignore`)
|
|
89
|
-
4. Three MCP tools are exposed over stdio transport
|
|
174
|
+
List all documentation sections and their pages. Returns a structured table of contents. No parameters.
|
|
90
175
|
|
|
91
176
|
## Add to .gitignore
|
|
92
177
|
|
|
178
|
+
The search index is cached locally. Add this to your `.gitignore`:
|
|
179
|
+
|
|
93
180
|
```
|
|
94
181
|
.docs-mcp/
|
|
95
182
|
```
|