@gresmcp/mcp 1.0.0 → 1.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 CHANGED
@@ -15,7 +15,7 @@ Knowledge is stored in PostgreSQL using `pgvector` (semantic similarity) and `ts
15
15
  - PostgreSQL with the [`pgvector`](https://github.com/pgvector/pgvector) extension installed (default `gres` database and `gres` user `gres` password used in the examples bellow)
16
16
  - An [Ollama](https://ollama.com) server with an embedding model pulled (e.g. `ollama pull nomic-embed-text` or `ollama pull bge-m3`)
17
17
 
18
- Run `gresmcp check` to verify all of these at once (it also creates the `vector` extension for you if it is missing).
18
+ Run `gresmcp check --model <model>` to verify all of these at once (it also creates the `vector` extension for you if it is missing).
19
19
 
20
20
  ## Install
21
21
 
@@ -41,18 +41,27 @@ Environment variables:
41
41
  # 0. Verify your setup (Node, Postgres, pgvector, schema, Ollama, embedding model)
42
42
  gresmcp check --model nomic-embed-text
43
43
 
44
- # 1. Create a knowledge source (probes Ollama to validate the model and detect its dimension)
44
+ # 1. Create a knowledge source named `docs` (probes Ollama to validate the model and detect its dimension)
45
45
  gresmcp ks create docs --model nomic-embed-text --description "Project documentation"
46
46
 
47
- # 2. Feed it
47
+ # 2. Feed it the `docs` knowledge source
48
48
  gresmcp feed docs --path ./docs # a folder (text, markdown, code, html)
49
- gresmcp feed docs --path ./README.md # a single file
49
+ gresmcp feed docs --path ./README.md # a single file (text, markdown, code, html)
50
50
  gresmcp feed docs --text "Note: the API key lives in vault" --title "API keys" --tags secrets
51
+ gresmcp feed docs --url https://example.com/docs/ --max-pages 200 --depth 3 # scrape a website
52
+ gresmcp feed docs --url https://example.com/ --sitemap sitemap-only # ingest exactly the sitemap.xml / robots.txt URLs
53
+ gresmcp feed docs --url https://example.com/ --sitemap 'nav.docs a' # only follow links inside <nav class="docs">
54
+ gresmcp feed docs --url https://example.com/ --url-filter '**/docs/**' --url-filter '**/*.md' # only follow matching links
55
+ gresmcp feed docs --url https://example.com/blog/ --html-filter 'article.post -> .entry-content' # only ingest matching HTML regions
51
56
 
52
57
  # 3. Serve it to your AI tool over MCP
53
58
  mcp docs # stdio transport, scoped to the 'docs' knowledge source
54
59
  mcp --all # every knowledge source in the database
55
60
  mcp docs,wiki --transport http --port 8080 # HTTP streaming on http://localhost:8080/mcp
61
+
62
+ # 4. Find help about all the commands
63
+ gresmcp --help
64
+ mcp --help
56
65
  ```
57
66
 
58
67
  The database schema is created automatically on first run (`CREATE EXTENSION vector`, `ks` table, one entry table per knowledge source).
@@ -71,23 +80,33 @@ Edits a knowledge source. The Ollama server URL, name and description can change
71
80
 
72
81
  Lists knowledge sources with model, dimension, URL and entry counts.
73
82
 
83
+ ### `gresmcp ks stats <name> [--json]`
84
+
85
+ Shows the statistics of a knowledge source: entry chunk count, distinct sources, total content volume with average/min/max chunk length, when it was last fed, plus the ks metadata (model, dimension, Ollama URL).
86
+
74
87
  ### `gresmcp ks delete <name> [--yes]`
75
88
 
76
89
  Deletes a knowledge source and drops its entry table (asks for confirmation unless `--yes`).
77
90
 
78
- ### `gresmcp feed <ks> (--path <path> | --text <text> | --stdin) [options]`
91
+ ### `gresmcp feed <ks> (--path <path> | --url <url> | --text <text> | --stdin) [options]`
79
92
 
