@j0hanz/superfetch 1.1.9 → 1.2.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 +179 -469
- package/dist/config/constants.d.ts +19 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +24 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/formatting.d.ts +0 -2
- package/dist/config/formatting.d.ts.map +1 -1
- package/dist/config/formatting.js +1 -3
- package/dist/config/formatting.js.map +1 -1
- package/dist/config/index.d.ts +9 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +19 -16
- package/dist/config/index.js.map +1 -1
- package/dist/config/types/content.d.ts +1 -20
- package/dist/config/types/content.d.ts.map +1 -1
- package/dist/config/types/content.js +0 -1
- package/dist/config/types/runtime.d.ts +7 -5
- package/dist/config/types/runtime.d.ts.map +1 -1
- package/dist/config/types/runtime.js +0 -1
- package/dist/config/types/tools.d.ts +5 -50
- package/dist/config/types/tools.d.ts.map +1 -1
- package/dist/config/types/tools.js +0 -1
- package/dist/errors/app-error.d.ts +0 -1
- package/dist/errors/app-error.js +0 -1
- package/dist/http/auth.d.ts +0 -1
- package/dist/http/auth.d.ts.map +1 -1
- package/dist/http/auth.js +17 -13
- package/dist/http/auth.js.map +1 -1
- package/dist/http/cors.d.ts +0 -1
- package/dist/http/cors.js +4 -1
- package/dist/http/cors.js.map +1 -1
- package/dist/http/download-routes.d.ts +14 -0
- package/dist/http/download-routes.d.ts.map +1 -0
- package/dist/http/download-routes.js +131 -0
- package/dist/http/download-routes.js.map +1 -0
- package/dist/http/mcp-routes.d.ts +1 -2
- package/dist/http/mcp-routes.d.ts.map +1 -1
- package/dist/http/mcp-routes.js +1 -2
- package/dist/http/mcp-routes.js.map +1 -1
- package/dist/http/mcp-session-helpers.d.ts +13 -0
- package/dist/http/mcp-session-helpers.d.ts.map +1 -0
- package/dist/http/mcp-session-helpers.js +64 -0
- package/dist/http/mcp-session-helpers.js.map +1 -0
- package/dist/http/mcp-session.d.ts +1 -3
- package/dist/http/mcp-session.d.ts.map +1 -1
- package/dist/http/mcp-session.js +7 -71
- package/dist/http/mcp-session.js.map +1 -1
- package/dist/http/mcp-validation.d.ts +1 -2
- package/dist/http/mcp-validation.d.ts.map +1 -1
- package/dist/http/mcp-validation.js +6 -27
- package/dist/http/mcp-validation.js.map +1 -1
- package/dist/http/rate-limit.d.ts +1 -2
- package/dist/http/rate-limit.d.ts.map +1 -1
- package/dist/http/rate-limit.js +0 -1
- package/dist/http/rate-limit.js.map +1 -1
- package/dist/http/server-middleware.d.ts +9 -0
- package/dist/http/server-middleware.d.ts.map +1 -0
- package/dist/http/server-middleware.js +111 -0
- package/dist/http/server-middleware.js.map +1 -0
- package/dist/http/server.d.ts +0 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +20 -99
- package/dist/http/server.js.map +1 -1
- package/dist/http/session-cleanup.d.ts +2 -0
- package/dist/http/session-cleanup.d.ts.map +1 -0
- package/dist/http/session-cleanup.js +37 -0
- package/dist/http/session-cleanup.js.map +1 -0
- package/dist/http/sessions.d.ts +1 -2
- package/dist/http/sessions.d.ts.map +1 -1
- package/dist/http/sessions.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/middleware/error-handler.d.ts +0 -1
- package/dist/middleware/error-handler.js +0 -1
- package/dist/resources/cached-content.d.ts +0 -1
- package/dist/resources/cached-content.d.ts.map +1 -1
- package/dist/resources/cached-content.js +76 -12
- package/dist/resources/cached-content.js.map +1 -1
- package/dist/resources/index.d.ts +0 -1
- package/dist/resources/index.js +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -3
- package/dist/server.js.map +1 -1
- package/dist/services/cache.d.ts +7 -4
- package/dist/services/cache.d.ts.map +1 -1
- package/dist/services/cache.js +86 -26
- package/dist/services/cache.js.map +1 -1
- package/dist/services/context.d.ts +2 -2
- package/dist/services/context.d.ts.map +1 -1
- package/dist/services/context.js +0 -1
- package/dist/services/extractor.d.ts +1 -2
- package/dist/services/extractor.d.ts.map +1 -1
- package/dist/services/extractor.js +45 -18
- package/dist/services/extractor.js.map +1 -1
- package/dist/services/fetcher/agents.d.ts +0 -1
- package/dist/services/fetcher/agents.d.ts.map +1 -1
- package/dist/services/fetcher/agents.js +3 -7
- package/dist/services/fetcher/agents.js.map +1 -1
- package/dist/services/fetcher/errors.d.ts +0 -1
- package/dist/services/fetcher/errors.js +0 -1
- package/dist/services/fetcher/headers.d.ts.map +1 -1
- package/dist/services/fetcher/headers.js +2 -24
- package/dist/services/fetcher/headers.js.map +1 -1
- package/dist/services/fetcher/interceptors.d.ts +2 -2
- package/dist/services/fetcher/interceptors.d.ts.map +1 -1
- package/dist/services/fetcher/interceptors.js +30 -21
- package/dist/services/fetcher/interceptors.js.map +1 -1
- package/dist/services/fetcher/redirects.d.ts +0 -2
- package/dist/services/fetcher/redirects.d.ts.map +1 -1
- package/dist/services/fetcher/redirects.js +20 -18
- package/dist/services/fetcher/redirects.js.map +1 -1
- package/dist/services/fetcher/response.d.ts +0 -1
- package/dist/services/fetcher/response.js +4 -5
- package/dist/services/fetcher/retry-policy.d.ts +1 -28
- package/dist/services/fetcher/retry-policy.d.ts.map +1 -1
- package/dist/services/fetcher/retry-policy.js +119 -126
- package/dist/services/fetcher/retry-policy.js.map +1 -1
- package/dist/services/fetcher.d.ts +1 -2
- package/dist/services/fetcher.d.ts.map +1 -1
- package/dist/services/fetcher.js +18 -13
- package/dist/services/fetcher.js.map +1 -1
- package/dist/services/logger.d.ts +1 -2
- package/dist/services/logger.d.ts.map +1 -1
- package/dist/services/logger.js +0 -1
- package/dist/services/parser.d.ts +1 -3
- package/dist/services/parser.d.ts.map +1 -1
- package/dist/services/parser.js +5 -39
- package/dist/services/parser.js.map +1 -1
- package/dist/tools/handlers/fetch-links/link-extractor.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-links/link-extractor.js +15 -19
- package/dist/tools/handlers/fetch-links/link-extractor.js.map +1 -1
- package/dist/tools/handlers/fetch-links.tool.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-links.tool.js +0 -2
- package/dist/tools/handlers/fetch-links.tool.js.map +1 -1
- package/dist/tools/handlers/fetch-markdown.tool.d.ts +1 -2
- package/dist/tools/handlers/fetch-markdown.tool.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-markdown.tool.js +50 -20
- package/dist/tools/handlers/fetch-markdown.tool.js.map +1 -1
- package/dist/tools/handlers/fetch-single.shared.d.ts +14 -3
- package/dist/tools/handlers/fetch-single.shared.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-single.shared.js +66 -3
- package/dist/tools/handlers/fetch-single.shared.js.map +1 -1
- package/dist/tools/handlers/fetch-url.tool.d.ts +1 -2
- package/dist/tools/handlers/fetch-url.tool.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-url.tool.js +39 -17
- package/dist/tools/handlers/fetch-url.tool.js.map +1 -1
- package/dist/tools/handlers/fetch-urls/validation.d.ts +0 -1
- package/dist/tools/handlers/fetch-urls/validation.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-urls/validation.js +1 -1
- package/dist/tools/handlers/fetch-urls/validation.js.map +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -20
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/schemas.d.ts +57 -250
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +38 -198
- package/dist/tools/schemas.js.map +1 -1
- package/dist/tools/utils/cache-vary.d.ts +0 -2
- package/dist/tools/utils/cache-vary.d.ts.map +1 -1
- package/dist/tools/utils/cache-vary.js +8 -40
- package/dist/tools/utils/cache-vary.js.map +1 -1
- package/dist/tools/utils/common.d.ts +2 -4
- package/dist/tools/utils/common.d.ts.map +1 -1
- package/dist/tools/utils/common.js +6 -7
- package/dist/tools/utils/common.js.map +1 -1
- package/dist/tools/utils/content-transform.d.ts +1 -3
- package/dist/tools/utils/content-transform.d.ts.map +1 -1
- package/dist/tools/utils/content-transform.js +65 -14
- package/dist/tools/utils/content-transform.js.map +1 -1
- package/dist/tools/utils/fetch-pipeline.d.ts +1 -2
- package/dist/tools/utils/fetch-pipeline.d.ts.map +1 -1
- package/dist/tools/utils/fetch-pipeline.js +25 -21
- package/dist/tools/utils/fetch-pipeline.js.map +1 -1
- package/dist/tools/utils/inline-content.d.ts +3 -3
- package/dist/tools/utils/inline-content.d.ts.map +1 -1
- package/dist/tools/utils/inline-content.js +0 -1
- package/dist/transformers/jsonl.transformer.d.ts +1 -2
- package/dist/transformers/jsonl.transformer.d.ts.map +1 -1
- package/dist/transformers/jsonl.transformer.js +0 -1
- package/dist/transformers/jsonl.transformer.js.map +1 -1
- package/dist/transformers/markdown.transformer.d.ts +1 -2
- package/dist/transformers/markdown.transformer.d.ts.map +1 -1
- package/dist/transformers/markdown.transformer.js +11 -7
- package/dist/transformers/markdown.transformer.js.map +1 -1
- package/dist/utils/code-language.d.ts +2 -0
- package/dist/utils/code-language.d.ts.map +1 -0
- package/dist/utils/code-language.js +56 -0
- package/dist/utils/code-language.js.map +1 -0
- package/dist/utils/content-cleaner.d.ts +0 -2
- package/dist/utils/content-cleaner.d.ts.map +1 -1
- package/dist/utils/content-cleaner.js +0 -4
- package/dist/utils/content-cleaner.js.map +1 -1
- package/dist/utils/crypto.d.ts +2 -0
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/crypto.js +32 -0
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/download-url.d.ts +8 -0
- package/dist/utils/download-url.d.ts.map +1 -0
- package/dist/utils/download-url.js +27 -0
- package/dist/utils/download-url.js.map +1 -0
- package/dist/utils/error-utils.d.ts +3 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +12 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/filename-generator.d.ts +1 -0
- package/dist/utils/filename-generator.d.ts.map +1 -0
- package/dist/utils/filename-generator.js +59 -0
- package/dist/utils/filename-generator.js.map +1 -0
- package/dist/utils/header-normalizer.d.ts +7 -4
- package/dist/utils/header-normalizer.d.ts.map +1 -1
- package/dist/utils/header-normalizer.js +23 -17
- package/dist/utils/header-normalizer.js.map +1 -1
- package/dist/utils/html-truncator.d.ts +0 -1
- package/dist/utils/html-truncator.js +0 -1
- package/dist/utils/sanitizer.d.ts +0 -1
- package/dist/utils/sanitizer.js +0 -1
- package/dist/utils/tool-error-handler.d.ts +1 -3
- package/dist/utils/tool-error-handler.d.ts.map +1 -1
- package/dist/utils/tool-error-handler.js +11 -6
- package/dist/utils/tool-error-handler.js.map +1 -1
- package/dist/utils/url-sanitizer.d.ts +2 -0
- package/dist/utils/url-sanitizer.d.ts.map +1 -0
- package/dist/utils/url-sanitizer.js +12 -0
- package/dist/utils/url-sanitizer.js.map +1 -0
- package/dist/utils/url-validator.d.ts +1 -3
- package/dist/utils/url-validator.d.ts.map +1 -1
- package/dist/utils/url-validator.js +89 -53
- package/dist/utils/url-validator.js.map +1 -1
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# superFetch MCP Server
|
|
2
2
|
|
|
3
3
|
<img src="docs/logo.png" alt="SuperFetch MCP Logo" width="200">
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@j0hanz/superfetch) [](https://www.npmjs.com/package/@j0hanz/superfetch) [](https://nodejs.org/) [](https://www.typescriptlang.org/)
|
|
6
6
|
|
|
7
7
|
## One-Click Install
|
|
8
8
|
|
|
@@ -10,71 +10,64 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://cursor.com/install-mcp?name=superfetch&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovc3VwZXJmZXRjaEBsYXRlc3QiLCItLXN0ZGlvIl19)
|
|
12
12
|
|
|
13
|
-
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that fetches, extracts
|
|
13
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that fetches web pages, extracts readable content with Mozilla Readability, and returns AI-friendly JSONL or Markdown.
|
|
14
14
|
|
|
15
|
-
[Quick Start](#quick-start)
|
|
15
|
+
[Quick Start](#quick-start) | [How to Choose a Tool](#how-to-choose-a-tool) | [Tools](#available-tools) | [Resources](#resources) | [Configuration](#configuration) | [Security](#security) | [Development](#development)
|
|
16
16
|
|
|
17
|
-
>
|
|
17
|
+
> **Published to [MCP Registry](https://registry.modelcontextprotocol.io/)** - Search for `io.github.j0hanz/superfetch`
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
> [!CAUTION]
|
|
22
22
|
> 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.
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Features
|
|
25
25
|
|
|
26
|
-
| Feature
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
26
|
+
| Feature | Description |
|
|
27
|
+
| ------------------ | ------------------------------------------------------------------------- |
|
|
28
|
+
| Smart extraction | Mozilla Readability removes ads, navigation, and boilerplate when enabled |
|
|
29
|
+
| JSONL + Markdown | JSONL semantic blocks or clean Markdown with frontmatter |
|
|
30
|
+
| Structured blocks | Headings, paragraphs, lists, code, tables, images, blockquotes |
|
|
31
|
+
| Built-in caching | In-memory cache with TTL, max keys, and resource subscriptions |
|
|
32
|
+
| Resilient fetching | Redirect handling plus retry with exponential backoff + jitter |
|
|
33
|
+
| Security first | URL validation, SSRF/DNS/IP blocklists, header sanitization |
|
|
34
|
+
| HTTP mode | API key auth, session management, rate limiting, CORS |
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## How to Choose a Tool
|
|
39
39
|
|
|
40
|
-
Use this guide to select the right tool for your web content extraction needs
|
|
40
|
+
Use this guide to select the right tool for your web content extraction needs.
|
|
41
41
|
|
|
42
42
|
### Decision Tree
|
|
43
43
|
|
|
44
44
|
```text
|
|
45
45
|
Need web content for AI?
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
│ └─ Need links only → fetch-links
|
|
50
|
-
└─ Multiple URLs?
|
|
51
|
-
└─ Use fetch-urls (batch processing)
|
|
46
|
+
- Want structured JSONL blocks -> fetch-url (format: jsonl)
|
|
47
|
+
- Want clean Markdown -> fetch-markdown
|
|
48
|
+
- Want Markdown but also need contentBlocks count -> fetch-url (format: markdown)
|
|
52
49
|
```
|
|
53
50
|
|
|
54
51
|
### Quick Reference Table
|
|
55
52
|
|
|
56
|
-
| Tool | Best For
|
|
57
|
-
| ---------------- |
|
|
58
|
-
| `fetch-url` | Single page
|
|
59
|
-
| `fetch-markdown` | Single page
|
|
60
|
-
| `fetch-links` | Link discovery & classification | URL array with types | Sitemap building, finding related pages |
|
|
61
|
-
| `fetch-urls` | Batch processing multiple pages | Multiple JSONL/Markdown | Comparing pages, bulk extraction |
|
|
53
|
+
| Tool | Best For | Output Format | Use When |
|
|
54
|
+
| ---------------- | ---------------------------------- | -------------------------------- | ----------------------------------------- |
|
|
55
|
+
| `fetch-url` | Single page with structured blocks | JSONL (or Markdown via `format`) | RAG pipelines, content parsing, analytics |
|
|
56
|
+
| `fetch-markdown` | Single page in readable format | Markdown + frontmatter | Documentation, summaries, human review |
|
|
62
57
|
|
|
63
58
|
### Common Use Cases
|
|
64
59
|
|
|
65
60
|
| Task | Recommended Tool | Why |
|
|
66
61
|
| ------------------------ | ---------------------------------------- | ---------------------------------------------------- |
|
|
67
62
|
| Parse a blog post for AI | `fetch-url` | Returns semantic blocks (headings, paragraphs, code) |
|
|
68
|
-
| Generate documentation | `fetch-markdown` | Clean markdown with
|
|
69
|
-
| Build a sitemap | `fetch-links` | Extracts and classifies all links |
|
|
70
|
-
| Compare multiple docs | `fetch-urls` | Parallel fetching with concurrency control |
|
|
63
|
+
| Generate documentation | `fetch-markdown` | Clean markdown with frontmatter |
|
|
71
64
|
| Extract article for RAG | `fetch-url` + `extractMainContent: true` | Removes ads/nav, keeps main content |
|
|
72
65
|
|
|
73
66
|
---
|
|
74
67
|
|
|
75
68
|
## Quick Start
|
|
76
69
|
|
|
77
|
-
Add superFetch to your MCP client configuration
|
|
70
|
+
Add superFetch to your MCP client configuration - no installation required.
|
|
78
71
|
|
|
79
72
|
### Claude Desktop
|
|
80
73
|
|
|
@@ -108,25 +101,8 @@ Add to `.vscode/mcp.json` in your workspace:
|
|
|
108
101
|
|
|
109
102
|
### With Custom Configuration
|
|
110
103
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
```json
|
|
114
|
-
{
|
|
115
|
-
"servers": {
|
|
116
|
-
"superFetch": {
|
|
117
|
-
"command": "npx",
|
|
118
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
119
|
-
"env": {
|
|
120
|
-
"CACHE_TTL": "7200",
|
|
121
|
-
"LOG_LEVEL": "debug",
|
|
122
|
-
"FETCH_TIMEOUT": "60000"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
See [Configuration](#configuration) section below for all available options and presets.
|
|
104
|
+
Add environment variables in your MCP client config under `env`.
|
|
105
|
+
See [Configuration](#configuration) or `CONFIGURATION.md` for all available options and presets.
|
|
130
106
|
|
|
131
107
|
### Cursor
|
|
132
108
|
|
|
@@ -146,7 +122,7 @@ See [Configuration](#configuration) section below for all available options and
|
|
|
146
122
|
}
|
|
147
123
|
```
|
|
148
124
|
|
|
149
|
-
> **Tip
|
|
125
|
+
> **Tip (Windows):** If you encounter issues, try: `cmd /c "npx -y @j0hanz/superfetch@latest --stdio"`
|
|
150
126
|
|
|
151
127
|
<details>
|
|
152
128
|
<summary><strong>Codex IDE</strong></summary>
|
|
@@ -161,16 +137,9 @@ command = "npx"
|
|
|
161
137
|
args = ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
162
138
|
```
|
|
163
139
|
|
|
164
|
-
**With Environment Variables:**
|
|
140
|
+
**With Environment Variables:** See `CONFIGURATION.md` for examples.
|
|
165
141
|
|
|
166
|
-
|
|
167
|
-
[mcp_servers.superfetch]
|
|
168
|
-
command = "npx"
|
|
169
|
-
args = ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
170
|
-
env = { CACHE_TTL = "7200", LOG_LEVEL = "debug", FETCH_TIMEOUT = "60000" }
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
> **Access config file:** Click the gear icon → "Codex Settings > Open config.toml"
|
|
142
|
+
> **Access config file:** Click the gear icon -> "Codex Settings > Open config.toml"
|
|
174
143
|
>
|
|
175
144
|
> **Documentation:** [Codex MCP Guide](https://codex.com/docs/mcp)
|
|
176
145
|
|
|
@@ -261,7 +230,7 @@ npm install -g @j0hanz/superfetch
|
|
|
261
230
|
# Run in stdio mode
|
|
262
231
|
superfetch --stdio
|
|
263
232
|
|
|
264
|
-
# Run HTTP server
|
|
233
|
+
# Run HTTP server (requires API_KEY)
|
|
265
234
|
superfetch
|
|
266
235
|
```
|
|
267
236
|
|
|
@@ -276,24 +245,6 @@ npm run build
|
|
|
276
245
|
|
|
277
246
|
### Running the Server
|
|
278
247
|
|
|
279
|
-
<details>
|
|
280
|
-
<summary><strong>HTTP Mode</strong> (default)</summary>
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# Development with hot reload
|
|
284
|
-
npm run dev
|
|
285
|
-
|
|
286
|
-
# Production
|
|
287
|
-
npm start
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
Server runs at `http://127.0.0.1:3000`:
|
|
291
|
-
|
|
292
|
-
- Health check: `GET /health`
|
|
293
|
-
- MCP endpoint: `POST /mcp`
|
|
294
|
-
|
|
295
|
-
</details>
|
|
296
|
-
|
|
297
248
|
<details>
|
|
298
249
|
<summary><strong>stdio Mode</strong> (direct MCP integration)</summary>
|
|
299
250
|
|
|
@@ -303,433 +254,199 @@ node dist/index.js --stdio
|
|
|
303
254
|
|
|
304
255
|
</details>
|
|
305
256
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
## Available Tools
|
|
309
|
-
|
|
310
|
-
> **Note:** If extracted content exceeds `MAX_INLINE_CONTENT_CHARS`, the tool response includes a `resourceUri` and a `resource_link` content block instead of embedding the full text.
|
|
311
|
-
|
|
312
|
-
### `fetch-url`
|
|
313
|
-
|
|
314
|
-
Fetches a webpage and converts it to AI-readable JSONL format with semantic content blocks.
|
|
315
|
-
|
|
316
|
-
| Parameter | Type | Default | Description |
|
|
317
|
-
| -------------------- | ------- | ---------- | -------------------------------------------- |
|
|
318
|
-
| `url` | string | _required_ | URL to fetch |
|
|
319
|
-
| `extractMainContent` | boolean | `true` | Use Readability to extract main content |
|
|
320
|
-
| `includeMetadata` | boolean | `true` | Include page metadata (title, description) |
|
|
321
|
-
| `maxContentLength` | number | – | Maximum content length in characters |
|
|
322
|
-
| `customHeaders` | object | – | Custom HTTP headers for the request |
|
|
323
|
-
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
|
|
324
|
-
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
257
|
+
<details>
|
|
258
|
+
<summary><strong>HTTP Mode</strong> (default)</summary>
|
|
325
259
|
|
|
326
|
-
|
|
260
|
+
HTTP mode requires `API_KEY` and only binds to loopback addresses unless `ALLOW_REMOTE=true`.
|
|
327
261
|
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
"title": "Example Article",
|
|
332
|
-
"fetchedAt": "2025-12-11T10:30:00.000Z",
|
|
333
|
-
"contentBlocks": [
|
|
334
|
-
{
|
|
335
|
-
"type": "metadata",
|
|
336
|
-
"title": "Example Article",
|
|
337
|
-
"description": "A sample article"
|
|
338
|
-
},
|
|
339
|
-
{ "type": "heading", "level": 1, "text": "Introduction" },
|
|
340
|
-
{
|
|
341
|
-
"type": "paragraph",
|
|
342
|
-
"text": "This is the main content of the article..."
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
"type": "code",
|
|
346
|
-
"language": "javascript",
|
|
347
|
-
"content": "console.log('Hello');"
|
|
348
|
-
}
|
|
349
|
-
],
|
|
350
|
-
"cached": false
|
|
351
|
-
}
|
|
262
|
+
```bash
|
|
263
|
+
API_KEY=supersecret npx -y @j0hanz/superfetch@latest
|
|
264
|
+
# Server runs at http://127.0.0.1:3000
|
|
352
265
|
```
|
|
353
266
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
Extracts hyperlinks from a webpage with classification. Supports filtering, image links, and link limits.
|
|
357
|
-
|
|
358
|
-
| Parameter | Type | Default | Description |
|
|
359
|
-
| ----------------- | ------- | ---------- | -------------------------------------------- |
|
|
360
|
-
| `url` | string | _required_ | URL to extract links from |
|
|
361
|
-
| `includeExternal` | boolean | `true` | Include external links |
|
|
362
|
-
| `includeInternal` | boolean | `true` | Include internal links |
|
|
363
|
-
| `includeImages` | boolean | `false` | Include image links (img src attributes) |
|
|
364
|
-
| `maxLinks` | number | – | Maximum number of links to return (1-1000) |
|
|
365
|
-
| `filterPattern` | string | – | Regex pattern to filter links (matches href) |
|
|
366
|
-
| `customHeaders` | object | – | Custom HTTP headers for the request |
|
|
367
|
-
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
|
|
368
|
-
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
267
|
+
**Windows (PowerShell):**
|
|
369
268
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
{
|
|
374
|
-
"url": "https://example.com/",
|
|
375
|
-
"linkCount": 15,
|
|
376
|
-
"links": [
|
|
377
|
-
{
|
|
378
|
-
"href": "https://example.com/about",
|
|
379
|
-
"text": "About Us",
|
|
380
|
-
"type": "internal"
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
"href": "https://github.com/example",
|
|
384
|
-
"text": "GitHub",
|
|
385
|
-
"type": "external"
|
|
386
|
-
},
|
|
387
|
-
{ "href": "https://example.com/logo.png", "text": "", "type": "image" }
|
|
388
|
-
],
|
|
389
|
-
"cached": false,
|
|
390
|
-
"truncated": false
|
|
391
|
-
}
|
|
269
|
+
```powershell
|
|
270
|
+
$env:API_KEY = "supersecret"
|
|
271
|
+
npx -y @j0hanz/superfetch@latest
|
|
392
272
|
```
|
|
393
273
|
|
|
394
|
-
|
|
274
|
+
Endpoints (all require `Authorization: Bearer <API_KEY>` or `X-API-Key: <API_KEY>`):
|
|
395
275
|
|
|
396
|
-
|
|
276
|
+
- `GET /health`
|
|
277
|
+
- `POST /mcp`
|
|
278
|
+
- `GET /mcp` (SSE stream)
|
|
279
|
+
- `DELETE /mcp`
|
|
280
|
+
- `GET /mcp/downloads/:namespace/:hash`
|
|
397
281
|
|
|
398
|
-
|
|
399
|
-
| -------------------- | ------- | ---------- | -------------------------------------------- |
|
|
400
|
-
| `url` | string | _required_ | URL to fetch |
|
|
401
|
-
| `extractMainContent` | boolean | `true` | Extract main content only |
|
|
402
|
-
| `includeMetadata` | boolean | `true` | Include YAML frontmatter |
|
|
403
|
-
| `maxContentLength` | number | – | Maximum content length in characters |
|
|
404
|
-
| `generateToc` | boolean | `false` | Generate table of contents from headings |
|
|
405
|
-
| `customHeaders` | object | – | Custom HTTP headers for the request |
|
|
406
|
-
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
|
|
407
|
-
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
408
|
-
|
|
409
|
-
**Example Response:**
|
|
410
|
-
|
|
411
|
-
````json
|
|
412
|
-
{
|
|
413
|
-
"url": "https://example.com/docs",
|
|
414
|
-
"title": "Documentation",
|
|
415
|
-
"fetchedAt": "2025-12-11T10:30:00.000Z",
|
|
416
|
-
"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```",
|
|
417
|
-
"toc": [
|
|
418
|
-
{ "level": 1, "text": "Getting Started", "slug": "getting-started" },
|
|
419
|
-
{ "level": 2, "text": "Installation", "slug": "installation" }
|
|
420
|
-
],
|
|
421
|
-
"cached": false,
|
|
422
|
-
"truncated": false
|
|
423
|
-
}
|
|
424
|
-
````
|
|
425
|
-
|
|
426
|
-
### `fetch-urls` (Batch)
|
|
427
|
-
|
|
428
|
-
Fetches multiple URLs in parallel with concurrency control. Ideal for comparing content or processing multiple pages efficiently.
|
|
429
|
-
|
|
430
|
-
| Parameter | Type | Default | Description |
|
|
431
|
-
| -------------------- | -------- | ---------- | -------------------------------------------- |
|
|
432
|
-
| `urls` | string[] | _required_ | Array of URLs to fetch (1-10 URLs) |
|
|
433
|
-
| `extractMainContent` | boolean | `true` | Use Readability to extract main content |
|
|
434
|
-
| `includeMetadata` | boolean | `true` | Include page metadata |
|
|
435
|
-
| `maxContentLength` | number | – | Maximum content length per URL in characters |
|
|
436
|
-
| `format` | string | `'jsonl'` | Output format: `'jsonl'` or `'markdown'` |
|
|
437
|
-
| `concurrency` | number | `3` | Maximum concurrent requests (1-5) |
|
|
438
|
-
| `continueOnError` | boolean | `true` | Continue processing if some URLs fail |
|
|
439
|
-
| `customHeaders` | object | – | Custom HTTP headers for all requests |
|
|
440
|
-
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-60000) |
|
|
441
|
-
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
442
|
-
|
|
443
|
-
**Example Output:**
|
|
444
|
-
|
|
445
|
-
```json
|
|
446
|
-
{
|
|
447
|
-
"results": [
|
|
448
|
-
{
|
|
449
|
-
"url": "https://example.com",
|
|
450
|
-
"success": true,
|
|
451
|
-
"title": "Example",
|
|
452
|
-
"content": "...",
|
|
453
|
-
"cached": false
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
"url": "https://example.org",
|
|
457
|
-
"success": true,
|
|
458
|
-
"title": "Example Org",
|
|
459
|
-
"content": "...",
|
|
460
|
-
"cached": false
|
|
461
|
-
}
|
|
462
|
-
],
|
|
463
|
-
"summary": {
|
|
464
|
-
"total": 2,
|
|
465
|
-
"successful": 2,
|
|
466
|
-
"failed": 0,
|
|
467
|
-
"cached": 0,
|
|
468
|
-
"totalContentBlocks": 15
|
|
469
|
-
},
|
|
470
|
-
"fetchedAt": "2024-12-11T10:30:00.000Z"
|
|
471
|
-
}
|
|
472
|
-
```
|
|
282
|
+
Sessions are managed via the `mcp-session-id` header (see [HTTP Mode Details](#http-mode-details)).
|
|
473
283
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
| URI | Description |
|
|
477
|
-
| --------------------- | --------------------------------------------------- |
|
|
478
|
-
| `superfetch://stats` | Server statistics and cache metrics |
|
|
479
|
-
| `superfetch://health` | Real-time server health and dependency status |
|
|
480
|
-
| Dynamic resources | Cached content available via resource subscriptions |
|
|
284
|
+
</details>
|
|
481
285
|
|
|
482
286
|
---
|
|
483
287
|
|
|
484
|
-
##
|
|
485
|
-
|
|
486
|
-
### Configuration Presets
|
|
487
|
-
|
|
488
|
-
<details open>
|
|
489
|
-
<summary><strong>Default (Recommended)</strong> — No configuration needed</summary>
|
|
490
|
-
|
|
491
|
-
```json
|
|
492
|
-
{
|
|
493
|
-
"servers": {
|
|
494
|
-
"superFetch": {
|
|
495
|
-
"command": "npx",
|
|
496
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
</details>
|
|
288
|
+
## Available Tools
|
|
503
289
|
|
|
504
|
-
|
|
505
|
-
<summary><strong>Debug Mode</strong> — Verbose logging and no cache</summary>
|
|
290
|
+
### Tool Response Notes
|
|
506
291
|
|
|
507
|
-
|
|
292
|
+
Both tools return:
|
|
508
293
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
515
|
-
"env": {
|
|
516
|
-
"LOG_LEVEL": "debug",
|
|
517
|
-
"CACHE_ENABLED": "false"
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
```
|
|
294
|
+
- `structuredContent` for machine-readable fields (includes `contentSize`, `cached`, and optional `resourceUri`/`resourceMimeType`/`truncated`)
|
|
295
|
+
- `content` blocks that include:
|
|
296
|
+
- a `text` block containing JSON of `structuredContent`
|
|
297
|
+
- in stdio mode, a `resource` block with a `file:///...` URI containing the full content
|
|
298
|
+
- in HTTP mode, a `resource` block when inline content is available; large payloads include a `resource_link` block when cache is enabled
|
|
523
299
|
|
|
524
|
-
|
|
300
|
+
If content exceeds `MAX_INLINE_CONTENT_CHARS` and cache is disabled, the server truncates output and appends `...[truncated]`.
|
|
525
301
|
|
|
526
|
-
|
|
527
|
-
{
|
|
528
|
-
"mcpServers": {
|
|
529
|
-
"superFetch": {
|
|
530
|
-
"command": "npx",
|
|
531
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
532
|
-
"env": {
|
|
533
|
-
"LOG_LEVEL": "debug",
|
|
534
|
-
"CACHE_ENABLED": "false"
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
```
|
|
302
|
+
---
|
|
540
303
|
|
|
541
|
-
|
|
304
|
+
### `fetch-url`
|
|
542
305
|
|
|
543
|
-
|
|
544
|
-
{
|
|
545
|
-
"mcpServers": {
|
|
546
|
-
"superFetch": {
|
|
547
|
-
"command": "npx",
|
|
548
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
549
|
-
"env": {
|
|
550
|
-
"LOG_LEVEL": "debug",
|
|
551
|
-
"CACHE_ENABLED": "false"
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
```
|
|
306
|
+
Fetches a webpage and converts it to AI-readable JSONL format with semantic content blocks. You can also request Markdown with `format: "markdown"`.
|
|
557
307
|
|
|
558
|
-
|
|
308
|
+
| Parameter | Type | Default | Description |
|
|
309
|
+
| -------------------- | --------------------- | --------- | --------------------------------------------- |
|
|
310
|
+
| `url` | string | required | URL to fetch |
|
|
311
|
+
| `format` | "jsonl" \| "markdown" | `"jsonl"` | Output format |
|
|
312
|
+
| `extractMainContent` | boolean | `true` | Use Readability to extract main content |
|
|
313
|
+
| `includeMetadata` | boolean | `true` | Include page metadata |
|
|
314
|
+
| `maxContentLength` | number | - | Maximum content length in characters |
|
|
315
|
+
| `customHeaders` | object | - | Custom HTTP headers (sanitized) |
|
|
316
|
+
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-120000) |
|
|
317
|
+
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
559
318
|
|
|
560
|
-
|
|
561
|
-
<summary><strong>Performance Mode</strong> — Aggressive caching for speed</summary>
|
|
319
|
+
**Example `structuredContent`:**
|
|
562
320
|
|
|
563
321
|
```json
|
|
564
322
|
{
|
|
565
|
-
"
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
323
|
+
"url": "https://example.com/article",
|
|
324
|
+
"title": "Example Article",
|
|
325
|
+
"contentBlocks": 42,
|
|
326
|
+
"fetchedAt": "2025-12-11T10:30:00.000Z",
|
|
327
|
+
"format": "jsonl",
|
|
328
|
+
"contentSize": 12345,
|
|
329
|
+
"cached": false,
|
|
330
|
+
"content": "{\"type\":\"metadata\",\"title\":\"Example Article\",\"url\":\"https://example.com/article\"}\n{\"type\":\"heading\",\"level\":1,\"text\":\"Introduction\"}"
|
|
576
331
|
}
|
|
577
332
|
```
|
|
578
333
|
|
|
579
|
-
|
|
334
|
+
---
|
|
580
335
|
|
|
581
|
-
|
|
582
|
-
<summary><strong>Custom User Agent</strong> — For sites that block bots</summary>
|
|
336
|
+
### `fetch-markdown`
|
|
583
337
|
|
|
584
|
-
|
|
585
|
-
{
|
|
586
|
-
"servers": {
|
|
587
|
-
"superFetch": {
|
|
588
|
-
"command": "npx",
|
|
589
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
590
|
-
"env": {
|
|
591
|
-
"USER_AGENT": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
```
|
|
338
|
+
Fetches a webpage and converts it to clean Markdown with optional frontmatter.
|
|
597
339
|
|
|
598
|
-
|
|
340
|
+
| Parameter | Type | Default | Description |
|
|
341
|
+
| -------------------- | ------- | -------- | --------------------------------------------- |
|
|
342
|
+
| `url` | string | required | URL to fetch |
|
|
343
|
+
| `extractMainContent` | boolean | `true` | Extract main content only |
|
|
344
|
+
| `includeMetadata` | boolean | `true` | Include YAML frontmatter |
|
|
345
|
+
| `maxContentLength` | number | - | Maximum content length in characters |
|
|
346
|
+
| `customHeaders` | object | - | Custom HTTP headers (sanitized) |
|
|
347
|
+
| `timeout` | number | `30000` | Request timeout in milliseconds (1000-120000) |
|
|
348
|
+
| `retries` | number | `3` | Number of retry attempts (1-10) |
|
|
599
349
|
|
|
600
|
-
|
|
601
|
-
<summary><strong>Slow Networks / CI/CD</strong> — Extended timeouts</summary>
|
|
350
|
+
**Example `structuredContent`:**
|
|
602
351
|
|
|
603
352
|
```json
|
|
604
353
|
{
|
|
605
|
-
"
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
354
|
+
"url": "https://example.com/docs",
|
|
355
|
+
"title": "Documentation",
|
|
356
|
+
"fetchedAt": "2025-12-11T10:30:00.000Z",
|
|
357
|
+
"markdown": "---\ntitle: Documentation\nsource: \"https://example.com/docs\"\n---\n\n# Getting Started\n\nWelcome...",
|
|
358
|
+
"contentSize": 9876,
|
|
359
|
+
"cached": false,
|
|
360
|
+
"truncated": false,
|
|
361
|
+
"file": {
|
|
362
|
+
"downloadUrl": "/mcp/downloads/markdown/abc123def456",
|
|
363
|
+
"fileName": "documentation.md",
|
|
364
|
+
"expiresAt": "2025-12-11T11:30:00.000Z"
|
|
615
365
|
}
|
|
616
366
|
}
|
|
617
367
|
```
|
|
618
368
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
### Available Environment Variables
|
|
622
|
-
|
|
623
|
-
Configure SuperFetch behavior by adding environment variables to your MCP client configuration's `env` property.
|
|
624
|
-
|
|
625
|
-
#### 🌐 Fetcher Settings
|
|
369
|
+
`file` is included only in HTTP mode when content is cached and too large to inline.
|
|
626
370
|
|
|
627
|
-
|
|
628
|
-
| --------------- | -------------------- | -------------------- | --------------------------------------------------------------- |
|
|
629
|
-
| `FETCH_TIMEOUT` | `30000` | `5000`-`120000` | Request timeout in milliseconds (5s-2min) |
|
|
630
|
-
| `USER_AGENT` | `superFetch-MCP/1.0` | Any valid user agent | Custom user agent for requests (useful for sites blocking bots) |
|
|
371
|
+
---
|
|
631
372
|
|
|
632
|
-
|
|
373
|
+
### Large Content Handling
|
|
633
374
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
375
|
+
- Inline limit is configurable via `MAX_INLINE_CONTENT_CHARS` (see `CONFIGURATION.md`).
|
|
376
|
+
- If content exceeds the limit and cache is enabled, responses include `resourceUri` and a `resource_link` block.
|
|
377
|
+
- If cache is disabled, content is truncated with `...[truncated]`.
|
|
378
|
+
- Use `maxContentLength` per request to enforce a lower limit.
|
|
379
|
+
- Upstream fetch size is capped at 10 MB of HTML; larger responses fail.
|
|
639
380
|
|
|
640
|
-
|
|
381
|
+
---
|
|
641
382
|
|
|
642
|
-
|
|
643
|
-
| -------------------------- | ------- | --------------- | --------------------------------------------------------------- |
|
|
644
|
-
| `MAX_INLINE_CONTENT_CHARS` | `20000` | `1000`-`200000` | Inline content limit before returning a `resource_link` instead |
|
|
383
|
+
## Resources
|
|
645
384
|
|
|
646
|
-
|
|
385
|
+
| URI | Description |
|
|
386
|
+
| ------------------------------------------ | -------------------------------------------------------------------------- |
|
|
387
|
+
| `superfetch://health` | Real-time server health and memory checks |
|
|
388
|
+
| `superfetch://stats` | Server stats and cache metrics |
|
|
389
|
+
| `superfetch://cache/list` | List cached entries and their resource URIs |
|
|
390
|
+
| `superfetch://cache/{namespace}/{urlHash}` | Cached content entry (`namespace`: `url`, `markdown`; `links` is reserved) |
|
|
647
391
|
|
|
648
|
-
|
|
649
|
-
| ---------------- | ------- | ----------------------------------- | -------------------------- |
|
|
650
|
-
| `LOG_LEVEL` | `info` | `debug` / `info` / `warn` / `error` | Logging verbosity level |
|
|
651
|
-
| `ENABLE_LOGGING` | `true` | `true` / `false` | Enable/disable all logging |
|
|
392
|
+
Resource subscriptions notify clients when cache entries update.
|
|
652
393
|
|
|
653
|
-
|
|
394
|
+
---
|
|
654
395
|
|
|
655
|
-
|
|
656
|
-
| ---------------------- | ------- | ---------------- | -------------------------------------------------- |
|
|
657
|
-
| `EXTRACT_MAIN_CONTENT` | `true` | `true` / `false` | Use Mozilla Readability to extract main content |
|
|
658
|
-
| `INCLUDE_METADATA` | `true` | `true` / `false` | Include page metadata (title, description, author) |
|
|
396
|
+
## Download Endpoint (HTTP Mode)
|
|
659
397
|
|
|
660
|
-
|
|
398
|
+
When running in HTTP mode, cached content can be downloaded directly. Downloads are available only when cache is enabled.
|
|
661
399
|
|
|
662
|
-
|
|
663
|
-
| -------------- | ------- | -------------------------------------------------------- |
|
|
664
|
-
| `API_KEY` | - | API Key for HTTP authentication (required for HTTP mode) |
|
|
665
|
-
| `ALLOW_REMOTE` | `false` | Allow binding to non-loopback interfaces |
|
|
400
|
+
### Endpoint
|
|
666
401
|
|
|
667
|
-
|
|
402
|
+
```text
|
|
403
|
+
GET /mcp/downloads/:namespace/:hash
|
|
404
|
+
```
|
|
668
405
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
| `RATE_LIMIT_ENABLED` | `true` | `true` / `false` | Enable/disable HTTP rate limiting |
|
|
672
|
-
| `RATE_LIMIT_MAX` | `100` | `1`-`10000` | Max requests per window per IP |
|
|
673
|
-
| `RATE_LIMIT_WINDOW_MS` | `60000` | `1000`-`3600000` | Rate limit window in milliseconds |
|
|
674
|
-
| `RATE_LIMIT_CLEANUP_MS` | `60000` | `10000`-`3600000` | Cleanup interval for limiter entries |
|
|
406
|
+
- `namespace`: `markdown` or `url`
|
|
407
|
+
- Auth required (`Authorization: Bearer <API_KEY>` or `X-API-Key: <API_KEY>`)
|
|
675
408
|
|
|
676
|
-
###
|
|
409
|
+
### Response Headers
|
|
677
410
|
|
|
678
|
-
|
|
679
|
-
|
|
411
|
+
| Header | Value |
|
|
412
|
+
| --------------------- | ----------------------------------------------------------------------- |
|
|
413
|
+
| `Content-Type` | `text/markdown; charset=utf-8` or `application/x-ndjson; charset=utf-8` |
|
|
414
|
+
| `Content-Disposition` | `attachment; filename="<name>"` |
|
|
415
|
+
| `Cache-Control` | `private, max-age=<CACHE_TTL>` |
|
|
680
416
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
#### Start HTTP Server
|
|
417
|
+
### Example Usage
|
|
684
418
|
|
|
685
419
|
```bash
|
|
686
|
-
|
|
687
|
-
|
|
420
|
+
curl -H "Authorization: Bearer $API_KEY" \
|
|
421
|
+
http://localhost:3000/mcp/downloads/markdown/abc123.def456 \
|
|
422
|
+
-o article.md
|
|
688
423
|
```
|
|
689
424
|
|
|
690
|
-
|
|
425
|
+
### Error Responses
|
|
691
426
|
|
|
692
|
-
|
|
|
693
|
-
|
|
|
694
|
-
|
|
|
695
|
-
|
|
|
696
|
-
|
|
|
697
|
-
| `CORS_ALLOW_ALL` | `false` | Allow all CORS origins (dev only, security risk) |
|
|
698
|
-
| `SESSION_TTL_MS` | `1800000` | Session time-to-live in milliseconds (30 mins) |
|
|
699
|
-
| `SESSION_INIT_TIMEOUT_MS` | `10000` | Time allowed for session initialization (ms) |
|
|
700
|
-
| `MAX_SESSIONS` | `200` | Maximum number of active sessions |
|
|
427
|
+
| Status | Code | Description |
|
|
428
|
+
| ------ | --------------------- | -------------------------------- |
|
|
429
|
+
| 400 | `BAD_REQUEST` | Invalid namespace or hash format |
|
|
430
|
+
| 404 | `NOT_FOUND` | Content not found or expired |
|
|
431
|
+
| 503 | `SERVICE_UNAVAILABLE` | Download service disabled |
|
|
701
432
|
|
|
702
|
-
|
|
433
|
+
---
|
|
703
434
|
|
|
704
|
-
|
|
705
|
-
{
|
|
706
|
-
"servers": {
|
|
707
|
-
"superFetch": {
|
|
708
|
-
"type": "http",
|
|
709
|
-
"url": "http://127.0.0.1:3000/mcp"
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
```
|
|
435
|
+
## Configuration
|
|
714
436
|
|
|
715
|
-
|
|
437
|
+
Configuration details live in `CONFIGURATION.md`, including all environment variables, defaults, ranges, presets, and dev-only flags.
|
|
716
438
|
|
|
717
|
-
|
|
718
|
-
PORT=8080 HOST=0.0.0.0 ALLOWED_ORIGINS=https://myapp.com npx @j0hanz/superfetch@latest
|
|
719
|
-
```
|
|
439
|
+
---
|
|
720
440
|
|
|
721
|
-
|
|
441
|
+
## HTTP Mode Details
|
|
442
|
+
|
|
443
|
+
HTTP mode uses the MCP Streamable HTTP transport. The workflow is:
|
|
722
444
|
|
|
723
|
-
|
|
445
|
+
1. `POST /mcp` with an `initialize` request and **no** `mcp-session-id` header.
|
|
446
|
+
2. The server returns `mcp-session-id` in the response headers.
|
|
447
|
+
3. Use that header for subsequent `POST /mcp`, `GET /mcp`, and `DELETE /mcp` requests.
|
|
724
448
|
|
|
725
|
-
|
|
726
|
-
| ---------------------------- | -------------------------------------------------------------- |
|
|
727
|
-
| 🐛 **Debugging issues** | `LOG_LEVEL=debug`, `CACHE_ENABLED=false` |
|
|
728
|
-
| 🚀 **Maximum performance** | `CACHE_TTL=7200`, `CACHE_MAX_KEYS=500`, `LOG_LEVEL=error` |
|
|
729
|
-
| 🌐 **Slow target sites** | `FETCH_TIMEOUT=60000` |
|
|
730
|
-
| 🤖 **Bypass bot detection** | `USER_AGENT="Mozilla/5.0 (compatible; MyBot/1.0)"` |
|
|
731
|
-
| 🔄 **CI/CD (always fresh)** | `CACHE_ENABLED=false`, `FETCH_TIMEOUT=60000`, `LOG_LEVEL=warn` |
|
|
732
|
-
| 📊 **Production monitoring** | `LOG_LEVEL=warn` or `error` |
|
|
449
|
+
If `MAX_SESSIONS` is reached, the server evicts the oldest session when possible, otherwise returns a 503.
|
|
733
450
|
|
|
734
451
|
---
|
|
735
452
|
|
|
@@ -737,15 +454,16 @@ PORT=8080 HOST=0.0.0.0 ALLOWED_ORIGINS=https://myapp.com npx @j0hanz/superfetch@
|
|
|
737
454
|
|
|
738
455
|
JSONL output includes semantic content blocks:
|
|
739
456
|
|
|
740
|
-
| Type
|
|
741
|
-
|
|
|
742
|
-
| `metadata`
|
|
743
|
-
| `heading`
|
|
744
|
-
| `paragraph`
|
|
745
|
-
| `list`
|
|
746
|
-
| `code`
|
|
747
|
-
| `table`
|
|
748
|
-
| `image`
|
|
457
|
+
| Type | Description |
|
|
458
|
+
| ------------ | ---------------------------------------- |
|
|
459
|
+
| `metadata` | Minimal page metadata (type, title, url) |
|
|
460
|
+
| `heading` | Headings (h1-h6) with level indicator |
|
|
461
|
+
| `paragraph` | Text paragraphs |
|
|
462
|
+
| `list` | Ordered/unordered lists |
|
|
463
|
+
| `code` | Code blocks with optional language |
|
|
464
|
+
| `table` | Tables with headers and rows |
|
|
465
|
+
| `image` | Images with src and alt text |
|
|
466
|
+
| `blockquote` | Block quote text |
|
|
749
467
|
|
|
750
468
|
---
|
|
751
469
|
|
|
@@ -753,12 +471,19 @@ JSONL output includes semantic content blocks:
|
|
|
753
471
|
|
|
754
472
|
### SSRF Protection
|
|
755
473
|
|
|
756
|
-
Blocked destinations:
|
|
474
|
+
Blocked destinations include:
|
|
757
475
|
|
|
758
476
|
- Localhost and loopback addresses
|
|
759
477
|
- Private IP ranges (`10.x.x.x`, `172.16-31.x.x`, `192.168.x.x`)
|
|
760
478
|
- Cloud metadata endpoints (AWS, GCP, Azure)
|
|
761
479
|
- IPv6 link-local and unique local addresses
|
|
480
|
+
- Internal suffixes such as `.local` and `.internal`
|
|
481
|
+
|
|
482
|
+
### URL Validation
|
|
483
|
+
|
|
484
|
+
- Only `http` and `https` URLs
|
|
485
|
+
- No embedded credentials in URLs
|
|
486
|
+
- Max URL length: 2048 characters
|
|
762
487
|
|
|
763
488
|
### Header Sanitization
|
|
764
489
|
|
|
@@ -766,21 +491,7 @@ Blocked headers: `host`, `authorization`, `cookie`, `x-forwarded-for`, `x-real-i
|
|
|
766
491
|
|
|
767
492
|
### Rate Limiting
|
|
768
493
|
|
|
769
|
-
|
|
770
|
-
`RATE_LIMIT_WINDOW_MS`.
|
|
771
|
-
|
|
772
|
-
### HTTP Mode Endpoints
|
|
773
|
-
|
|
774
|
-
When running without `--stdio`, the following endpoints are available:
|
|
775
|
-
|
|
776
|
-
| Endpoint | Method | Description |
|
|
777
|
-
| --------- | ------ | --------------------------------------- |
|
|
778
|
-
| `/health` | GET | Health check with uptime and version |
|
|
779
|
-
| `/mcp` | POST | MCP request handling (requires session) |
|
|
780
|
-
| `/mcp` | GET | SSE stream for notifications |
|
|
781
|
-
| `/mcp` | DELETE | Close session |
|
|
782
|
-
|
|
783
|
-
Sessions are managed via `mcp-session-id` header with 30-minute TTL.
|
|
494
|
+
Rate limiting thresholds are configurable via `RATE_LIMIT_MAX` and `RATE_LIMIT_WINDOW_MS` (see `CONFIGURATION.md`).
|
|
784
495
|
|
|
785
496
|
---
|
|
786
497
|
|
|
@@ -807,14 +518,13 @@ Sessions are managed via `mcp-session-id` header with 30-minute TTL.
|
|
|
807
518
|
|
|
808
519
|
| Category | Technology |
|
|
809
520
|
| ------------------ | --------------------------------- |
|
|
810
|
-
| Runtime | Node.js
|
|
521
|
+
| Runtime | Node.js >=20.12 |
|
|
811
522
|
| Language | TypeScript 5.9 |
|
|
812
523
|
| MCP SDK | @modelcontextprotocol/sdk ^1.25.1 |
|
|
813
524
|
| Content Extraction | @mozilla/readability ^0.6.0 |
|
|
814
525
|
| HTML Parsing | Cheerio ^1.1.2, LinkeDOM ^0.18.12 |
|
|
815
526
|
| Markdown | Turndown ^7.2.2 |
|
|
816
|
-
| HTTP | Express ^5.2.1,
|
|
817
|
-
| Caching | node-cache ^5.1.2 |
|
|
527
|
+
| HTTP | Express ^5.2.1, undici ^6.22.0 |
|
|
818
528
|
| Validation | Zod ^3.24.1 |
|
|
819
529
|
|
|
820
530
|
---
|