@arabold/docs-mcp-server 3.4.1 → 3.5.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 CHANGED
@@ -17,7 +17,7 @@ It is an open-source alternative to Context7, Nia and Ref.Tools.
17
17
 
18
18
  ## Quick Start
19
19
 
20
- You need Node.js 22 or later, or Docker. [Installation](docs/setup/installation.md) covers both in detail, along with Docker Compose and running the server inside your AI client.
20
+ You need Node.js 22.14 or later, or Docker. [Installation](docs/setup/installation.md) covers both in detail, along with Docker Compose and running the server inside your AI client.
21
21
 
22
22
  ### 1. Start the server
23
23
 
@@ -88,6 +88,7 @@ npx @arabold/docs-mcp-server@latest fetch-url https://react.dev/reference/react/
88
88
 
89
89
  - Before it crawls a website, a scrape or refresh looks for an `llms.txt` file in the start URL's directory and at the site root. The links listed there become extra starting points, and for those pages the scraper first tries the Markdown version of the URL, such as `/guide/index.html.md` or `/page.html.md`.
90
90
  - Requests ask for HTML first, like a browser. Markdown that a server converts on request leaves out the site's navigation, so a crawl would miss most pages. The scraper uses Markdown where the site publishes it: pages listed in `llms.txt` and links to `.md` files. A custom `Accept` header replaces the default one.
91
+ - A crawl does not follow links to `llms.txt` or to its companions such as `llms-full.txt`, `llms-small.txt` and `llms-medium.txt` (any `llms-*.txt`). A companion holds the site's docs joined into one file, complete or abridged, and the crawl already indexes those pages under their own URLs. To index a companion on its own, use its URL as the start URL; it is read as Markdown.
91
92
  - For documentation sites that route with hash URLs, such as `https://docs.example.com/#/guide`, turn on hash routes for the scrape. See [Hash Route Behavior](docs/setup/configuration.md#hash-route-behavior).
92
93
 
93
94
  ## Documentation
@@ -0,0 +1,51 @@
1
+ -- Keeps each page's chunk count on the page, so listing libraries reads pages
2
+ -- instead of every chunk.
3
+ --
4
+ -- The listing counted documents through idx_documents_sort_order for every
5
+ -- version on every call. On a store of 20 million chunks that took 94 seconds,
6
+ -- on the thread that also answers searches and runs jobs, and it ran for each
7
+ -- list_libraries call and each search naming an unknown library.
8
+
9
+ -- @migration-step add and backfill page chunk counts
10
+ ALTER TABLE pages ADD COLUMN chunk_count INTEGER NOT NULL DEFAULT 0;
11
+
12
+ -- The count is bookkeeping, not a change to the page, so neither the backfill
13
+ -- nor the triggers below may move pages.updated_at. The timestamp trigger is
14
+ -- dropped for the backfill and recreated to skip count-only updates.
15
+ DROP TRIGGER IF EXISTS pages_updated_at_trigger;
16
+
17
+ UPDATE pages
18
+ SET chunk_count = (SELECT COUNT(*) FROM documents d WHERE d.page_id = pages.id);
19
+
20
+ -- @migration-step keep page chunk counts current
21
+ CREATE TRIGGER pages_updated_at_trigger
22
+ AFTER UPDATE ON pages
23
+ WHEN NEW.chunk_count IS OLD.chunk_count
24
+ BEGIN
25
+ UPDATE pages SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
26
+ END;
27
+
28
+ CREATE TRIGGER pages_chunk_count_after_insert
29
+ AFTER INSERT ON documents
30
+ BEGIN
31
+ UPDATE pages SET chunk_count = chunk_count + 1 WHERE id = NEW.page_id;
32
+ END;
33
+
34
+ CREATE TRIGGER pages_chunk_count_after_delete
35
+ AFTER DELETE ON documents
36
+ BEGIN
37
+ UPDATE pages SET chunk_count = chunk_count - 1 WHERE id = OLD.page_id;
38
+ END;
39
+
40
+ CREATE TRIGGER pages_chunk_count_after_update
41
+ AFTER UPDATE OF page_id ON documents
42
+ WHEN OLD.page_id IS NOT NEW.page_id
43
+ BEGIN
44
+ UPDATE pages SET chunk_count = chunk_count - 1 WHERE id = OLD.page_id;
45
+ UPDATE pages SET chunk_count = chunk_count + 1 WHERE id = NEW.page_id;
46
+ END;
47
+
48
+ -- @migration-step index the listing's page columns
49
+ -- Covers the listing's per-version aggregate, so it never reads page rows.
50
+ CREATE INDEX IF NOT EXISTS idx_pages_version_listing
51
+ ON pages(version_id, chunk_count, created_at);