80
- Feeds data into a knowledge source. Exactly one input of `--path`, `--text` or `--stdin` must be given.
93
+ Feeds data into a knowledge source. Exactly one input of `--path`, `--url`, `--text` or `--stdin` must be given.
81
94
 
82
95
  | Option | Description |
83
96
  | --- | --- |
84
97
  | `--path <path>` | File or folder. Folders are walked recursively (skips `node_modules`, `.git`, `dist`, ...). Supported: text, markdown, code files, HTML (converted to Markdown via turndown). Binaries and empty files are skipped with a warning. |
98
+ | `--url <url>` | Scrape a website (http/https). Follows same-host links from the seed, converts HTML to Markdown (main-content extraction via Readability) and ingests linked `text/markdown` / `text/plain` resources. Each page becomes a source keyed by its URL, so re-feeding is idempotent. Only 2XX responses are ingested; failures are reported as skipped. |
99
+ | `--crawler <name>` | Crawler backend for `--url`: `auto` (default), `crawlee` (static HTTP), `playwright` or `puppeteer` (full browser rendering for SPAs; must be installed globally, e.g. `npm i -g playwright && npx playwright install chromium`). With `auto`, pages that look like empty JS shells are retried with Playwright when available. |
100
+ | `--sitemap <mode>` | Link discovery for `--url`: `auto` (default) uses the site's `sitemap.xml` (then `robots.txt` sitemaps, incl. nested index files) when available and crawls exactly those URLs, falling back to HTML link crawling when no sitemap exists; `sitemap-only` does the same but ingests nothing (with a warning) when no sitemap is found; `html-only` always follows links; any other value is treated as a **CSS selector** — links are only followed inside matching elements on each page (e.g. `nav.docs a`), with a warning if the selector matches no links anywhere. Sitemap mode respects `--max-pages` and `--url-filter` (`--depth` is not applicable — sitemap URLs have no hierarchy). |
101
+ | `--max-pages <n>` | Max pages to fetch when crawling (default 999) |
102
+ | `--depth <n>` | Max link depth from the seed URL (default 5; 0 = seed page only) |
103
+ | `--url-filter <glob>` | Only follow `--url` links whose URL matches the glob. Repeatable — a link is followed if it matches **any** glob. Matched against the full URL, case-insensitive; `*` doesn't cross `/`, `**` does. The seed URL itself is always fetched and ingested; non-matching links are never fetched and don't count towards `--max-pages`. Example: `--url-filter '**/docs/**'` |
104
+ | `--html-filter <selector>` | Limit HTML content extraction to a CSS selector — any selector supported by the DOM works (e.g. `'#article > .content'`, `'article.post'`, `'#article .content:first-child'`). Use ` -> ` to chain several selectors and scope step by step: `'#article -> .content'` takes the first `#article`, then all `.content` inside it. Applies to `--path` HTML files and `--url` pages. Intermediate steps take the first match; the final step keeps **all** matching elements (joined in document order). When set, the automatic Readability main-content extraction is bypassed for pages. Noise elements (`script`, `nav`, `aside`, `footer`, ...) are removed before matching, so child pseudo-classes like `:first-child` see the cleaned DOM. Files/pages where the selector matches nothing are skipped (`html filter '<selector>' matched nothing`). |
85
105
  | `--text <text>` / `--stdin` | Manual entry text (chunked the same way as documents) |
86
106
  | `--title <title>` | Title for manual entries |
87
107
  | `--source-name <name>` | Source name for manual entries (default `manual`) |
88
- | `--tags a,b` | Tags stored in metadata, filterable by MCP `search` |
108
+ | `--tags a,b` | Tags stored in metadata, filterable by MCP `search`; for `--url`, merged with each page's HTML `keywords`/`og:article:tag` |
89
109
  | `--metadata k=v ...` | Repeatable custom metadata entries |
