@j0hanz/superfetch 1.0.2 → 1.0.3

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.
Files changed (134) hide show
  1. package/README.md +590 -327
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/config/index.js +6 -10
  4. package/dist/config/index.js.map +1 -1
  5. package/dist/config/types.d.ts +251 -0
  6. package/dist/config/types.d.ts.map +1 -0
  7. package/dist/config/types.js +2 -0
  8. package/dist/config/types.js.map +1 -0
  9. package/dist/errors/app-error.d.ts +2 -20
  10. package/dist/errors/app-error.d.ts.map +1 -1
  11. package/dist/errors/app-error.js +0 -18
  12. package/dist/errors/app-error.js.map +1 -1
  13. package/dist/index.js +13 -47
  14. package/dist/index.js.map +1 -1
  15. package/dist/middleware/error-handler.d.ts +1 -5
  16. package/dist/middleware/error-handler.d.ts.map +1 -1
  17. package/dist/middleware/error-handler.js +1 -11
  18. package/dist/middleware/error-handler.js.map +1 -1
  19. package/dist/middleware/rate-limiter.d.ts +2 -20
  20. package/dist/middleware/rate-limiter.d.ts.map +1 -1
  21. package/dist/middleware/rate-limiter.js +11 -44
  22. package/dist/middleware/rate-limiter.js.map +1 -1
  23. package/dist/prompts/index.d.ts +0 -3
  24. package/dist/prompts/index.d.ts.map +1 -1
  25. package/dist/prompts/index.js +0 -3
  26. package/dist/prompts/index.js.map +1 -1
  27. package/dist/resources/index.d.ts +0 -3
  28. package/dist/resources/index.d.ts.map +1 -1
  29. package/dist/resources/index.js +1 -4
  30. package/dist/resources/index.js.map +1 -1
  31. package/dist/server.d.ts +0 -4
  32. package/dist/server.d.ts.map +1 -1
  33. package/dist/server.js +2 -6
  34. package/dist/server.js.map +1 -1
  35. package/dist/services/cache.d.ts +9 -6
  36. package/dist/services/cache.d.ts.map +1 -1
  37. package/dist/services/cache.js +71 -20
  38. package/dist/services/cache.js.map +1 -1
  39. package/dist/services/card-extractor.d.ts +10 -0
  40. package/dist/services/card-extractor.d.ts.map +1 -0
  41. package/dist/services/card-extractor.js +187 -0
  42. package/dist/services/card-extractor.js.map +1 -0
  43. package/dist/services/extractor.d.ts +6 -19
  44. package/dist/services/extractor.d.ts.map +1 -1
  45. package/dist/services/extractor.js +53 -46
  46. package/dist/services/extractor.js.map +1 -1
  47. package/dist/services/fetcher.d.ts +4 -11
  48. package/dist/services/fetcher.d.ts.map +1 -1
  49. package/dist/services/fetcher.js +30 -36
  50. package/dist/services/fetcher.js.map +1 -1
  51. package/dist/services/logger.d.ts.map +1 -1
  52. package/dist/services/logger.js +4 -6
  53. package/dist/services/logger.js.map +1 -1
  54. package/dist/services/parser.d.ts +1 -6
  55. package/dist/services/parser.d.ts.map +1 -1
  56. package/dist/services/parser.js +64 -47
  57. package/dist/services/parser.js.map +1 -1
  58. package/dist/tools/handlers/fetch-links.tool.d.ts +5 -12
  59. package/dist/tools/handlers/fetch-links.tool.d.ts.map +1 -1
  60. package/dist/tools/handlers/fetch-links.tool.js +104 -79
  61. package/dist/tools/handlers/fetch-links.tool.js.map +1 -1
  62. package/dist/tools/handlers/fetch-markdown.tool.d.ts +7 -4
  63. package/dist/tools/handlers/fetch-markdown.tool.d.ts.map +1 -1
  64. package/dist/tools/handlers/fetch-markdown.tool.js +84 -84
  65. package/dist/tools/handlers/fetch-markdown.tool.js.map +1 -1
  66. package/dist/tools/handlers/fetch-url.tool.d.ts +8 -6
  67. package/dist/tools/handlers/fetch-url.tool.d.ts.map +1 -1
  68. package/dist/tools/handlers/fetch-url.tool.js +51 -93
  69. package/dist/tools/handlers/fetch-url.tool.js.map +1 -1
  70. package/dist/tools/handlers/fetch-urls.tool.d.ts +5 -0
  71. package/dist/tools/handlers/fetch-urls.tool.d.ts.map +1 -0
  72. package/dist/tools/handlers/fetch-urls.tool.js +147 -0
  73. package/dist/tools/handlers/fetch-urls.tool.js.map +1 -0
  74. package/dist/tools/index.d.ts +0 -4
  75. package/dist/tools/index.d.ts.map +1 -1
  76. package/dist/tools/index.js +145 -15
  77. package/dist/tools/index.js.map +1 -1
  78. package/dist/tools/utils/common.d.ts +8 -0
  79. package/dist/tools/utils/common.d.ts.map +1 -0
  80. package/dist/tools/utils/common.js +35 -0
  81. package/dist/tools/utils/common.js.map +1 -0
  82. package/dist/tools/utils/fetch-pipeline.d.ts +3 -0
  83. package/dist/tools/utils/fetch-pipeline.d.ts.map +1 -0
  84. package/dist/tools/utils/fetch-pipeline.js +37 -0
  85. package/dist/tools/utils/fetch-pipeline.js.map +1 -0
  86. package/dist/tools/utils/index.d.ts +4 -0
  87. package/dist/tools/utils/index.d.ts.map +1 -0
  88. package/dist/tools/utils/index.js +3 -0
  89. package/dist/tools/utils/index.js.map +1 -0
  90. package/dist/tools/utils/response-builder.d.ts +3 -0
  91. package/dist/tools/utils/response-builder.d.ts.map +1 -0
  92. package/dist/tools/utils/response-builder.js +24 -0
  93. package/dist/tools/utils/response-builder.js.map +1 -0
  94. package/dist/transformers/jsonl.transformer.d.ts +1 -1
  95. package/dist/transformers/jsonl.transformer.d.ts.map +1 -1
  96. package/dist/transformers/jsonl.transformer.js +2 -1
  97. package/dist/transformers/jsonl.transformer.js.map +1 -1
  98. package/dist/transformers/markdown.transformer.d.ts +1 -1
  99. package/dist/transformers/markdown.transformer.d.ts.map +1 -1
  100. package/dist/transformers/markdown.transformer.js +116 -2
  101. package/dist/transformers/markdown.transformer.js.map +1 -1
  102. package/dist/types/content.types.d.ts +11 -11
  103. package/dist/types/content.types.d.ts.map +1 -1
  104. package/dist/types/index.d.ts +1 -2
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/types/index.js +1 -2
  107. package/dist/types/index.js.map +1 -1
  108. package/dist/types/schemas.d.ts +39 -12
  109. package/dist/types/schemas.d.ts.map +1 -1
  110. package/dist/utils/concurrency.d.ts +2 -0
  111. package/dist/utils/concurrency.d.ts.map +1 -0
  112. package/dist/utils/concurrency.js +25 -0
  113. package/dist/utils/concurrency.js.map +1 -0
  114. package/dist/utils/content-cleaner.d.ts +32 -0
  115. package/dist/utils/content-cleaner.d.ts.map +1 -0
  116. package/dist/utils/content-cleaner.js +240 -0
  117. package/dist/utils/content-cleaner.js.map +1 -0
  118. package/dist/utils/language-detector.d.ts +5 -0
  119. package/dist/utils/language-detector.d.ts.map +1 -0
  120. package/dist/utils/language-detector.js +50 -0
  121. package/dist/utils/language-detector.js.map +1 -0
  122. package/dist/utils/sanitizer.d.ts +0 -10
  123. package/dist/utils/sanitizer.d.ts.map +1 -1
  124. package/dist/utils/sanitizer.js +3 -11
  125. package/dist/utils/sanitizer.js.map +1 -1
  126. package/dist/utils/tool-error-handler.d.ts +1 -15
  127. package/dist/utils/tool-error-handler.d.ts.map +1 -1
  128. package/dist/utils/tool-error-handler.js +1 -1
  129. package/dist/utils/tool-error-handler.js.map +1 -1
  130. package/dist/utils/url-validator.d.ts +0 -8
  131. package/dist/utils/url-validator.d.ts.map +1 -1
  132. package/dist/utils/url-validator.js +17 -31
  133. package/dist/utils/url-validator.js.map +1 -1
  134. package/package.json +4 -3
