docmunch 0.2.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/README.md +129 -0
- package/dist/cli.mjs +1619 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# docmunch
|
|
2
|
+
|
|
3
|
+
Convert documentation URLs into clean, AI-ready Markdown files. Drop them into your project so AI coding assistants (Cursor, Claude Code, Copilot, etc.) have accurate, up-to-date context.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run directly
|
|
9
|
+
npx docmunch <url>
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g docmunch
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Fetch a single page to stdout
|
|
19
|
+
docmunch https://docs.stripe.com/api/charges
|
|
20
|
+
|
|
21
|
+
# Write to a file
|
|
22
|
+
docmunch https://docs.stripe.com/api/charges -o .ai/stripe.md
|
|
23
|
+
|
|
24
|
+
# Crawl linked pages
|
|
25
|
+
docmunch https://docs.stripe.com/api/charges --crawl --max-depth 2 -o .ai/stripe.md
|
|
26
|
+
|
|
27
|
+
# Manage sources in a config file
|
|
28
|
+
docmunch add https://docs.stripe.com/api/charges --name stripe --crawl
|
|
29
|
+
docmunch update # refresh all sources
|
|
30
|
+
docmunch update --name stripe # refresh one
|
|
31
|
+
docmunch list # show configured sources
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Platform detection** — auto-detects Mintlify, Docusaurus, GitBook, ReadMe, and falls back to Readability for generic sites
|
|
37
|
+
- **Code block preservation** — language tags and indentation survive extraction perfectly
|
|
38
|
+
- **Crawl mode** — follows sidebar/nav links with configurable depth, scoped to the documentation path
|
|
39
|
+
- **Smart fetching** — static fetch by default, auto-retries with Playwright for blocked sites (403, Cloudflare). Playwright is auto-installed on first need
|
|
40
|
+
- **Graceful interruption** — press Ctrl+C during a crawl to stop and choose whether to save pages collected so far
|
|
41
|
+
- **YAML frontmatter** — each output includes source URL, fetch date, platform, and title
|
|
42
|
+
- **Config file** — manage multiple doc sources with `.docmunch.yaml`
|
|
43
|
+
- **MCP server** — expose fetched docs to AI tools (Claude Code, Cursor) via Model Context Protocol
|
|
44
|
+
|
|
45
|
+
## MCP Server
|
|
46
|
+
|
|
47
|
+
Once you've crawled documentation, `docmunch serve` starts an MCP server that lets AI coding tools query your docs directly.
|
|
48
|
+
|
|
49
|
+
> **Prerequisite:** Install docmunch globally (`npm install -g docmunch`) or use `npx` to run it without installing. The setup examples below use `npx`, which downloads the package automatically if needed.
|
|
50
|
+
|
|
51
|
+
### Quick start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. Crawl some docs
|
|
55
|
+
npx docmunch https://docs.stripe.com/api/charges --crawl --name stripe
|
|
56
|
+
|
|
57
|
+
# 2. Start the MCP server
|
|
58
|
+
npx docmunch serve
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Claude Code
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add --scope project docmunch -- npx docmunch serve -d .ai/docs/
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
That's it. Run `/mcp` inside Claude Code to verify the server is connected.
|
|
68
|
+
|
|
69
|
+
Use `--scope user` instead to make it available across all your projects.
|
|
70
|
+
|
|
71
|
+
### Cursor
|
|
72
|
+
|
|
73
|
+
Open Cursor Settings (`Cmd+,` / `Ctrl+,`) → **MCP** → **+ Add new MCP server**, then:
|
|
74
|
+
|
|
75
|
+
- **Name**: `docmunch`
|
|
76
|
+
- **Type**: `command`
|
|
77
|
+
- **Command**: `npx docmunch serve -d .ai/docs/`
|
|
78
|
+
|
|
79
|
+
Alternatively, create a `.cursor/mcp.json` file at your project root:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"docmunch": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["docmunch", "serve", "-d", ".ai/docs/"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Restart Cursor for the server to be picked up. A green dot next to the server name in Settings → MCP confirms it's running.
|
|
93
|
+
|
|
94
|
+
### Available tools
|
|
95
|
+
|
|
96
|
+
Once connected, your AI assistant has access to:
|
|
97
|
+
|
|
98
|
+
- **`list_sources`** — see all available documentation sources
|
|
99
|
+
- **`list_pages`** — list pages within a source
|
|
100
|
+
- **`read_page`** — read the full markdown content of a page
|
|
101
|
+
- **`search_docs`** — full-text search across all docs
|
|
102
|
+
|
|
103
|
+
### Options
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
docmunch serve # serves .ai/docs/ (default)
|
|
107
|
+
docmunch serve -d ./docs/ # custom directory
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Config (.docmunch.yaml)
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
version: 1
|
|
114
|
+
output_dir: .ai/docs
|
|
115
|
+
sources:
|
|
116
|
+
- name: stripe
|
|
117
|
+
url: https://docs.stripe.com/api/charges
|
|
118
|
+
crawl: true
|
|
119
|
+
max_depth: 2
|
|
120
|
+
output: stripe.md
|
|
121
|
+
- name: yousign
|
|
122
|
+
url: https://developers.yousign.com/docs/set-up-your-account
|
|
123
|
+
crawl: false
|
|
124
|
+
output: yousign.md
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|