linkbrief-mcp 0.3.0 → 0.4.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 CHANGED
@@ -6,128 +6,49 @@
6
6
  [![test](https://github.com/KDDYYY/linkbrief-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/KDDYYY/linkbrief-mcp/actions/workflows/test.yml)
7
7
  [![license](https://img.shields.io/npm/l/linkbrief-mcp)](LICENSE)
8
8
 
9
- Let Claude, Codex or any MCP agent **read any link** — web pages, PDFs, Office files and JavaScript-heavy pages — as clean Markdown, fetched **from your own computer**. About **95% fewer tokens** than raw HTML.
9
+ **Give your AI agent any link. It reads only what matters — with ~95% fewer tokens.**
10
10
 
11
- Give your agent a link and ask; linkbrief brings back just the main content with its title, source, author and date, and the agent does the rest. Works in any language, including sites most fetchers get wrong: Asian sites, Naver Blog's iframe layout, Namuwiki, and legacy encodings like Shift_JIS, GBK and EUC-KR.
11
+ linkbrief is an MCP server for Claude, Codex, Cursor and other agents. It fetches web pages, PDFs and Office files from your own computer and hands the agent clean Markdown: just the article, with title, source, author and date.
12
12
 
13
13
  ![Claude summarizing a French Wikipedia article in English with linkbrief](docs/images/usage-en.png)
14
14
 
15
- <sub>Example: the `fetch_page` call and its result are real linkbrief output; the summary was written by Claude from that result. (Source: French Wikipedia, "Kimchi", CC BY-SA.)</sub>
15
+ <sub>Real linkbrief output; the summary is Claude's. Source: French Wikipedia, "Kimchi" (CC BY-SA).</sub>
16
16
 
17
17
  ## Why linkbrief
18
18
 
19
- - **~95% fewer tokens.** Most of a page's HTML is menus, ads, scripts and image URLs. linkbrief keeps the article. ([measured](#token-savings))
20
- - **Read only the part you need.** Ask for an outline first — headings, sizes and a one-line preview — then read just the section that matters. On a long Wikipedia article that is 87% less than reading it all.
21
- - **Built for developers.** GitHub issues and PRs come with every comment and the changed files; Stack Overflow questions with their top answers; Hacker News threads in full; arXiv abstracts open the paper. Point it at a docs site and it reads the section for you (`fetch_site`).
22
- - **Documents, not just pages.** PDFs page by page, and Word, PowerPoint, Excel and Hangul (.hwpx) files from a link.
23
- - **Reads what other fetchers miss.** Pages that render with JavaScript are retried in the Chrome or Edge you already have. PDFs come back as text, page by page. Requests come from your machine, so sites that block cloud fetchers still answer.
24
- - **Any language, any encoding.** Tested on Wikipedia in six languages, plus news and docs sites in English, French, German, Japanese, Chinese, Thai and Vietnamese. Legacy charsets (Shift_JIS, EUC-JP, GBK, Big5, EUC-KR, TIS-620, windows-1258) decode correctly.
25
- - **Safe by default.** Private and local network addresses are refused, bot checks are reported rather than bypassed, and the browser runs with a fresh profile every time.
26
- - **No API key.** The agent you already use does the summarizing.
19
+ - **~95% fewer tokens.** Menus, ads, scripts and image URLs are dropped. Ask about one thing and `find` returns only the passages that mention it.
20
+ - **Reads what others miss.** JavaScript pages, PDFs, Word/PowerPoint/Excel, Stack Overflow, GitHub issues and PRs, whole docs sites (it follows `llms.txt`), and Asian sites in legacy encodings.
21
+ - **Runs on your machine.** No API key, no account, no cost. Works behind corporate proxies.
22
+ - **Safe by default.** Private networks are blocked, bot checks are never bypassed, and nothing else is ever contacted.
27
23
 
28
- ## Quick start (Claude Code)
24
+ ## Quick start
29
25
 
30
- **1. Install** — one line. `npx` fetches the package from npm, so there is nothing else to install.
26
+ Needs [Node.js](https://nodejs.org) 22.12+. For Claude Code:
31
27
 
32
28
  ```bash
33
29
  claude mcp add linkbrief -s user -- npx -y linkbrief-mcp
34
30
  ```
35
31
 
36
- On Windows (PowerShell or Command Prompt), wrap `npx` in `cmd /c` for a reliable connection:
32
+ On Windows, use `cmd /c npx` instead of `npx`:
37
33
 
38
34
  ```powershell
39
35
  claude mcp add linkbrief -s user -- cmd /c npx -y linkbrief-mcp
40
36
  ```
41
37
 
42
- **2. Check the connection** — reopen Claude Code and type `/mcp`. You should see `linkbrief` connected with two tools, `fetch_page` and `fetch_pages`. (From a terminal: `claude mcp list`.)
38
+ Reopen Claude Code, type `/mcp` to see `linkbrief` connected, then paste a link and ask. That's it.
43
39
 
44
- **3. Just ask** — no commands to learn. Paste a link and say what you want:
40
+ <details>
41
+ <summary><b>Claude Desktop, Codex, Cursor, from source</b></summary>
45
42
 
46
- > Summarize this in 5 bullet points: https://en.wikipedia.org/wiki/Large_language_model
43
+ **Claude Desktop (one click)** — download `linkbrief.mcpb` from the [latest release](https://github.com/KDDYYY/linkbrief-mcp/releases/latest) and double-click it.
47
44
 
48
- Setup for Claude Desktop (one-click), Codex and Cursor is under [Install](#install).
49
-
50
- ### How it works
51
-
52
- linkbrief is a **tool your agent uses**. The agent decides what to read and when.
53
-
54
- ```
55
- You: "Compare these two articles: <link 1> <link 2>"
56
- │
57
- ▼
58
- Agent (Claude, Codex, …) ── two links → calls fetch_pages
59
- │ page was cut off → calls fetch_page to read the rest
60
- ▼
61
- linkbrief (runs on your machine) ── fetches pages/PDFs, keeps only the main content as Markdown
62
- │
63
- ▼
64
- Agent reads it and answers
65
- ```
66
-
67
- - One link → `fetch_page`; several → `fetch_pages`. The agent picks.
68
- - When a page is long, the result ends with a note and the agent **continues reading on its own**.
69
- - The first time, your agent may ask permission to use the tool. Choose "always allow" to skip the prompt next time.
70
-
71
- ## Token savings
72
-
73
- We compared the raw HTML of real blog, news and wiki pages from several countries with what linkbrief returns (character counts, measured 2026-11-26).
74
-
75
- | | Raw HTML | linkbrief |
76
- |---|---:|---:|
77
- | Size | ~2.02M characters | ~92K characters |
78
- | **Saved** | | **~95% (92–99% per page)** |
79
-
80
- Tokens scale roughly with characters, so the token saving is about the same. Fewer tokens means **usage limits last longer, answers come faster, and long conversations keep more context.**
81
-
82
- Where the savings come from:
83
-
84
- | Method | Effect |
85
- |---|---|
86
- | **Main content only** (Mozilla Readability) | Drops menus, ads, comments, footers and scripts — most of the saving |
87
- | **No images or icons** | Image URLs alone can double a page's size |
88
- | **Link URLs removed** (default) | Keeps the link text only: 49–66% less on link-heavy pages. Keep them with `include_links` |
89
- | **Outline first, then one section** | `outline` returns the headings with sizes; `section` returns just one part. 82–91% less than the whole page on long documents (below) |
90
- | **Paging** | Up to 20,000 characters per call; the agent asks for more with `start_index` only when needed |
91
- | **Per-page cap for many links** | `fetch_pages` returns up to 8,000 characters per page by default |
92
- | **10-minute cache** | Reading the next part of a page does not download it again (the second call returns in milliseconds) |
93
-
94
- Outline first, then one section, compared with reading the whole page (characters, measured 2026-11-27):
95
-
96
- | Page | Whole page | Outline + one section | Saved |
97
- |---|---:|---:|---:|
98
- | English Wikipedia, "Large language model" | 101,576 | 8,172 + 5,021 | 87% |
99
- | Namuwiki, "김치" | 46,131 | 2,733 + 5,355 | 82% |
100
- | arXiv paper PDF (15 pages) | 39,790 | 1,638 + 1,916 | 91% |
101
-
102
- ## Install
103
-
104
- Requires Node.js 22.12 or later.
105
-
106
- **Claude Code**
107
-
108
- ```bash
109
- claude mcp add linkbrief -s user -- npx -y linkbrief-mcp
110
- ```
111
-
112
- On Windows:
113
-
114
- ```powershell
115
- claude mcp add linkbrief -s user -- cmd /c npx -y linkbrief-mcp
116
- ```
117
-
118
- **Claude Desktop, one click** — download `linkbrief.mcpb` from the [latest release](https://github.com/KDDYYY/linkbrief-mcp/releases/latest) and double-click it (or drag it into Settings → Extensions). You can add an optional GitHub token there.
119
-
120
- **Claude Desktop, by config** — add to `claude_desktop_config.json` (Settings → Developer → Edit Config):
45
+ **Claude Desktop (config)** — Settings → Developer → Edit Config:
121
46
 
122
47
  ```json
123
- {
124
- "mcpServers": {
125
- "linkbrief": { "command": "npx", "args": ["-y", "linkbrief-mcp"] }
126
- }
127
- }
48
+ { "mcpServers": { "linkbrief": { "command": "npx", "args": ["-y", "linkbrief-mcp"] } } }
128
49
  ```
129
50
 
130
- **Codex (OpenAI)** — add to `~/.codex/config.toml` (CLI, IDE extension and app):
51
+ **Codex** — `~/.codex/config.toml` (on Windows use `command = "cmd"`, `args = ["/c", "npx", "-y", "linkbrief-mcp"]`):
131
52
 
132
53
  ```toml
133
54
  [mcp_servers.linkbrief]
@@ -135,269 +56,143 @@ command = "npx"
135
56
  args = ["-y", "linkbrief-mcp"]
136
57
  ```
137
58
 
138
- If Windows cannot find `npx`, use `command = "cmd"` and `args = ["/c", "npx", "-y", "linkbrief-mcp"]`. With the Codex CLI you can also run `codex mcp add linkbrief -- npx -y linkbrief-mcp`.
139
-
140
- **Cursor and other MCP clients** — register `npx -y linkbrief-mcp` as a stdio server.
59
+ **Cursor and other MCP clients** — add `npx -y linkbrief-mcp` as a stdio server.
141
60
 
142
61
  **From source**
143
62
 
144
63
  ```bash
145
- git clone https://github.com/KDDYYY/linkbrief-mcp.git
146
- cd linkbrief-mcp
147
- npm install
64
+ git clone https://github.com/KDDYYY/linkbrief-mcp.git && cd linkbrief-mcp && npm install
148
65
  claude mcp add linkbrief -s user -- node "$(pwd)/server.mjs"
149
66
  ```
150
67
 
151
- In Windows PowerShell, use `claude mcp add linkbrief -s user -- node "$PWD\server.mjs"` for the last line.
152
-
153
- **Check** — `/mcp` in Claude Code or `claude mcp list` in a terminal should show `linkbrief` connected (`✔ Connected`). Restart your agent after changing its configuration.
154
-
155
- ## Usage
156
-
157
- Talk to your agent as usual and include the link. It calls linkbrief by itself.
158
-
159
- **Summarize**
160
-
161
- > Summarize this in 5 bullet points: https://en.wikipedia.org/wiki/Large_language_model
162
-
163
- **Read another language, answer in yours**
164
-
165
- > Summarize this Japanese news page in English: https://www3.nhk.or.jp/news/
68
+ </details>
166
69
 
167
- **PDFs** — papers, reports and press releases work with just the link. See [Reading PDFs](#reading-pdfs).
70
+ ## What you can ask
168
71
 
169
- > List the paper's three main contributions and its results: https://arxiv.org/pdf/1706.03762
72
+ No commands to learn — talk to your agent as usual and include the link.
170
73
 
171
- **Code review and debugging**
172
-
173
- > Summarize the discussion on this PR and list the changed files: https://github.com/owner/repo/pull/123
174
-
175
- > What is the accepted fix here, and why does it work? https://stackoverflow.com/questions/11227809
176
-
177
- **A whole docs section** — `fetch_site` follows links under the start page's folder (up to 30 pages, robots.txt respected).
178
-
179
- > Read the Python tutorial and give me a one-page cheat sheet: https://docs.python.org/3/tutorial/index.html
180
-
181
- **Office files** — Word, PowerPoint, Excel and Hangul (.hwpx) links work like PDFs.
182
-
183
- > Summarize this deck slide by slide: https://example.org/files/q3-review.pptx
184
-
185
- **Pick the format**
186
-
187
- > Summarize this in 3 lines, then put every number and date in a table: https://…
188
-
189
- > From this tutorial, list only the tools used and the steps: https://…
190
-
191
- **Several links at once** — up to 10 per call (`fetch_pages`). If one fails, the others still come back.
192
-
193
- > Compare how these three articles cover the story, as a table: https://… https://… https://…
194
-
195
- **Cite sources** — every result starts with site, author, date and URL, so you can ask for citations.
196
-
197
- > Summarize this and end with the source (site, author, date): https://…
198
-
199
- **Only the part you need** — the agent looks at the outline, then reads one section. You can also ask for it directly:
200
-
201
- > Show me the outline of this page first, then read only the section on training: https://en.wikipedia.org/wiki/Large_language_model
202
-
203
- **Long documents** — up to 20,000 characters per call; the agent continues with `start_index` when it needs more.
74
+ | You ask | linkbrief does |
75
+ |---|---|
76
+ | *Summarize this in 5 bullets:* `https://en.wikipedia.org/wiki/…` | Returns only the article, any language |
77
+ | *What does it say about hallucination?* `<long page>` | `find` returns just the matching passages |
78
+ | *List the paper's contributions:* `https://arxiv.org/pdf/…` | Reads the PDF page by page |
79
+ | *Summarize this PR and its changed files:* `https://github.com/…/pull/123` | Description, every comment, changed files |
80
+ | *Why does the accepted answer work?* `https://stackoverflow.com/questions/…` | Question and top answers, via the official API |
81
+ | *Make a cheat sheet from these docs:* `https://docs.python.org/3/tutorial/` | Reads the section, `llms.txt` first if the site has one |
82
+ | *Compare these three articles:* `<link> <link> <link>` | Reads up to 10 links at once |
204
83
 
205
- > Read this whole document and summarize each chapter: https://…
84
+ Every result starts with site, author, date and URL, so your agent can cite its sources — down to the section (`…#History`).
206
85
 
207
- **Keep link URLs** — off by default to save tokens. Turn them on when you need them:
86
+ ## Measured savings
208
87
 
209
- > Summarize this page and keep the reference links (include_links on): https://…
88
+ Characters sent to the agent, on real blog, news and wiki pages (November 2026):
210
89
 
211
- ### Reading PDFs
90
+ | Approach | Saved |
91
+ |---|---:|
92
+ | Whole page through linkbrief, vs. raw HTML | **~95%** (92–99% per page) |
93
+ | `find` — only the passages you ask about | a further **76–88%** on long documents |
94
+ | `outline`, then one `section` | a further **82–91%** on long documents |
212
95
 
213
- **1. Get the PDF's address.** Right-click the PDF link or download button → **Copy link address**, or, if the PDF is open in your browser, copy the **address bar**.
96
+ Fewer tokens mean your usage limits last longer, answers come faster, and long chats keep more context.
214
97
 
215
- ![How to copy a PDF link and paste it to Claude](docs/images/pdf-link-en.png)
98
+ ## PDFs and documents
216
99
 
217
- **2. Ask your agent with the address.** linkbrief downloads the PDF and extracts its text page by page.
100
+ Paste the link to a PDF, `.docx`, `.pptx`, `.xlsx` or `.hwpx` — right-click a download link → *Copy link address*. For files on your computer, attach them to your agent directly.
218
101
 
219
102
  ![Reading an arXiv paper PDF with linkbrief and summarizing it in four lines](docs/images/pdf-demo-en.gif)
220
103
 
221
- <sub>Example: the `fetch_page` result is real linkbrief output (cut before the lines with the authors' e-mail addresses); the summary was written by Claude from it.</sub>
104
+ ## Works with
222
105
 
223
- | Situation | What happens |
106
+ | | |
224
107
  |---|---|
225
- | The address does not end in `.pdf` (`download?id=…`) | Read as a PDF if the server sends one |
226
- | Page markers such as `## Page 3` | Ask "which page says…?" or "summarize page 3 only" |
227
- | Long PDFs | Read 20,000 characters at a time; ask to "read to the end" and the agent continues |
228
- | The `PDF, 15 pages` line at the top | Page count plus the title, author and date stored in the PDF |
229
- | **A PDF file on your computer** | linkbrief reads web addresses only. Attach the file to your agent directly |
230
- | PDFs that need a login or a button click to download | Cannot be fetched from the address alone. Download it and attach it |
231
- | Scanned PDFs (images of text) | No text to extract (`PDF has no extractable text`); OCR is not supported |
232
- | PDFs over 30 MB | Not read |
108
+ | ✅ Web pages | Any language; JavaScript pages via your installed Chrome/Edge; Shift_JIS, GBK, Big5, EUC-KR and more |
109
+ | ✅ Developer sites | GitHub issues, PRs and code files · Stack Overflow & Stack Exchange · Hacker News · arXiv · docs sites with `llms.txt` |
110
+ | ✅ Documents | PDF, Word, PowerPoint, Excel, Hangul (.hwpx) |
111
+ | ✅ Korean sites | Naver Blog, Naver/Daum News, Namuwiki, Tistory, Brunch, Velog |
112
+ | ❌ Not supported | Pages behind a login or a bot check (Medium, Reddit), Google Search result pages, YouTube transcripts, scanned PDFs |
233
113
 
234
- ### JavaScript-heavy pages
114
+ ## Safe by default
235
115
 
236
- When a plain request comes back empty or blocked (HTTP 403, 429 or 503), linkbrief **retries in the Chrome or Edge already installed on your machine**, headless. No setup needed.
116
+ - **Your network stays private.** `localhost`, home/office networks and cloud metadata addresses are refused — checked again on every redirect — so a malicious page can't make your agent read your router or intranet.
117
+ - **No bypassing.** Bot checks are reported, not solved. `fetch_site` honours robots.txt and pauses between requests.
118
+ - **Nothing extra.** linkbrief only contacts the links you give it (and GitHub's or Stack Exchange's public API for those sites). No telemetry, no keys, no accounts.
119
+ - **Isolated browser.** The JavaScript fallback uses a fresh profile every time — your logins and cookies are never touched.
237
120
 
238
- - No browser download: it uses your installed Chrome or Edge (through the optional `puppeteer-core` package).
239
- - A **fresh profile** every time, so your logins and cookies are never used.
240
- - Every request the page makes goes through the same private-address check.
241
- - Turn it off with `LINKBRIEF_BROWSER=off`, or point at another browser with `LINKBRIEF_BROWSER=<path to executable>`.
242
- - **Bot checks such as Cloudflare are reported, never bypassed.**
121
+ <details>
122
+ <summary><b>Tools reference</b></summary>
243
123
 
244
- ### Troubleshooting
124
+ **`fetch_page`** — one page or document
245
125
 
246
- | Message or symptom | What to do |
247
- |---|---|
248
- | The agent says it cannot open links instead of using the tool | Restart the agent and check `claude mcp list` shows `✔ Connected`. You can also say "read it with linkbrief" |
249
- | `Page text too short` | The page needs a login, or it renders with JavaScript and no Chrome/Edge was found |
250
- | `This site shows a bot check` | The site requires a bot check (e.g. Medium, Reddit). linkbrief does not bypass it |
251
- | `GitHub API: API rate limit exceeded` | Set a `GITHUB_TOKEN` environment variable (or the token field in the Claude Desktop extension) |
252
- | `robots.txt on … asks automated tools not to read …` | The site opted out of automated reading (`fetch_site`, or `LINKBRIEF_ROBOTS=always`) |
253
- | `Old binary .hwp files are not supported` | Save the file as .hwpx or PDF, or attach it to your agent |
254
- | `Refusing to fetch a private or local address` | `localhost` and private network addresses are blocked for safety |
255
- | `PDF has no extractable text` | A scanned PDF; OCR is not supported |
256
- | `This Naver Cafe post can only be read after logging in` | The post is for members or logged-in users only. Paste its text instead |
257
- | `For Naver Cafe, pass the post's full URL` | Use the post's "copy URL" address containing `clubid` and `articleid` |
258
- | `Could not reach …` / timeouts | The site is slow or unreachable. Try again later (linkbrief retries once automatically) |
259
- | `Google search result pages block automated access` | Use your agent's own web search, or pass a result page's address |
260
- | `npx` errors or an `EBADENGINE` warning on install | Check `node --version` is 22.12 or later |
261
-
262
- ## Tools
263
-
264
- ### `fetch_page` — read one page
265
-
266
- | Argument | Default | Description |
126
+ | Argument | Default | |
267
127
  |---|---|---|
268
- | `url` | (required) | http/https address of a web page or PDF |
269
- | `max_length` | 20000 | Maximum characters returned per call (1,000–100,000) |
270
- | `start_index` | 0 | Where to continue a long page; a cut-off result tells you the next value |
271
- | `include_links` | false | Keep link URLs. By default only the link text is kept |
272
- | `render` | false | Use the browser from the start. Rarely needed: empty or blocked pages fall back automatically |
273
- | `outline` | false | Return only the headings, with each section's size and first line |
274
- | `section` | — | Return one section and its subsections: an outline number (`"#3"`) or heading text (`"History"`, `"Page 4"`) |
128
+ | `url` | required | Web page, PDF or Office file |
129
+ | `find` | — | Only passages mentioning these words or `"quoted phrases"` |
130
+ | `outline` | false | Only the headings, with section sizes and anchors |
131
+ | `section` | — | One section: `"#3"` or heading text (`"History"`, `"Page 4"`) |
132
+ | `max_length` / `start_index` | 20000 / 0 | Paging for long text; the reply says how to continue |
133
+ | `include_links` | false | Keep link URLs (off saves tokens) |
134
+ | `render` | false | Use the browser first (normally automatic) |
275
135
 
276
- ### `fetch_site` — read a docs site or section
136
+ **`fetch_pages`** — up to 10 `urls`, `max_length_per_page` (8000), `include_links`.
277
137
 
278
- | Argument | Default | Description |
279
- |---|---|---|
280
- | `url` | (required) | Start page; only links under its folder are followed (`https://docs.example.com/guide/…`) |
281
- | `max_pages` | 10 | Maximum pages to read (1–30) |
282
- | `max_length_per_page` | 4000 | Maximum characters per page (500–20,000) |
283
- | `include_links` | false | Keep link URLs |
138
+ **`fetch_site`** — `url` (start page; only links under its folder are followed), `max_pages` (10, up to 30), `max_length_per_page` (4000), `include_links`. Reads `/llms.txt` first when the site has one, honours robots.txt, and stops after 45 seconds with what it has.
284
139
 
285
- Pages are read breadth-first with a pause between requests, and robots.txt is always honoured.
140
+ </details>
286
141
 
287
- ### `fetch_pages` — read several pages
142
+ <details>
143
+ <summary><b>Settings</b> (optional environment variables)</summary>
288
144
 
289
- | Argument | Default | Description |
290
- |---|---|---|
291
- | `urls` | (required) | 1–10 addresses |
292
- | `max_length_per_page` | 8000 | Maximum characters per page (1,000–50,000) |
293
- | `include_links` | false | Keep link URLs |
294
-
295
- An outline looks like this:
296
-
297
- ```
298
- # Large language model
299
- Source: Wikimedia Foundation, Inc. | … | URL: https://en.wikipedia.org/wiki/Large_language_model
300
-
301
- Outline: 62 sections, 101,576 characters in total. Read one with section="#N" or its heading text.
302
-
303
- - #1 History (4,837 chars): The training compute of notable large models …
304
- - #2 Dataset preprocessing (2,983 chars)
305
- - #3 Tokenization (2,085 chars): As machine learning algorithms process numbers rather than text, …
306
- ```
145
+ | Variable | Effect |
146
+ |---|---|
147
+ | `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY` | Corporate proxy, also for the browser fallback |
148
+ | `GITHUB_TOKEN` | GitHub API limit from 60 to 5,000 requests/hour |
149
+ | `LINKBRIEF_ROBOTS=always` | Honour robots.txt for single links too |
150
+ | `LINKBRIEF_BROWSER=off` or `=<path>` | Disable the browser fallback, or pick a browser |
307
151
 
308
- Every full result has this shape:
152
+ </details>
309
153
 
310
- ```
311
- # Title
312
- Source: Site | Author: Name | Published: 2026-11-25 | URL: https://…
154
+ <details>
155
+ <summary><b>Troubleshooting</b></summary>
313
156
 
314
- Main content as Markdown
315
- ```
157
+ | Message | What to do |
158
+ |---|---|
159
+ | Agent says it can't open links | Restart the agent; `/mcp` should show `linkbrief` connected. Or say "read it with linkbrief" |
160
+ | `Page text too short` | The page needs a login, or it needs JavaScript and no Chrome/Edge was found |
161
+ | `This site shows a bot check` | The site blocks automated reading; linkbrief won't bypass it |
162
+ | `GitHub API: API rate limit exceeded` | Set `GITHUB_TOKEN` |
163
+ | `Refusing to fetch a private or local address` | Blocked for safety: `localhost` and private networks |
164
+ | `PDF has no extractable text` | Scanned PDF; OCR isn't supported |
165
+ | `Old binary .hwp files are not supported` | Save as .hwpx or PDF |
166
+ | `npx` errors / `EBADENGINE` | Check `node --version` is 22.12 or later |
316
167
 
317
- ## Supported sites
168
+ </details>
318
169
 
319
- | Target | Status |
320
- |---|---|
321
- | Wikipedia (any language), MDN, Python docs, Google Blog, GitHub repositories | ✅ |
322
- | GitHub issues and PRs (all comments, changed files), GitHub code files (raw) | ✅ via the GitHub API (60 requests/hour, more with `GITHUB_TOKEN`) |
323
- | Stack Overflow, Super User, Server Fault, Ask Ubuntu, *.stackexchange.com questions | ✅ via the Stack Exchange API (question + top 10 answers) |
324
- | Hacker News threads, arXiv (abstract page → paper) | ✅ |
325
- | News: BBC, The Verge, Le Monde, Der Spiegel, NHK, People's Daily, Thairath, VnExpress, … | ✅ |
326
- | Korean sites: Naver Blog, Naver News, Daum News, Namuwiki, Tistory, Brunch, Velog, Daum Cafe (public posts) | ✅ |
327
- | PDFs (checked in English and Korean, split by page) | ✅ |
328
- | Word (.docx), PowerPoint (.pptx), Excel (.xlsx, first 200 rows per sheet), Hangul (.hwpx) | ✅ (Excel dates appear as serial numbers) |
329
- | Old binary Hangul (.hwp) | ❌ save as .hwpx or PDF |
330
- | JavaScript-rendered pages | ✅ automatic when Chrome or Edge is installed |
331
- | Shift_JIS, EUC-JP, GBK/GB2312, Big5, EUC-KR, TIS-620, windows-1258 | ✅ |
332
- | Naver Cafe | ⚠️ public posts only; login/member-only posts are reported, never read with your account |
333
- | Sites behind bot checks: Medium, Reddit, … (Stack Overflow pages other than questions) | ❌ not bypassed |
334
- | Google Search result pages | ❌ Google blocks automated access; use your agent's web search |
335
- | YouTube transcripts, pages behind a login, scanned PDFs, images, video | ❌ |
336
-
337
- Live check against real sites (`npm run check:live`, 2026-11-27). Medium and Reddit (bot checks) and Google Search are refused on purpose:
338
-
339
- ![Live check results for 36 sites](docs/images/live.png)
340
-
341
- ## Settings
342
-
343
- All optional, as environment variables (in Claude Desktop/Codex config under `env`):
170
+ <details>
171
+ <summary><b>Live check against 38 real sites</b></summary>
344
172
 
345
- | Variable | Effect |
346
- |---|---|
347
- | `GITHUB_TOKEN` | Raises GitHub API limits from 60 to 5,000 requests/hour for issues and PRs |
348
- | `LINKBRIEF_ROBOTS=always` | Also honour robots.txt for single links (`fetch_site` always does) |
349
- | `LINKBRIEF_BROWSER=off` / `=<path>` | Disable the browser fallback, or use a specific Chrome/Edge |
173
+ `npm run check:live` (2026-11-27). Medium, Reddit and Google Search are refused on purpose.
350
174
 
351
- ## Security
175
+ ![Live check results for 38 sites](docs/images/live.png)
352
176
 
353
- - **Private networks blocked:** `localhost`, private IPs (10.x, 192.168.x, …), link-local and cloud metadata addresses (169.254.169.254) are refused. Every redirect and every request the browser makes is checked again. This keeps a prompt-injected page from making your agent read your router or internal network.
354
- - **Size limits:** web pages up to 5 MB, PDFs and Office files up to 30 MB (and 60 MB unpacked); other file types are refused.
355
- - **Polite crawling:** `fetch_site` stays inside one folder of one site, honours robots.txt and pauses between requests. Single links you ask for are fetched like a browser would.
356
- - **Browser isolation:** the headless browser opens with a fresh profile and is closed after each page.
357
- - Fetched content is labeled for the agent as data, not instructions.
177
+ </details>
358
178
 
359
- ## Development
179
+ <details>
180
+ <summary><b>Development and contributing</b></summary>
360
181
 
361
182
  ```bash
362
183
  npm install
363
- npm test # unit tests, local-server end-to-end tests and fuzzing (no network)
364
- npm run check:live # check real sites (needs internet)
365
- npm run check:live -- <URL> # check specific addresses
366
- node page.mjs <URL> # print the extraction for one page
367
- node page.mjs <URL> --render # same, through the browser
184
+ npm test # unit, local-server, proxy and fuzz tests (offline)
185
+ npm run check:live # real sites
186
+ node page.mjs <URL> # see what linkbrief extracts from one page
368
187
  ```
369
188
 
370
- | File | Role |
371
- |---|---|
372
- | `server.mjs` | stdio entry point |
373
- | `tools.mjs` | MCP tools: `fetch_page`, `fetch_pages`, `fetch_site` |
374
- | `page.mjs` | Fetching, safety checks, encodings, extraction (Readability → Markdown), PDFs, cache |
375
- | `browser.mjs` | Reading JavaScript pages with the installed Chrome or Edge (optional) |
376
- | `office.mjs` | Word, PowerPoint, Excel and Hangul (.hwpx) files |
377
- | `robots.mjs` | robots.txt parsing |
378
- | `manifest.json`, `server.json` | Claude Desktop extension and MCP Registry metadata (`npm run build:mcpb` builds `dist/linkbrief.mcpb`) |
379
- | `sites.mjs` | Per-site rules |
380
- | `test.mjs`, `test-http.mjs`, `test-fuzz.mjs` | Unit tests; the full fetch path and MCP tools against a local HTTP server; seeded random-input checks |
381
- | `fixtures/` | Test HTML written for this project (it mimics site structure; no real articles) |
382
-
383
- ### Adding a site
384
-
385
- Add a rule to the `sites` array in `sites.mjs` and a test to `test.mjs`:
386
-
387
- ```js
388
- {
389
- name: "example",
390
- match: (u) => u.hostname === "example.com",
391
- rewrite: (u) => u.href.replace("/view/", "/print/"), // use the address that holds the article
392
- // pick: (document) => document.querySelector("#article"), // or point at the article element
393
- // load: async (u, getJson) => ({ markdown, title }), // or read it through the site's public API
394
- // refuse: "This site cannot be fetched because …", // or explain why it cannot be read
395
- }
396
- ```
189
+ Code: `tools.mjs` (MCP tools), `page.mjs` (fetching, safety, extraction, PDFs), `sites.mjs` (per-site rules), `office.mjs`, `browser.mjs`, `robots.mjs`.
190
+
191
+ To support a new site, add a rule to `sites.mjs` (`rewrite`, `pick`, `load` or `refuse`) with a test in `test.mjs`. Test HTML in `fixtures/` must be written by you, not copied from a real article.
397
192
 
398
- If a test needs HTML, write your own that mimics the site's structure instead of copying a real article into `fixtures/`.
193
+ "This site doesn't work" issues with the URL are especially welcome.
399
194
 
400
- Issues and pull requests are welcome — especially "this site doesn't work" reports with the URL.
195
+ </details>
401
196
 
402
197
  ## License
403
198
 
package/browser.mjs CHANGED
@@ -47,7 +47,13 @@ async function renderNow(url, checkUrl) {
47
47
  throw new Error("JavaScript rendering needs the optional puppeteer-core package (npm install puppeteer-core).");
48
48
  }
49
49
  const userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), "linkbrief-")); // fresh profile: no cookies or logins
50
- const browser = await puppeteer.launch({ executablePath, headless: true, userDataDir, args: ["--no-first-run", "--no-default-browser-check", "--lang=ko-KR"] });
50
+ const args = ["--no-first-run", "--no-default-browser-check", "--lang=ko-KR"];
51
+ // Same proxy as plain requests (see page.mjs); Chrome takes NO_PROXY as a semicolon list.
52
+ const proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy;
53
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy;
54
+ if (proxy) args.push(`--proxy-server=${proxy}`);
55
+ if (proxy && noProxy) args.push(`--proxy-bypass-list=${noProxy.split(",").map((s) => s.trim()).filter(Boolean).join(";")}`);
56
+ const browser = await puppeteer.launch({ executablePath, headless: true, userDataDir, args });
51
57
  try {
52
58
  const page = await browser.newPage();
53
59
  await page.setRequestInterception(true);
package/office.mjs CHANGED
@@ -22,7 +22,7 @@ export function officeKind(type, url) {
22
22
  }
23
23
 
24
24
  const MAX_UNPACKED = 60 * 1024 * 1024;
25
- const WANTED = /^(word\/document\.xml|ppt\/slides\/slide\d+\.xml|xl\/(workbook\.xml|sharedStrings\.xml|worksheets\/sheet\d+\.xml|_rels\/workbook\.xml\.rels)|docProps\/core\.xml|Contents\/section\d+\.xml)$/;
25
+ const WANTED = /^(word\/document\.xml|ppt\/slides\/slide\d+\.xml|xl\/(workbook\.xml|sharedStrings\.xml|styles\.xml|worksheets\/sheet\d+\.xml|_rels\/workbook\.xml\.rels)|docProps\/core\.xml|Contents\/section\d+\.xml)$/;
26
26
 
27
27
  // Unpacks only the XML parts we read, refusing archives that declare more than MAX_UNPACKED.
28
28
  // shortcut: trusts the sizes declared in the ZIP headers; switch to streaming inflate with a running cap if hostile files become a concern.
@@ -81,7 +81,35 @@ function pptx(files) {
81
81
 
82
82
  const MAX_ROWS = 200;
83
83
  const MAX_COLS = 50;
84
+
85
+ // Excel stores dates as day counts; a cell whose number format is a date or time is shown as ISO text.
86
+ // Built-in format ids for dates/times (including the CJK locale ones 27-36 and 50-58).
87
+ const BUILTIN_DATE = new Set([14, 15, 16, 17, 22, 27, 28, 29, 30, 31, 34, 35, 36, 50, 51, 52, 53, 54, 57, 58]);
88
+ const BUILTIN_TIME = new Set([18, 19, 20, 21, 32, 33, 45, 46, 47, 55, 56]);
89
+ // Per cell style index (the "s" attribute): "date", "datetime", "time" or undefined.
90
+ function dateStyles(stylesXml) {
91
+ const custom = Object.fromEntries([...stylesXml.matchAll(/<numFmt [^>]*numFmtId="(\d+)"[^>]*formatCode="([^"]*)"/g)].map(([, id, code]) => [id, unxml(code)]));
92
+ const xfs = /<cellXfs[^>]*>([\s\S]*?)<\/cellXfs>/.exec(stylesXml)?.[1] || "";
93
+ return [...xfs.matchAll(/<xf [^>]*?numFmtId="(\d+)"/g)].map(([, id]) => {
94
+ if (BUILTIN_DATE.has(Number(id))) return Number(id) === 22 ? "datetime" : "date";
95
+ if (BUILTIN_TIME.has(Number(id))) return "time";
96
+ const code = (custom[id] || "").replace(/"[^"]*"|\[[^\]]*\]|\\./g, ""); // drop literals, colours, locales
97
+ if (/[dy]/i.test(code)) return /h/i.test(code) ? "datetime" : "date";
98
+ if (/h/i.test(code)) return "time";
99
+ return undefined;
100
+ });
101
+ }
102
+ // shortcut: ignores Excel's 1900 leap-year bug, so serials before 1900-03-01 are one day off; such dates are rare in practice.
103
+ function excelDate(value, kind, date1904) {
104
+ const n = Number(value);
105
+ if (!Number.isFinite(n)) return value;
106
+ const iso = new Date(Date.UTC(1899, 11, 30) + Math.round((n + (date1904 ? 1462 : 0)) * 86400000)).toISOString();
107
+ return kind === "time" ? iso.slice(11, 16) : kind === "datetime" ? `${iso.slice(0, 10)} ${iso.slice(11, 16)}` : iso.slice(0, 10);
108
+ }
109
+
84
110
  function xlsx(files) {
111
+ const styles = dateStyles(files["xl/styles.xml"] || "");
112
+ const date1904 = /date1904="(1|true)"/.test(files["xl/workbook.xml"] || "");
85
113
  const shared = [...(files["xl/sharedStrings.xml"] || "").matchAll(/<si>([\s\S]*?)<\/si>/g)].map(([, si]) => texts(si, "t"));
86
114
  const rels = Object.fromEntries([...(files["xl/_rels/workbook.xml.rels"] || "").matchAll(/<Relationship [^>]*Id="([^"]+)"[^>]*Target="([^"]+)"/g)].map(([, id, t]) => [id, `xl/${t.replace(/^\/?xl\//, "")}`]));
87
115
  const sheets = [...(files["xl/workbook.xml"] || "").matchAll(/<sheet [^>]*name="([^"]+)"[^>]*r:id="([^"]+)"/g)].map(([, name, id]) => ({ name: unxml(name), file: rels[id] }));
@@ -93,7 +121,10 @@ function xlsx(files) {
93
121
  const ref = /r="([A-Z]+)\d+"/.exec(attrs)?.[1];
94
122
  const kind = /t="(\w+)"/.exec(attrs)?.[1];
95
123
  const v = /<v>([^<]*)<\/v>/.exec(inner || "")?.[1];
96
- values[ref ? col(ref) : values.length] = kind === "s" ? shared[Number(v)] ?? "" : kind === "inlineStr" ? texts(inner || "", "t") : unxml(v ?? "");
124
+ const dateKind = !kind || kind === "n" ? styles[Number(/\bs="(\d+)"/.exec(attrs)?.[1])] : undefined;
125
+ values[ref ? col(ref) : values.length] = kind === "s" ? shared[Number(v)] ?? ""
126
+ : kind === "inlineStr" ? texts(inner || "", "t")
127
+ : dateKind && v != null ? excelDate(v, dateKind, date1904) : unxml(v ?? "");
97
128
  }
98
129
  return Array.from(values.slice(0, MAX_COLS), (x) => x ?? "");
99
130
  }).filter((r) => r.some(Boolean));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "linkbrief-mcp",
3
3
  "mcpName": "io.github.KDDYYY/linkbrief-mcp",
4
- "version": "0.3.0",
4
+ "version": "0.4.1",
5
5
  "description": "MCP server that lets Claude, Codex and other agents read any link — web pages, PDFs, JavaScript pages — as clean Markdown from your own computer, with ~95% fewer tokens than raw HTML. Handles any language and legacy encodings.",
6
6
  "type": "module",
7
7
  "bin": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "start": "node server.mjs",
24
- "test": "node test.mjs && node test-http.mjs && node test-fuzz.mjs",
24
+ "test": "node test.mjs && node test-http.mjs && node test-proxy.mjs && node test-fuzz.mjs",
25
25
  "check:live": "node scripts/live-check.mjs",
26
26
  "build:mcpb": "node scripts/build-mcpb.mjs"
27
27
  },
@@ -58,6 +58,7 @@
58
58
  "fflate": "^0.8.3",
59
59
  "linkedom": "^0.18.15",
60
60
  "turndown": "^7.2.5",
61
+ "undici": "^7.30.2",
61
62
  "unpdf": "1.9.1",
62
63
  "zod": "^4.6.7"
63
64
  },