90
- | `--url <url>` | Ollama URL override for this run (the model stays the ks's) |
91
110
  | `--replace` | Replace all chunks of the same source instead of skipping unchanged ones |
92
111
  | `--dry-run` | Parse and chunk only; no embeddings, no writes |
93
112
  | `--chunk-size <n>` | Max chunk length in characters (default 1200) |
@@ -95,11 +114,15 @@ Feeds data into a knowledge source. Exactly one input of `--path`, `--text` or `
95
114
 
96
115
  Feeding is idempotent: a chunk whose `(source, chunk_index, content hash)` already exists is skipped, so re-running a feed only adds new content. Use `--replace` to force a clean re-ingest of a source.
97
116
 
117
+ While feeding, live progress is shown on stderr: a bar for the currently processed file (chunks processed, chars) plus a total line with files processed/total, cumulative chars and the number of rejected/ignored files — rejected files are reported but excluded from the progress percentage. In a non-interactive terminal (or when piped), plain per-file lines are printed instead. After a successful non-dry-run feed, a `this run` summary prints the same statistics as `gresmcp ks stats` (chunks, distinct sources, chars, avg/min/max per chunk), scoped to the chunks written during that run.
118
+
119
+ For `--url`, page titles come from `<title>`/`og:title`/`<h1>` and each page's metadata records `source_url`, `crawled_at`, the meta `description` (if present) and tags. Crawling stays on the seed's hostname; non-HTTP links and obvious binary URLs are skipped. With `--url-filter`, only same-host links matching at least one glob are followed (the seed itself is exempt). Requests are made without consulting robots.txt, and CWD is never polluted (crawlee state goes to a temp directory).
120
+
98
121
  ### `gresmcp init`
99
122
 
100
123
  Explicitly initializes/repairs the schema (runs automatically for every command anyway).
101
124
 
102
- ### `gresmcp check [--model <model>] [--url <url>] [--probe] [--json]`
125
+ ### `gresmcp check --model <model> [--url <url>] [--probe] [--json]`
103
126
 
104
127
  Verifies that your environment meets all requirements:
105
128
 
@@ -110,7 +133,7 @@ Verifies that your environment meets all requirements:
110
133
  | pgvector | Extension installed (created automatically if missing); warns below 0.5.0, which is required for HNSW indexes |
111
134
  | schema | `ks` table and every knowledge source's entry table exist (`gresmcp init` repairs them) |
112
135
  | Ollama | Server reachable at the configured URL |
113
- | models | The embedding model of every existing knowledge source (plus `--model`, if given) is pulled at the right URL; `--probe` also embeds a test string to verify the dimension |
136
+ | models | The embedding model given via `--model` plus the embedding model of every existing knowledge source is pulled at the right URL; `--probe` also embeds a test string to verify the dimension |
114
137
 
115
138
  ```sh
116
139
  gresmcp check --model nomic-embed-text
@@ -145,6 +168,8 @@ Hybrid mode fuses pgvector cosine ranking and `ts_rank_cd` full-text ranking wit
145
168
 
146
169
  ## Using with AI tools
147
170
 
171
+ Please always mention in AGENTS.md which resources are included in the `gresmcp` knowledge base, so the agent aware what to look for and where.
172
+
148
173
  ### opencode
149
174
 
150
175
  ```json
@@ -216,4 +241,5 @@ gresmcp is built on top of these great projects and tools:
216
241
  | [Ollama](https://ollama.com) | The easiest way to automate your work using open models, while keeping your data safe |
217
242
  | [Nano](https://nano.org) | The fast, feeless and eco-friendly digital currency |
218
243
  | [NanoGPT](https://nano-gpt.com) | Subscription-free, pay-as-you-go access to AI models |
244
+ | [Crawlee](https://crawlee.dev/) | Crawlee helps you build and maintain your crawlers. It's open source, but built by developers who scrape millions of pages every day for a living. |
219
245
  | {{ YOU }} | This could be you — issues and PRs welcome at [gitea.com/fairking/gresmcp](https://gitea.com/fairking/gresmcp) |