@j0hanz/superfetch 1.2.0 → 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 +18 -204
- package/dist/config/constants.d.ts +0 -1
- package/dist/config/constants.js +0 -1
- package/dist/config/formatting.d.ts +0 -1
- 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 +1 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -11
- package/dist/config/index.js.map +1 -1
- package/dist/config/types/content.d.ts +0 -1
- package/dist/config/types/content.js +0 -1
- package/dist/config/types/runtime.d.ts +0 -1
- package/dist/config/types/runtime.js +0 -1
- package/dist/config/types/tools.d.ts +0 -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.js +0 -1
- package/dist/http/cors.d.ts +0 -1
- package/dist/http/cors.js +0 -1
- package/dist/http/download-routes.d.ts +1 -2
- package/dist/http/download-routes.d.ts.map +1 -1
- package/dist/http/download-routes.js +0 -1
- package/dist/http/mcp-routes.d.ts +0 -1
- package/dist/http/mcp-routes.js +0 -1
- package/dist/http/mcp-session-helpers.d.ts +0 -1
- package/dist/http/mcp-session-helpers.js +0 -1
- package/dist/http/mcp-session.d.ts +1 -2
- package/dist/http/mcp-session.d.ts.map +1 -1
- package/dist/http/mcp-session.js +0 -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 +0 -1
- package/dist/http/server-middleware.d.ts.map +1 -1
- package/dist/http/server-middleware.js +56 -1
- package/dist/http/server-middleware.js.map +1 -1
- package/dist/http/server.d.ts +0 -1
- package/dist/http/server.js +0 -1
- package/dist/http/session-cleanup.d.ts +0 -1
- package/dist/http/session-cleanup.js +0 -1
- 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 +0 -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.js +0 -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 +1 -2
- package/dist/services/cache.d.ts.map +1 -1
- package/dist/services/cache.js +1 -2
- package/dist/services/context.d.ts +0 -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 +0 -1
- package/dist/services/fetcher/agents.d.ts +0 -1
- package/dist/services/fetcher/agents.js +0 -1
- package/dist/services/fetcher/errors.d.ts +0 -1
- package/dist/services/fetcher/errors.js +0 -1
- package/dist/services/fetcher/interceptors.d.ts +0 -1
- package/dist/services/fetcher/interceptors.js +0 -1
- package/dist/services/fetcher/redirects.d.ts +0 -1
- package/dist/services/fetcher/redirects.js +2 -3
- 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 +0 -1
- package/dist/services/fetcher/retry-policy.js +0 -1
- package/dist/services/fetcher.d.ts +1 -2
- package/dist/services/fetcher.d.ts.map +1 -1
- package/dist/services/fetcher.js +3 -4
- 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 -2
- package/dist/services/parser.d.ts.map +1 -1
- package/dist/services/parser.js +0 -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 +34 -3
- package/dist/tools/handlers/fetch-markdown.tool.js.map +1 -1
- package/dist/tools/handlers/fetch-single.shared.d.ts +5 -3
- package/dist/tools/handlers/fetch-single.shared.d.ts.map +1 -1
- package/dist/tools/handlers/fetch-single.shared.js +8 -4
- 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 +36 -3
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.js +0 -1
- package/dist/tools/schemas.d.ts +29 -30
- package/dist/tools/schemas.js +0 -1
- package/dist/tools/utils/cache-vary.d.ts +0 -1
- package/dist/tools/utils/cache-vary.d.ts.map +1 -1
- package/dist/tools/utils/cache-vary.js +7 -25
- package/dist/tools/utils/cache-vary.js.map +1 -1
- package/dist/tools/utils/common.d.ts +2 -3
- 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 +42 -6
- 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 +11 -18
- package/dist/tools/utils/inline-content.d.ts +0 -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 +8 -1
- package/dist/utils/code-language.d.ts +0 -1
- package/dist/utils/code-language.js +0 -1
- package/dist/utils/content-cleaner.d.ts +0 -1
- package/dist/utils/content-cleaner.js +0 -1
- package/dist/utils/crypto.d.ts +0 -1
- package/dist/utils/crypto.js +0 -1
- package/dist/utils/download-url.d.ts +1 -2
- package/dist/utils/download-url.d.ts.map +1 -1
- package/dist/utils/download-url.js +0 -1
- package/dist/utils/error-utils.d.ts +0 -1
- package/dist/utils/error-utils.js +1 -3
- package/dist/utils/filename-generator.d.ts +0 -1
- package/dist/utils/filename-generator.js +0 -1
- package/dist/utils/header-normalizer.d.ts +0 -1
- package/dist/utils/header-normalizer.js +0 -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 -2
- package/dist/utils/tool-error-handler.d.ts.map +1 -1
- package/dist/utils/tool-error-handler.js +0 -1
- 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 +44 -10
- package/dist/utils/url-validator.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -101,25 +101,8 @@ Add to `.vscode/mcp.json` in your workspace:
|
|
|
101
101
|
|
|
102
102
|
### With Custom Configuration
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```json
|
|
107
|
-
{
|
|
108
|
-
"servers": {
|
|
109
|
-
"superFetch": {
|
|
110
|
-
"command": "npx",
|
|
111
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
112
|
-
"env": {
|
|
113
|
-
"CACHE_TTL": "7200",
|
|
114
|
-
"LOG_LEVEL": "debug",
|
|
115
|
-
"FETCH_TIMEOUT": "60000"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
See [Configuration](#configuration) for all available options.
|
|
104
|
+
Add environment variables in your MCP client config under `env`.
|
|
105
|
+
See [Configuration](#configuration) or `CONFIGURATION.md` for all available options and presets.
|
|
123
106
|
|
|
124
107
|
### Cursor
|
|
125
108
|
|
|
@@ -154,14 +137,7 @@ command = "npx"
|
|
|
154
137
|
args = ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
155
138
|
```
|
|
156
139
|
|
|
157
|
-
**With Environment Variables:**
|
|
158
|
-
|
|
159
|
-
```toml
|
|
160
|
-
[mcp_servers.superfetch]
|
|
161
|
-
command = "npx"
|
|
162
|
-
args = ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
163
|
-
env = { CACHE_TTL = "7200", LOG_LEVEL = "debug", FETCH_TIMEOUT = "60000" }
|
|
164
|
-
```
|
|
140
|
+
**With Environment Variables:** See `CONFIGURATION.md` for examples.
|
|
165
141
|
|
|
166
142
|
> **Access config file:** Click the gear icon -> "Codex Settings > Open config.toml"
|
|
167
143
|
>
|
|
@@ -315,13 +291,13 @@ Sessions are managed via the `mcp-session-id` header (see [HTTP Mode Details](#h
|
|
|
315
291
|
|
|
316
292
|
Both tools return:
|
|
317
293
|
|
|
318
|
-
- `structuredContent` for machine-readable fields
|
|
294
|
+
- `structuredContent` for machine-readable fields (includes `contentSize`, `cached`, and optional `resourceUri`/`resourceMimeType`/`truncated`)
|
|
319
295
|
- `content` blocks that include:
|
|
320
296
|
- a `text` block containing JSON of `structuredContent`
|
|
321
|
-
- a `resource` block with a `file:///...` URI containing the full content
|
|
322
|
-
- a `
|
|
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
|
|
323
299
|
|
|
324
|
-
If content
|
|
300
|
+
If content exceeds `MAX_INLINE_CONTENT_CHARS` and cache is disabled, the server truncates output and appends `...[truncated]`.
|
|
325
301
|
|
|
326
302
|
---
|
|
327
303
|
|
|
@@ -396,21 +372,22 @@ Fetches a webpage and converts it to clean Markdown with optional frontmatter.
|
|
|
396
372
|
|
|
397
373
|
### Large Content Handling
|
|
398
374
|
|
|
399
|
-
- Inline limit
|
|
375
|
+
- Inline limit is configurable via `MAX_INLINE_CONTENT_CHARS` (see `CONFIGURATION.md`).
|
|
400
376
|
- If content exceeds the limit and cache is enabled, responses include `resourceUri` and a `resource_link` block.
|
|
401
377
|
- If cache is disabled, content is truncated with `...[truncated]`.
|
|
402
378
|
- Use `maxContentLength` per request to enforce a lower limit.
|
|
379
|
+
- Upstream fetch size is capped at 10 MB of HTML; larger responses fail.
|
|
403
380
|
|
|
404
381
|
---
|
|
405
382
|
|
|
406
383
|
## Resources
|
|
407
384
|
|
|
408
|
-
| URI | Description
|
|
409
|
-
| ------------------------------------------ |
|
|
410
|
-
| `superfetch://health` | Real-time server health and memory checks
|
|
411
|
-
| `superfetch://stats` | Server stats and cache metrics
|
|
412
|
-
| `superfetch://cache/list` | List cached entries and their resource URIs
|
|
413
|
-
| `superfetch://cache/{namespace}/{urlHash}` | Cached content entry (`namespace`: `url`, `markdown`) |
|
|
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) |
|
|
414
391
|
|
|
415
392
|
Resource subscriptions notify clients when cache entries update.
|
|
416
393
|
|
|
@@ -418,7 +395,7 @@ Resource subscriptions notify clients when cache entries update.
|
|
|
418
395
|
|
|
419
396
|
## Download Endpoint (HTTP Mode)
|
|
420
397
|
|
|
421
|
-
When running in HTTP mode, cached content can be downloaded directly.
|
|
398
|
+
When running in HTTP mode, cached content can be downloaded directly. Downloads are available only when cache is enabled.
|
|
422
399
|
|
|
423
400
|
### Endpoint
|
|
424
401
|
|
|
@@ -457,170 +434,7 @@ curl -H "Authorization: Bearer $API_KEY" \
|
|
|
457
434
|
|
|
458
435
|
## Configuration
|
|
459
436
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
### Fetcher Settings
|
|
463
|
-
|
|
464
|
-
| Variable | Default | Valid Values | Description |
|
|
465
|
-
| --------------- | -------------------- | -------------------- | ------------------------------- |
|
|
466
|
-
| `FETCH_TIMEOUT` | `30000` | `5000`-`120000` | Request timeout in milliseconds |
|
|
467
|
-
| `USER_AGENT` | `superFetch-MCP/1.0` | Any valid user agent | Custom user agent |
|
|
468
|
-
|
|
469
|
-
### Cache Settings
|
|
470
|
-
|
|
471
|
-
| Variable | Default | Valid Values | Description |
|
|
472
|
-
| ---------------- | ------- | ---------------- | ------------------------- |
|
|
473
|
-
| `CACHE_ENABLED` | `true` | `true` / `false` | Enable response caching |
|
|
474
|
-
| `CACHE_TTL` | `3600` | `60`-`86400` | Cache lifetime in seconds |
|
|
475
|
-
| `CACHE_MAX_KEYS` | `100` | `10`-`1000` | Maximum cached entries |
|
|
476
|
-
|
|
477
|
-
### Output Settings
|
|
478
|
-
|
|
479
|
-
| Variable | Default | Valid Values | Description |
|
|
480
|
-
| -------------------------- | ------- | --------------- | ----------------------------------------- |
|
|
481
|
-
| `MAX_INLINE_CONTENT_CHARS` | `20000` | `1000`-`200000` | Inline content limit before resource_link |
|
|
482
|
-
|
|
483
|
-
### Logging Settings
|
|
484
|
-
|
|
485
|
-
| Variable | Default | Valid Values | Description |
|
|
486
|
-
| ---------------- | ------- | ----------------------------------- | ---------------------- |
|
|
487
|
-
| `LOG_LEVEL` | `info` | `debug` / `info` / `warn` / `error` | Logging verbosity |
|
|
488
|
-
| `ENABLE_LOGGING` | `true` | `true` / `false` | Enable/disable logging |
|
|
489
|
-
|
|
490
|
-
### Extraction Settings
|
|
491
|
-
|
|
492
|
-
| Variable | Default | Valid Values | Description |
|
|
493
|
-
| ---------------------- | ------- | ---------------- | --------------------------------------- |
|
|
494
|
-
| `EXTRACT_MAIN_CONTENT` | `true` | `true` / `false` | Use Readability to extract main content |
|
|
495
|
-
| `INCLUDE_METADATA` | `true` | `true` / `false` | Include metadata/frontmatter |
|
|
496
|
-
|
|
497
|
-
### HTTP Server Settings
|
|
498
|
-
|
|
499
|
-
| Variable | Default | Description |
|
|
500
|
-
| ------------------------- | ----------- | -------------------------------------------- |
|
|
501
|
-
| `API_KEY` | - | **Required for HTTP mode** |
|
|
502
|
-
| `HOST` | `127.0.0.1` | HTTP server host |
|
|
503
|
-
| `PORT` | `3000` | HTTP server port |
|
|
504
|
-
| `ALLOW_REMOTE` | `false` | Allow binding to non-loopback interfaces |
|
|
505
|
-
| `TRUST_PROXY` | `false` | Trust proxy headers for client IP resolution |
|
|
506
|
-
| `SESSION_TTL_MS` | `1800000` | Session TTL in milliseconds (30 min) |
|
|
507
|
-
| `SESSION_INIT_TIMEOUT_MS` | `10000` | Time allowed for session initialization |
|
|
508
|
-
| `MAX_SESSIONS` | `200` | Maximum active sessions |
|
|
509
|
-
|
|
510
|
-
### CORS Settings
|
|
511
|
-
|
|
512
|
-
| Variable | Default | Description |
|
|
513
|
-
| ----------------- | ------- | --------------------------------------- |
|
|
514
|
-
| `ALLOWED_ORIGINS` | `[]` | Comma-separated list of allowed origins |
|
|
515
|
-
| `CORS_ALLOW_ALL` | `false` | Allow all origins (dev only) |
|
|
516
|
-
|
|
517
|
-
### Rate Limiting
|
|
518
|
-
|
|
519
|
-
| Variable | Default | Valid Values | Description |
|
|
520
|
-
| ----------------------- | ------- | ----------------- | ------------------------------------ |
|
|
521
|
-
| `RATE_LIMIT_ENABLED` | `true` | `true` / `false` | Enable/disable HTTP rate limiting |
|
|
522
|
-
| `RATE_LIMIT_MAX` | `100` | `1`-`10000` | Max requests per window per IP |
|
|
523
|
-
| `RATE_LIMIT_WINDOW_MS` | `60000` | `1000`-`3600000` | Rate limit window in milliseconds |
|
|
524
|
-
| `RATE_LIMIT_CLEANUP_MS` | `60000` | `10000`-`3600000` | Cleanup interval for limiter entries |
|
|
525
|
-
|
|
526
|
-
### Configuration Presets
|
|
527
|
-
|
|
528
|
-
<details open>
|
|
529
|
-
<summary><strong>Default (Recommended)</strong> - No configuration needed</summary>
|
|
530
|
-
|
|
531
|
-
```json
|
|
532
|
-
{
|
|
533
|
-
"servers": {
|
|
534
|
-
"superFetch": {
|
|
535
|
-
"command": "npx",
|
|
536
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"]
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
</details>
|
|
543
|
-
|
|
544
|
-
<details>
|
|
545
|
-
<summary><strong>Debug Mode</strong> - Verbose logging and no cache</summary>
|
|
546
|
-
|
|
547
|
-
```json
|
|
548
|
-
{
|
|
549
|
-
"servers": {
|
|
550
|
-
"superFetch": {
|
|
551
|
-
"command": "npx",
|
|
552
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
553
|
-
"env": {
|
|
554
|
-
"LOG_LEVEL": "debug",
|
|
555
|
-
"CACHE_ENABLED": "false"
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
</details>
|
|
563
|
-
|
|
564
|
-
<details>
|
|
565
|
-
<summary><strong>Performance Mode</strong> - Aggressive caching for speed</summary>
|
|
566
|
-
|
|
567
|
-
```json
|
|
568
|
-
{
|
|
569
|
-
"servers": {
|
|
570
|
-
"superFetch": {
|
|
571
|
-
"command": "npx",
|
|
572
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
573
|
-
"env": {
|
|
574
|
-
"CACHE_TTL": "7200",
|
|
575
|
-
"CACHE_MAX_KEYS": "500",
|
|
576
|
-
"LOG_LEVEL": "warn"
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
</details>
|
|
584
|
-
|
|
585
|
-
<details>
|
|
586
|
-
<summary><strong>Custom User Agent</strong> - For sites that block bots</summary>
|
|
587
|
-
|
|
588
|
-
```json
|
|
589
|
-
{
|
|
590
|
-
"servers": {
|
|
591
|
-
"superFetch": {
|
|
592
|
-
"command": "npx",
|
|
593
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
594
|
-
"env": {
|
|
595
|
-
"USER_AGENT": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
</details>
|
|
603
|
-
|
|
604
|
-
<details>
|
|
605
|
-
<summary><strong>Slow Networks / CI</strong> - Extended timeouts</summary>
|
|
606
|
-
|
|
607
|
-
```json
|
|
608
|
-
{
|
|
609
|
-
"servers": {
|
|
610
|
-
"superFetch": {
|
|
611
|
-
"command": "npx",
|
|
612
|
-
"args": ["-y", "@j0hanz/superfetch@latest", "--stdio"],
|
|
613
|
-
"env": {
|
|
614
|
-
"FETCH_TIMEOUT": "60000",
|
|
615
|
-
"CACHE_ENABLED": "false",
|
|
616
|
-
"LOG_LEVEL": "warn"
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
</details>
|
|
437
|
+
Configuration details live in `CONFIGURATION.md`, including all environment variables, defaults, ranges, presets, and dev-only flags.
|
|
624
438
|
|
|
625
439
|
---
|
|
626
440
|
|
|
@@ -677,7 +491,7 @@ Blocked headers: `host`, `authorization`, `cookie`, `x-forwarded-for`, `x-real-i
|
|
|
677
491
|
|
|
678
492
|
### Rate Limiting
|
|
679
493
|
|
|
680
|
-
|
|
494
|
+
Rate limiting thresholds are configurable via `RATE_LIMIT_MAX` and `RATE_LIMIT_WINDOW_MS` (see `CONFIGURATION.md`).
|
|
681
495
|
|
|
682
496
|
---
|
|
683
497
|
|
package/dist/config/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/config/formatting.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/config/formatting.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,eAAO,MAAM,UAAU;;4BAEN,MAAM,wBAAkB,MAAM;CAGrC,CAAC;AAEX,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,KAAG,MAA0B,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const LINE_BREAK = '\n';
|
|
2
1
|
export const TRUNCATION_MARKER = '...[truncated]';
|
|
3
2
|
export const CODE_BLOCK = {
|
|
4
3
|
fence: '```',
|
|
@@ -7,5 +6,4 @@ export const CODE_BLOCK = {
|
|
|
7
6
|
},
|
|
8
7
|
};
|
|
9
8
|
export const FRONTMATTER_DELIMITER = '---';
|
|
10
|
-
export const joinLines = (lines) => lines.join(
|
|
11
|
-
//# sourceMappingURL=formatting.js.map
|
|
9
|
+
export const joinLines = (lines) => lines.join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/config/formatting.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/config/formatting.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,CAAC,IAAY,EAAE,QAAQ,GAAG,EAAE,EAAU,EAAE;QAC9C,OAAO,SAAS,QAAQ,KAAK,IAAI,UAAU,CAAC;IAC9C,CAAC;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAe,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LogLevel } from './types.js';
|
|
1
|
+
import type { LogLevel } from './types/runtime.js';
|
|
2
2
|
interface RuntimeState {
|
|
3
3
|
httpMode: boolean;
|
|
4
4
|
}
|
|
@@ -58,4 +58,3 @@ export declare const config: {
|
|
|
58
58
|
};
|
|
59
59
|
export declare function enableHttpMode(): void;
|
|
60
60
|
export {};
|
|
61
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AA6CnD,UAAU,YAAY;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAMD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAsFV,SAAS,MAAM,EAAE;;;;;;;;;;;;;CA8BhB,CAAC;AAEX,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import packageJson from '../../package.json' with { type: 'json' };
|
|
2
2
|
import { SIZE_LIMITS, TIMEOUT } from './constants.js';
|
|
3
3
|
function parseInteger(envValue, defaultValue, min, max) {
|
|
4
|
-
const parsed = parseRawInteger(envValue, defaultValue);
|
|
5
|
-
return clampInteger(parsed, defaultValue, min, max);
|
|
6
|
-
}
|
|
7
|
-
function parseRawInteger(envValue, defaultValue) {
|
|
8
4
|
if (!envValue)
|
|
9
5
|
return defaultValue;
|
|
10
6
|
const parsed = parseInt(envValue, 10);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (min !== undefined && value < min)
|
|
7
|
+
if (Number.isNaN(parsed))
|
|
8
|
+
return defaultValue;
|
|
9
|
+
if (min !== undefined && parsed < min)
|
|
15
10
|
return defaultValue;
|
|
16
|
-
if (max !== undefined &&
|
|
11
|
+
if (max !== undefined && parsed > max)
|
|
17
12
|
return defaultValue;
|
|
18
|
-
return
|
|
13
|
+
return parsed;
|
|
19
14
|
}
|
|
20
15
|
function parseBoolean(envValue, defaultValue) {
|
|
21
16
|
if (!envValue)
|
|
@@ -132,4 +127,3 @@ export const config = {
|
|
|
132
127
|
export function enableHttpMode() {
|
|
133
128
|
runtimeState.httpMode = true;
|
|
134
129
|
}
|
|
135
|
-
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGtD,SAAS,YAAY,CACnB,QAA4B,EAC5B,YAAoB,EACpB,GAAY,EACZ,GAAY;IAE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AS;YACT,eAAe;YACf,cAAc;YACd,mCAAmC;YACnC,oBAAoB;YACpB,oBAAoB;SACA;QACtB,cAAc,EAAE,IAAI,GAAG,CAAC;YACtB,MAAM;YACN,eAAe;YACf,QAAQ;YACR,iBAAiB;YACjB,WAAW;YACX,qBAAqB;SACtB,CAAC;QACF,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;QAC3B,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC;QAC1D,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,cAAc,CAAC;KACrE;IACD,SAAS,EAAE;QACT,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC;QAC3D,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC;QACpE,QAAQ,EAAE,YAAY,CACpB,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAChC,KAAK,EACL,IAAI,EACJ,OAAO,CACR;QACD,iBAAiB,EAAE,YAAY,CAC7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,EACjC,KAAK,EACL,KAAK,EACL,OAAO,CACR;KACF;IACD,OAAO,EAAE,YAAY;CACb,CAAC;AAEX,MAAM,UAAU,cAAc;IAC5B,YAAY,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC/B,CAAC"}
|
package/dist/errors/app-error.js
CHANGED
package/dist/http/auth.d.ts
CHANGED
package/dist/http/auth.js
CHANGED
package/dist/http/cors.d.ts
CHANGED
package/dist/http/cors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Express } from 'express';
|
|
2
|
-
import type { CacheEntry } from '../config/types.js';
|
|
2
|
+
import type { CacheEntry } from '../config/types/content.js';
|
|
3
3
|
interface DownloadParams {
|
|
4
4
|
namespace: string;
|
|
5
5
|
hash: string;
|
|
@@ -12,4 +12,3 @@ interface DownloadPayload {
|
|
|
12
12
|
export declare function resolveDownloadPayload(params: DownloadParams, cacheEntry: CacheEntry): DownloadPayload | null;
|
|
13
13
|
export declare function registerDownloadRoutes(app: Express): void;
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=download-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-routes.d.ts","sourceRoot":"","sources":["../../src/http/download-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAmC,MAAM,SAAS,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"download-routes.d.ts","sourceRoot":"","sources":["../../src/http/download-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAmC,MAAM,SAAS,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAU7D,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAQD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAoFD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,UAAU,GACrB,eAAe,GAAG,IAAI,CAmBxB;AA+CD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQzD"}
|
|
@@ -2,4 +2,3 @@ import type { Express } from 'express';
|
|
|
2
2
|
import { type McpSessionOptions } from './mcp-session.js';
|
|
3
3
|
export declare function registerMcpRoutes(app: Express, options: McpSessionOptions): void;
|
|
4
4
|
export { evictExpiredSessions } from './mcp-session.js';
|
|
5
|
-
//# sourceMappingURL=mcp-routes.d.ts.map
|
package/dist/http/mcp-routes.js
CHANGED
|
@@ -11,4 +11,3 @@ export declare function createSlotTracker(): SlotTracker;
|
|
|
11
11
|
export declare function ensureSessionCapacity(store: SessionStore, maxSessions: number, res: Response, evictOldest: (store: SessionStore) => boolean): boolean;
|
|
12
12
|
export declare function respondServerBusy(res: Response): void;
|
|
13
13
|
export declare function respondBadRequest(res: Response): void;
|
|
14
|
-
//# sourceMappingURL=mcp-session-helpers.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Request, Response } from 'express';
|
|
2
2
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
3
|
-
import type { McpRequestBody } from '../config/types.js';
|
|
3
|
+
import type { McpRequestBody } from '../config/types/runtime.js';
|
|
4
4
|
import { type SessionStore } from './sessions.js';
|
|
5
5
|
export interface McpSessionOptions {
|
|
6
6
|
readonly sessionStore: SessionStore;
|
|
@@ -8,4 +8,3 @@ export interface McpSessionOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function resolveTransportForPost(_req: Request, res: Response, body: McpRequestBody, sessionId: string | undefined, options: McpSessionOptions): Promise<StreamableHTTPServerTransport | null>;
|
|
10
10
|
export declare function evictExpiredSessions(store: SessionStore): number;
|
|
11
|
-
//# sourceMappingURL=mcp-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-session.d.ts","sourceRoot":"","sources":["../../src/http/mcp-session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAInG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mcp-session.d.ts","sourceRoot":"","sources":["../../src/http/mcp-session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAInG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAejE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AA2KD,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,cAAc,EACpB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAa/C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAUhE"}
|
package/dist/http/mcp-session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-validation.d.ts","sourceRoot":"","sources":["../../src/http/mcp-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"mcp-validation.d.ts","sourceRoot":"","sources":["../../src/http/mcp-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,cAAc,CAWtE"}
|
|
@@ -1,34 +1,13 @@
|
|
|
1
1
|
function isRecord(value) {
|
|
2
2
|
return value !== null && typeof value === 'object';
|
|
3
3
|
}
|
|
4
|
-
function isOptionalString(value) {
|
|
5
|
-
return value === undefined || typeof value === 'string';
|
|
6
|
-
}
|
|
7
|
-
function isOptionalId(value) {
|
|
8
|
-
return (value === undefined ||
|
|
9
|
-
typeof value === 'string' ||
|
|
10
|
-
typeof value === 'number');
|
|
11
|
-
}
|
|
12
|
-
function isOptionalJsonRpc(value) {
|
|
13
|
-
return value === undefined || value === '2.0';
|
|
14
|
-
}
|
|
15
|
-
function isOptionalParams(value) {
|
|
16
|
-
return value === undefined || typeof value === 'object';
|
|
17
|
-
}
|
|
18
|
-
function areMcpFieldsValid(body) {
|
|
19
|
-
if (!isOptionalString(body.method))
|
|
20
|
-
return false;
|
|
21
|
-
if (!isOptionalId(body.id))
|
|
22
|
-
return false;
|
|
23
|
-
if (!isOptionalJsonRpc(body.jsonrpc))
|
|
24
|
-
return false;
|
|
25
|
-
if (!isOptionalParams(body.params))
|
|
26
|
-
return false;
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
4
|
export function isMcpRequestBody(body) {
|
|
30
5
|
if (!isRecord(body))
|
|
31
6
|
return false;
|
|
32
|
-
|
|
7
|
+
const { method, id, jsonrpc, params } = body;
|
|
8
|
+
const methodValid = method === undefined || typeof method === 'string';
|
|
9
|
+
const idValid = id === undefined || typeof id === 'string' || typeof id === 'number';
|
|
10
|
+
const jsonrpcValid = jsonrpc === undefined || jsonrpc === '2.0';
|
|
11
|
+
const paramsValid = params === undefined || typeof params === 'object';
|
|
12
|
+
return methodValid && idValid && jsonrpcValid && paramsValid;
|
|
33
13
|
}
|
|
34
|
-
//# sourceMappingURL=mcp-validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-validation.js","sourceRoot":"","sources":["../../src/http/mcp-validation.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACrD,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"mcp-validation.js","sourceRoot":"","sources":["../../src/http/mcp-validation.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC5C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAElC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC7C,MAAM,WAAW,GAAG,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC;IACvE,MAAM,OAAO,GACX,EAAE,KAAK,SAAS,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ,CAAC;IACvE,MAAM,YAAY,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,CAAC;IAChE,MAAM,WAAW,GAAG,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC;IAEvE,OAAO,WAAW,IAAI,OAAO,IAAI,YAAY,IAAI,WAAW,CAAC;AAC/D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NextFunction, Request, Response } from 'express';
|
|
2
|
-
import type { RateLimitEntry, RateLimiterOptions } from '../config/types.js';
|
|
2
|
+
import type { RateLimitEntry, RateLimiterOptions } from '../config/types/runtime.js';
|
|
3
3
|
interface RateLimitConfig extends RateLimiterOptions {
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
}
|
|
@@ -10,4 +10,3 @@ interface RateLimitMiddlewareResult {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function createRateLimitMiddleware(options: RateLimitConfig): RateLimitMiddlewareResult;
|
|
12
12
|
export {};
|
|
13
|
-
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/http/rate-limit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/http/rate-limit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,UAAU,eAAgB,SAAQ,kBAAkB;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,yBAAyB;IACjC,UAAU,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACtE,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACpC;AAmBD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,eAAe,GACvB,yBAAyB,CAkC3B"}
|
package/dist/http/rate-limit.js
CHANGED