package/README.md CHANGED
@@ -1,327 +1,590 @@
1
- # 🚀 superFetch
2
-
3
- [![npm version](https://img.shields.io/npm/v/@j0hanz/superfetch.svg)](https://www.npmjs.com/package/@j0hanz/superfetch)[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)[![Node.js](https://img.shields.io/badge/Node.js-≥18.0.0-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)[![MCP](https://img.shields.io/badge/MCP-1.0.4-8B5CF6?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0wIDE4Yy00LjQyIDAtOC0zLjU4LTgtOHMzLjU4LTggOC04IDggMy41OCA4IDgtMy41OCA4LTggOHoiLz48L3N2Zz4=)](https://modelcontextprotocol.io/)
4
-
5
- A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that fetches, extracts, and transforms web content into AI-optimized formats using Mozilla Readability.
6
-
7
- [Quick Start](#quick-start) · [Tools](#available-tools) · [Configuration](#configuration) · [Contributing](#contributing)
8
-
9
- ---
10
-
11
- > [!CAUTION]
12
- > This server can access URLs on behalf of AI assistants. Built-in SSRF protection blocks private IP ranges and cloud metadata endpoints, but exercise caution when deploying in sensitive environments.
13
-
14
- ## ✨ Features
15
-
16
- | Feature | Description |
17
- | ------------------------- | ------------------------------------------------------------- |
18
- | 🧠 **Smart Extraction** | Mozilla Readability removes ads, navigation, and boilerplate |
19
- | 📄 **Multiple Formats** | JSONL semantic blocks or clean Markdown with YAML frontmatter |
20
- | 🔗 **Link Discovery** | Extract and classify internal/external links |
21
- | ⚡ **Built-in Caching** | Configurable TTL and max entries |
22
- | 🛡️ **Security First** | SSRF protection, URL validation, header sanitization |
23
- | 🔄 **Resilient Fetching** | Exponential backoff with jitter |
24
- | 📊 **Monitoring** | Stats resource for cache performance and health |
25
-
26
- ---
27
-
28
- ## Quick Start
29
-
30
- Add superFetch to your MCP client configuration no installation required!
31
-
32
- ### Claude Desktop
33
-
34
- Add to your `claude_desktop_config.json`:
35
-
36
- ```json
37
- {
38
- "mcpServers": {
39
- "superFetch": {
40
- "command": "npx",
41
- "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
42
- }
43
- }
44
- }
45
- ```
46
-
47
- ### VS Code
48
-
49
- Add to `.vscode/mcp.json` in your workspace:
50
-
51
- ```json
52
- {
53
- "servers": {
54
- "superFetch": {
55
- "command": "npx",
56
- "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
57
- }
58
- }
59
- }
60
- ```
61
-
62
- ### With Environment Variables
63
-
64
- ```json
65
- {
66
- "servers": {
67
- "superFetch": {
68
- "command": "npx",
69
- "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
70
- "env": {
71
- "CACHE_TTL": "7200",
72
- "LOG_LEVEL": "debug"
73
- }
74
- }
75
- }
76
- }
77
- ```
78
-
79
- ---
80
-
81
- ## Installation (Alternative)
82
-
83
- ### Global Installation
84
-
85
- ```bash
86
- npm install -g @j0hanz/superfetch
87
-
88
- # Run in stdio mode
89
- superfetch --stdio
90
-
91
- # Run HTTP server
92
- superfetch
93
- ```
94
-
95
- ### From Source
96
-
97
- ```bash
98
- git clone https://github.com/j0hanz/super-fetch-mcp-server.git
99
- cd super-fetch-mcp-server
100
- npm install
101
- npm run build
102
- ```
103
-
104
- ### Running the Server
105
-
106
- <details>
107
- <summary><strong>HTTP Mode</strong> (default)</summary>
108
-
109
- ```bash
110
- # Development with hot reload
111
- npm run dev
112
-
113
- # Production
114
- npm start
115
- ```
116
-
117
- Server runs at `http://127.0.0.1:3000`:
118
-
119
- - Health check: `GET /health`
120
- - MCP endpoint: `POST /mcp`
121
-
122
- </details>
123
-
124
- <details>
125
- <summary><strong>stdio Mode</strong> (direct MCP integration)</summary>
126
-
127
- ```bash
128
- node dist/index.js --stdio
129
- ```
130
-
131
- </details>
132
-
133
- ---
134
-
135
- ## Available Tools
136
-
137
- ### `fetch-url`
138
-
139
- Fetches a webpage and converts it to AI-readable format.
140
-
141
- | Parameter | Type | Default | Description |
142
- | -------------------- | ------------------------- | ---------- | -------------------------- |
143
- | `url` | string | _required_ | URL to fetch |
144
- | `format` | `'jsonl'` \| `'markdown'` | `'jsonl'` | Output format |
145
- | `extractMainContent` | boolean | `true` | Use Readability extraction |
146
- | `includeMetadata` | boolean | `true` | Include page metadata |
147
- | `maxContentLength` | number | – | Max content length (chars) |
148
- | `customHeaders` | object | – | Custom HTTP headers |
149
-
150
- ### `fetch-links`
151
-
152
- Extracts hyperlinks from a webpage with classification.
153
-
154
- | Parameter | Type | Default | Description |
155
- | ----------------- | ------- | ---------- | ------------------------- |
156
- | `url` | string | _required_ | URL to extract links from |
157
- | `includeExternal` | boolean | `true` | Include external links |
158
- | `includeInternal` | boolean | `true` | Include internal links |
159
-
160
- ### `fetch-markdown`
161
-
162
- Fetches a webpage and converts it to clean Markdown.
163
-
164
- | Parameter | Type | Default | Description |
165
- | -------------------- | ------- | ---------- | ------------------------- |
166
- | `url` | string | _required_ | URL to fetch |
167
- | `extractMainContent` | boolean | `true` | Extract main content only |
168
- | `includeMetadata` | boolean | `true` | Include YAML frontmatter |
169
-
170
- ### Resources
171
-
172
- | URI | Description |
173
- | -------------------- | ----------------------------------- |
174
- | `superfetch://stats` | Server statistics and cache metrics |
175
-
176
- ### Prompts
177
-
178
- - **`analyze-web-content`** — Analyze fetched content with optional focus area
179
- - **`summarize-page`** — Fetch and summarize a webpage concisely
180
- - **`extract-data`** — Extract structured data from a webpage
181
-
182
- ---
183
-
184
- ## Configuration
185
-
186
- ### Alternative MCP Client Setups
187
-
188
- <details>
189
- <summary><strong>VS Code (HTTP mode)</strong> — requires running server separately</summary>
190
-
191
- First, start the HTTP server:
192
-
193
- ```bash
194
- npx -y @j0hanz/superfetch@latest
195
- ```
196
-
197
- Then add to `.vscode/mcp.json`:
198
-
199
- ```json
200
- {
201
- "servers": {
202
- "superFetch": {
203
- "type": "http",
204
- "url": "http://127.0.0.1:3000/mcp"
205
- }
206
- }
207
- }
208
- ```
209
-
210
- </details>
211
-
212
- <details>
213
- <summary><strong>Claude Desktop (local path)</strong> — for development</summary>
214
-
215
- ```json
216
- {
217
- "mcpServers": {
218
- "superFetch": {
219
- "command": "node",
220
- "args": ["/path/to/super-fetch-mcp-server/dist/index.js", "--stdio"]
221
- }
222
- }
223
- }
224
- ```
225
-
226
- </details>
227
-
228
- ### Environment Variables
229
-
230
- | Variable | Default | Description |
231
- | -------------------- | -------------------- | ------------------------- |
232
- | `PORT` | `3000` | HTTP server port |
233
- | `HOST` | `127.0.0.1` | HTTP server host |
234
- | `FETCH_TIMEOUT` | `30000` | Request timeout (ms) |
235
- | `MAX_REDIRECTS` | `5` | Maximum HTTP redirects |
236
- | `USER_AGENT` | `superFetch-MCP/1.0` | HTTP User-Agent |
237
- | `MAX_CONTENT_LENGTH` | `10485760` | Max response size (bytes) |
238
- | `CACHE_ENABLED` | `true` | Enable response caching |
239
- | `CACHE_TTL` | `3600` | Cache TTL (seconds) |
240
- | `CACHE_MAX_KEYS` | `100` | Maximum cache entries |
241
- | `LOG_LEVEL` | `info` | Logging level |
242
-
243
- ---
244
-
245
- ## Content Block Types
246
-
247
- JSONL output includes semantic content blocks:
248
-
249
- | Type | Description |
250
- | ----------- | ----------------------------------------------- |
251
- | `metadata` | Page title, description, author, URL, timestamp |
252
- | `heading` | Headings (h1-h6) with level indicator |
253
- | `paragraph` | Text paragraphs |
254
- | `list` | Ordered/unordered lists |
255
- | `code` | Code blocks with language |
256
- | `table` | Tables with headers and rows |
257
- | `image` | Images with src and alt text |
258
-
259
- ---
260
-
261
- ## Security
262
-
263
- ### SSRF Protection
264
-
265
- Blocked destinations:
266
-
267
- - Localhost and loopback addresses
268
- - Private IP ranges (`10.x.x.x`, `172.16-31.x.x`, `192.168.x.x`)
269
- - Cloud metadata endpoints (AWS, GCP, Azure)
270
- - IPv6 link-local and unique local addresses
271
-
272
- ### Header Sanitization
273
-
274
- Blocked headers: `host`, `authorization`, `cookie`, `x-forwarded-for`, `x-real-ip`, `proxy-authorization`
275
-
276
- ### Rate Limiting
277
-
278
- Default: **100 requests/minute** per IP (configurable)
279
-
280
- ---
281
-
282
- ## Development
283
-
284
- ### Scripts
285
-
286
- | Command | Description |
287
- | -------------------- | ---------------------------------- |
288
- | `npm run dev` | Development server with hot reload |
289
- | `npm run build` | Compile TypeScript |
290
- | `npm start` | Production server |
291
- | `npm run lint` | Run ESLint |
292
- | `npm run type-check` | TypeScript type checking |
293
- | `npm run format` | Format with Prettier |
294
- | `npm test` | Run tests |
295
-
296
- ### Tech Stack
297
-
298
- | Category | Technology |
299
- | ------------------ | ------------------------------- |
300
- | Runtime | Node.js ≥18 |
301
- | Language | TypeScript 5.9 |
302
- | MCP SDK | @modelcontextprotocol/sdk 1.0.4 |
303
- | Content Extraction | @mozilla/readability |
304
- | HTML Parsing | Cheerio, JSDOM |
305
- | Markdown | Turndown |
306
- | HTTP | Express, Axios |
307
- | Caching | node-cache |
308
- | Validation | Zod |
309
-
310
- ---
311
-
312
- ## Contributing
313
-
314
- 1. Fork the repository
315
- 2. Create a feature branch: `git checkout -b feature/amazing-feature`
316
- 3. Ensure linting passes: `npm run lint`
317
- 4. Commit changes: `git commit -m 'Add amazing feature'`
318
- 5. Push: `git push origin feature/amazing-feature`
319
- 6. Open a Pull Request
320
-
321
- For examples of other MCP servers, see: [github.com/modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers)
322
-
323
- ---
324
-
325
- ## License
326
-
327
- MIT License see [LICENSE](LICENSE) for details.
1
+ # 🚀 superFetch
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@j0hanz/superfetch.svg)](https://www.npmjs.com/package/@j0hanz/superfetch)[![Node.js](https://img.shields.io/badge/Node.js-≥18.0.0-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)[![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)[![MCP SDK](https://img.shields.io/badge/MCP_SDK-1.0.4-8B5CF6)](https://modelcontextprotocol.io/)
4
+
5
+ ## One-Click Install
6
+
7
+ [![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=superfetch&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fsuperfetch%40latest%22%2C%22--stdio%22%5D%7D)[![Install with NPX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=superfetch&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Fsuperfetch%40latest%22%2C%22--stdio%22%5D%7D&quality=insiders)
8
+
9
+ [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=superfetch&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovc3VwZXJmZXRjaEBsYXRlc3QiLCItLXN0ZGlvIl19)
10
+
11
+ A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that fetches, extracts, and transforms web content into AI-optimized formats using Mozilla Readability.
12
+
13
+ [Quick Start](#quick-start) · [How to Choose a Tool](#-how-to-choose-a-tool) · [Tools](#available-tools) · [Configuration](#configuration) · [Contributing](#contributing)
14
+
15
+ > 📦 **Published to [MCP Registry](https://registry.modelcontextprotocol.io/)** — Search for `io.github.j0hanz/superfetch`
16
+
17
+ ---
18
+
19
+ > [!CAUTION]
20
+ > This server can access URLs on behalf of AI assistants. Built-in SSRF protection blocks private IP ranges and cloud metadata endpoints, but exercise caution when deploying in sensitive environments.
21
+
22
+ ## Features
23
+
24
+ | Feature | Description |
25
+ | ------------------------- | ------------------------------------------------------------- |
26
+ | 🧠 **Smart Extraction** | Mozilla Readability removes ads, navigation, and boilerplate |
27
+ | 📄 **Multiple Formats** | JSONL semantic blocks or clean Markdown with YAML frontmatter |
28
+ | 🔗 **Link Discovery** | Extract and classify internal/external links |
29
+ | ⚡ **Built-in Caching** | Configurable TTL and max entries |
30
+ | 🛡️ **Security First** | SSRF protection, URL validation, header sanitization |
31
+ | 🔄 **Resilient Fetching** | Exponential backoff with jitter |
32
+ | 📊 **Monitoring** | Stats resource for cache performance and health |
33
+
34
+ ---
35
+
36
+ ## 🎯 How to Choose a Tool
37
+
38
+ Use this guide to select the right tool for your web content extraction needs:
39
+
40
+ ### Decision Tree
41
+
42
+ ```text
43
+ Need web content for AI?
44
+ ├─ Single URL?
45
+ │ ├─ Need structured semantic blocks → fetch-url (JSONL)
46
+ │ ├─ Need readable markdown → fetch-markdown
47
+ │ └─ Need links only → fetch-links
48
+ └─ Multiple URLs?
49
+ └─ Use fetch-urls (batch processing)
50
+ ```
51
+
52
+ ### Quick Reference Table
53
+
54
+ | Tool | Best For | Output Format | Use When |
55
+ | ---------------- | -------------------------------- | ----------------------- | ------------------------------------------- |
56
+ | `fetch-url` | Single page → structured content | JSONL semantic blocks | AI analysis, RAG pipelines, content parsing |
57
+ | `fetch-markdown` | Single page → readable format | Clean Markdown + TOC | Documentation, human-readable output |
58
+ | `fetch-links` | Link discovery & classification | URL array with types | Sitemap building, finding related pages |
59
+ | `fetch-urls` | Batch processing multiple pages | Multiple JSONL/Markdown | Comparing pages, bulk extraction |
60
+
61
+ ### Common Use Cases
62
+
63
+ | Task | Recommended Tool | Why |
64
+ | ------------------------ | ---------------------------------------- | ---------------------------------------------------- |
65
+ | Parse a blog post for AI | `fetch-url` | Returns semantic blocks (headings, paragraphs, code) |
66
+ | Generate documentation | `fetch-markdown` | Clean markdown with optional TOC |
67
+ | Build a sitemap | `fetch-links` | Extracts and classifies all links |
68
+ | Compare multiple docs | `fetch-urls` | Parallel fetching with concurrency control |
69
+ | Extract article for RAG | `fetch-url` + `extractMainContent: true` | Removes ads/nav, keeps main content |
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ Add superFetch to your MCP client configuration — no installation required!
76
+
77
+ ### Claude Desktop
78
+
79
+ Add to your `claude_desktop_config.json`:
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "superFetch": {
85
+ "command": "npx",
86
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### VS Code
93
+
94
+ Add to `.vscode/mcp.json` in your workspace:
95
+
96
+ ```json
97
+ {
98
+ "servers": {
99
+ "superFetch": {
100
+ "command": "npx",
101
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### With Environment Variables
108
+
109
+ ```json
110
+ {
111
+ "servers": {
112
+ "superFetch": {
113
+ "command": "npx",
114
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
115
+ "env": {
116
+ "CACHE_TTL": "7200",
117
+ "LOG_LEVEL": "debug"
118
+ }
119
+ }
120
+ }
121
+ }
122
+ ```
123
+
124
+ ### Cursor
125
+
126
+ 1. Open Cursor Settings
127
+ 2. Go to **Features > MCP Servers**
128
+ 3. Click **"+ Add new global MCP server"**
129
+ 4. Add this configuration:
130
+
131
+ ```json
132
+ {
133
+ "mcpServers": {
134
+ "superFetch": {
135
+ "command": "npx",
136
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ > **Tip:** On Windows, if you encounter issues, try: `cmd /c "npx -y @j0hanz/superfetch@latest --stdio"`
143
+
144
+ <details>
145
+ <summary><strong>Cline (VS Code Extension)</strong></summary>
146
+
147
+ Open the Cline MCP settings file:
148
+
149
+ **macOS:**
150
+
151
+ ```bash
152
+ code ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
153
+ ```
154
+
155
+ **Windows:**
156
+
157
+ ```bash
158
+ code %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
159
+ ```
160
+
161
+ Add the configuration:
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "superFetch": {
167
+ "command": "npx",
168
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
169
+ "disabled": false,
170
+ "autoApprove": []
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ </details>
177
+
178
+ <details>
179
+ <summary><strong>Windsurf</strong></summary>
180
+
181
+ Add to `./codeium/windsurf/model_config.json`:
182
+
183
+ ```json
184
+ {
185
+ "mcpServers": {
186
+ "superFetch": {
187
+ "command": "npx",
188
+ "args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ </details>
195
+
196
+ <details>
197
+ <summary><strong>Claude Desktop (Config File Locations)</strong></summary>
198
+
199
+ **macOS:**
200
+
201
+ ```bash
202
+ # Open config file
203
+ open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
204
+
205
+ # Or with VS Code
206
+ code "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
207
+ ```
208
+
209
+ **Windows:**
210
+
211
+ ```bash
212
+ code %APPDATA%\Claude\claude_desktop_config.json
213
+ ```
214
+
215
+ </details>
216
+
217
+ ---
218
+
219
+ ## Installation (Alternative)
220
+
221
+ ### Global Installation
222
+
223
+ ```bash
224
+ npm install -g @j0hanz/superfetch
225
+
226
+ # Run in stdio mode
227
+ superfetch --stdio
228
+
229
+ # Run HTTP server
230
+ superfetch
231
+ ```
232
+
233
+ ### From Source
234
+
235
+ ```bash
236
+ git clone https://github.com/j0hanz/super-fetch-mcp-server.git
237
+ cd super-fetch-mcp-server
238
+ npm install
239
+ npm run build
240
+ ```
241
+
242
+ ### Running the Server
243
+
244
+ <details>
245
+ <summary><strong>HTTP Mode</strong> (default)</summary>
246
+
247
+ ```bash
248
+ # Development with hot reload
249
+ npm run dev
250
+
251
+ # Production
252
+ npm start
253
+ ```
254
+
255
+ Server runs at `http://127.0.0.1:3000`:
256
+
257
+ - Health check: `GET /health`
258
+ - MCP endpoint: `POST /mcp`
259
+
260
+ </details>
261
+
262
+ <details>
263
+ <summary><strong>stdio Mode</strong> (direct MCP integration)</summary>
264
+
265
+ ```bash
266
+ node dist/index.js --stdio
267
+ ```
268
+
269
+ </details>
270
+
271
+ ---
272
+
273
+ ## Available Tools
274
+
275
+ ### `fetch-url`
276
+
277
+ Fetches a webpage and converts it to AI-readable JSONL format with semantic content blocks.
278
+
279
+ | Parameter | Type | Default | Description |
280
+ | -------------------- | ------- | ---------- | -------------------------------------------- |
281
+ | `url` | string | _required_ | URL to fetch |
282
+ | `extractMainContent` | boolean | `true` | Use Readability to extract main content |
283
+ | `includeMetadata` | boolean | `true` | Include page metadata (title, description) |
284
+ | `maxContentLength` | number | – | Maximum content length in characters |
285
+ | `customHeaders` | object | – | Custom HTTP headers for the request |
286
+ | `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
287
+ | `retries` | number | `3` | Number of retry attempts (1-10) |
288
+
289
+ **Example Response:**
290
+
291
+ ```json
292
+ {
293
+ "url": "https://example.com/article",
294
+ "title": "Example Article",
295
+ "fetchedAt": "2025-12-11T10:30:00.000Z",
296
+ "contentBlocks": [
297
+ {
298
+ "type": "metadata",
299
+ "title": "Example Article",
300
+ "description": "A sample article"
301
+ },
302
+ { "type": "heading", "level": 1, "text": "Introduction" },
303
+ {
304
+ "type": "paragraph",
305
+ "text": "This is the main content of the article..."
306
+ },
307
+ {
308
+ "type": "code",
309
+ "language": "javascript",
310
+ "content": "console.log('Hello');"
311
+ }
312
+ ],
313
+ "cached": false
314
+ }
315
+ ```
316
+
317
+ ### `fetch-links`
318
+
319
+ Extracts hyperlinks from a webpage with classification. Supports filtering, image links, and link limits.
320
+
321
+ | Parameter | Type | Default | Description |
322
+ | ----------------- | ------- | ---------- | -------------------------------------------- |
323
+ | `url` | string | _required_ | URL to extract links from |
324
+ | `includeExternal` | boolean | `true` | Include external links |
325
+ | `includeInternal` | boolean | `true` | Include internal links |
326
+ | `includeImages` | boolean | `false` | Include image links (img src attributes) |
327
+ | `maxLinks` | number | – | Maximum number of links to return (1-1000) |
328
+ | `filterPattern` | string | – | Regex pattern to filter links (matches href) |
329
+ | `customHeaders` | object | – | Custom HTTP headers for the request |
330
+ | `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
331
+ | `retries` | number | `3` | Number of retry attempts (1-10) |
332
+
333
+ **Example Response:**
334
+
335
+ ```json
336
+ {
337
+ "url": "https://example.com/",
338
+ "linkCount": 15,
339
+ "links": [
340
+ {
341
+ "href": "https://example.com/about",
342
+ "text": "About Us",
343
+ "type": "internal"
344
+ },
345
+ {
346
+ "href": "https://github.com/example",
347
+ "text": "GitHub",
348
+ "type": "external"
349
+ },
350
+ { "href": "https://example.com/logo.png", "text": "", "type": "image" }
351
+ ],
352
+ "cached": false,
353
+ "truncated": false
354
+ }
355
+ ```
356
+
357
+ ### `fetch-markdown`
358
+
359
+ Fetches a webpage and converts it to clean Markdown with optional table of contents.
360
+
361
+ | Parameter | Type | Default | Description |
362
+ | -------------------- | ------- | ---------- | -------------------------------------------- |
363
+ | `url` | string | _required_ | URL to fetch |
364
+ | `extractMainContent` | boolean | `true` | Extract main content only |
365
+ | `includeMetadata` | boolean | `true` | Include YAML frontmatter |
366
+ | `maxContentLength` | number | – | Maximum content length in characters |
367
+ | `generateToc` | boolean | `false` | Generate table of contents from headings |
368
+ | `customHeaders` | object | – | Custom HTTP headers for the request |
369
+ | `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
370
+ | `retries` | number | `3` | Number of retry attempts (1-10) |
371
+
372
+ **Example Response:**
373
+
374
+ ````json
375
+ {
376
+ "url": "https://example.com/docs",
377
+ "title": "Documentation",
378
+ "fetchedAt": "2025-12-11T10:30:00.000Z",
379
+ "markdown": "---\ntitle: Documentation\nsource: \"https://example.com/docs\"\n---\n\n# Getting Started\n\nWelcome to our documentation...\n\n## Installation\n\n```bash\nnpm install example\n```",
380
+ "toc": [
381
+ { "level": 1, "text": "Getting Started", "slug": "getting-started" },
382
+ { "level": 2, "text": "Installation", "slug": "installation" }
383
+ ],
384
+ "cached": false,
385
+ "truncated": false
386
+ }
387
+ ````
388
+
389
+ ### `fetch-urls` (Batch)
390
+
391
+ Fetches multiple URLs in parallel with concurrency control. Ideal for comparing content or processing multiple pages efficiently.
392
+
393
+ | Parameter | Type | Default | Description |
394
+ | -------------------- | -------- | ---------- | -------------------------------------------- |
395
+ | `urls` | string[] | _required_ | Array of URLs to fetch (1-10 URLs) |
396
+ | `extractMainContent` | boolean | `true` | Use Readability to extract main content |
397
+ | `includeMetadata` | boolean | `true` | Include page metadata |
398
+ | `maxContentLength` | number | – | Maximum content length per URL in characters |
399
+ | `format` | string | `'jsonl'` | Output format: `'jsonl'` or `'markdown'` |
400
+ | `concurrency` | number | `3` | Maximum concurrent requests (1-5) |
401
+ | `continueOnError` | boolean | `true` | Continue processing if some URLs fail |
402
+ | `customHeaders` | object | – | Custom HTTP headers for all requests |
403
+ | `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
404
+ | `retries` | number | `3` | Number of retry attempts (1-10) |
405
+
406
+ **Example Output:**
407
+
408
+ ```json
409
+ {
410
+ "results": [
411
+ {
412
+ "url": "https://example.com",
413
+ "success": true,
414
+ "title": "Example",
415
+ "content": "...",
416
+ "cached": false
417
+ },
418
+ {
419
+ "url": "https://example.org",
420
+ "success": true,
421
+ "title": "Example Org",
422
+ "content": "...",
423
+ "cached": false
424
+ }
425
+ ],
426
+ "summary": {
427
+ "total": 2,
428
+ "successful": 2,
429
+ "failed": 0,
430
+ "cached": 0,
431
+ "totalContentBlocks": 15
432
+ },
433
+ "fetchedAt": "2024-12-11T10:30:00.000Z"
434
+ }
435
+ ```
436
+
437
+ ### Resources
438
+
439
+ | URI | Description |
440
+ | -------------------- | ----------------------------------- |
441
+ | `superfetch://stats` | Server statistics and cache metrics |
442
+
443
+ ### Prompts
444
+
445
+ - **`analyze-web-content`** — Analyze fetched content with optional focus area
446
+ - **`summarize-page`** — Fetch and summarize a webpage concisely
447
+ - **`extract-data`** — Extract structured data from a webpage
448
+
449
+ ---
450
+
451
+ ## Configuration
452
+
453
+ ### Alternative MCP Client Setups
454
+
455
+ <details>
456
+ <summary><strong>VS Code (HTTP mode)</strong> — requires running server separately</summary>
457
+
458
+ First, start the HTTP server:
459
+
460
+ ```bash
461
+ npx -y @j0hanz/superfetch@latest
462
+ ```
463
+
464
+ Then add to `.vscode/mcp.json`:
465
+
466
+ ```json
467
+ {
468
+ "servers": {
469
+ "superFetch": {
470
+ "type": "http",
471
+ "url": "http://127.0.0.1:3000/mcp"
472
+ }
473
+ }
474
+ }
475
+ ```
476
+
477
+ </details>
478
+
479
+ <details>
480
+ <summary><strong>Claude Desktop (local path)</strong> — for development</summary>
481
+
482
+ ```json
483
+ {
484
+ "mcpServers": {
485
+ "superFetch": {
486
+ "command": "node",
487
+ "args": ["/path/to/super-fetch-mcp-server/dist/index.js", "--stdio"]
488
+ }
489
+ }
490
+ }
491
+ ```
492
+
493
+ </details>
494
+
495
+ ### Environment Variables
496
+
497
+ | Variable | Default | Description |
498
+ | -------------------- | -------------------- | ------------------------- |
499
+ | `PORT` | `3000` | HTTP server port |
500
+ | `HOST` | `127.0.0.1` | HTTP server host |
501
+ | `FETCH_TIMEOUT` | `30000` | Request timeout (ms) |
502
+ | `MAX_REDIRECTS` | `5` | Maximum HTTP redirects |
503
+ | `USER_AGENT` | `superFetch-MCP/1.0` | HTTP User-Agent |
504
+ | `MAX_CONTENT_LENGTH` | `10485760` | Max response size (bytes) |
505
+ | `CACHE_ENABLED` | `true` | Enable response caching |
506
+ | `CACHE_TTL` | `3600` | Cache TTL (seconds) |
507
+ | `CACHE_MAX_KEYS` | `100` | Maximum cache entries |
508
+ | `LOG_LEVEL` | `info` | Logging level |
509
+ | `ENABLE_LOGGING` | `true` | Enable/disable logging |
510
+
511
+ ---
512
+
513
+ ## Content Block Types
514
+
515
+ JSONL output includes semantic content blocks:
516
+
517
+ | Type | Description |
518
+ | ----------- | ----------------------------------------------- |
519
+ | `metadata` | Page title, description, author, URL, timestamp |
520
+ | `heading` | Headings (h1-h6) with level indicator |
521
+ | `paragraph` | Text paragraphs |
522
+ | `list` | Ordered/unordered lists |
523
+ | `code` | Code blocks with language |
524
+ | `table` | Tables with headers and rows |
525
+ | `image` | Images with src and alt text |
526
+
527
+ ---
528
+
529
+ ## Security
530
+
531
+ ### SSRF Protection
532
+
533
+ Blocked destinations:
534
+
535
+ - Localhost and loopback addresses
536
+ - Private IP ranges (`10.x.x.x`, `172.16-31.x.x`, `192.168.x.x`)
537
+ - Cloud metadata endpoints (AWS, GCP, Azure)
538
+ - IPv6 link-local and unique local addresses
539
+
540
+ ### Header Sanitization
541
+
542
+ Blocked headers: `host`, `authorization`, `cookie`, `x-forwarded-for`, `x-real-ip`, `proxy-authorization`
543
+
544
+ ### Rate Limiting
545
+
546
+ Default: **100 requests/minute** per IP (configurable)
547
+
548
+ ---
549
+
550
+ ## Development
551
+
552
+ ### Scripts
553
+
554
+ | Command | Description |
555
+ | -------------------- | ---------------------------------- |
556
+ | `npm run dev` | Development server with hot reload |
557
+ | `npm run build` | Compile TypeScript |
558
+ | `npm start` | Production server |
559
+ | `npm run lint` | Run ESLint |
560
+ | `npm run type-check` | TypeScript type checking |
561
+ | `npm run format` | Format with Prettier |
562
+ | `npm test` | Run tests |
563
+
564
+ ### Tech Stack
565
+
566
+ | Category | Technology |
567
+ | ------------------ | -------------------------------- |
568
+ | Runtime | Node.js ≥18 |
569
+ | Language | TypeScript 5.9 |
570
+ | MCP SDK | @modelcontextprotocol/sdk ^1.0.4 |
571
+ | Content Extraction | @mozilla/readability |
572
+ | HTML Parsing | Cheerio, JSDOM |
573
+ | Markdown | Turndown |
574
+ | HTTP | Express, Axios |
575
+ | Caching | node-cache |
576
+ | Validation | Zod |
577
+ | Logging | Winston |
578
+
579
+ ---
580
+
581
+ ## Contributing
582
+
583
+ 1. Fork the repository
584
+ 2. Create a feature branch: `git checkout -b feature/amazing-feature`
585
+ 3. Ensure linting passes: `npm run lint`
586
+ 4. Commit changes: `git commit -m 'Add amazing feature'`
587
+ 5. Push: `git push origin feature/amazing-feature`
588
+ 6. Open a Pull Request
589
+
590
+ For examples of other MCP servers, see: [github.com/modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers)