@j0hanz/fetch-url-mcp 1.11.6 → 1.11.8
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 +25 -33
- package/dist/http/auth.d.ts.map +1 -1
- package/dist/http/auth.js +1 -1
- package/dist/http/health.d.ts.map +1 -1
- package/dist/http/health.js +0 -2
- package/dist/http/native.d.ts.map +1 -1
- package/dist/http/native.js +0 -25
- package/dist/lib/config.d.ts +0 -7
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +5 -11
- package/dist/lib/core.d.ts +0 -3
- package/dist/lib/core.d.ts.map +1 -1
- package/dist/lib/core.js +0 -7
- package/dist/lib/fetch-pipeline.d.ts +1 -14
- package/dist/lib/fetch-pipeline.d.ts.map +1 -1
- package/dist/lib/fetch-pipeline.js +4 -149
- package/dist/lib/http.d.ts +0 -3
- package/dist/lib/http.d.ts.map +1 -1
- package/dist/lib/http.js +4 -108
- package/dist/lib/mcp-interop.d.ts.map +1 -1
- package/dist/lib/mcp-interop.js +13 -11
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/session.js +5 -9
- package/dist/lib/url.d.ts +1 -1
- package/dist/lib/url.d.ts.map +1 -1
- package/dist/lib/url.js +67 -82
- package/dist/lib/utils.d.ts +2 -4
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +18 -44
- package/dist/lib/zod.d.ts.map +1 -1
- package/dist/lib/zod.js +11 -17
- package/dist/resources/index.d.ts +1 -23
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +3 -294
- package/dist/schemas.d.ts +0 -14
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +1 -77
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -2
- package/dist/tasks/execution.js +1 -1
- package/dist/tasks/manager.d.ts.map +1 -1
- package/dist/tasks/manager.js +8 -5
- package/dist/tasks/owner.d.ts.map +1 -1
- package/dist/tasks/owner.js +4 -4
- package/dist/tools/fetch-url.d.ts +0 -2
- package/dist/tools/fetch-url.d.ts.map +1 -1
- package/dist/tools/fetch-url.js +12 -43
- package/dist/transform/html-translators.js +7 -7
- package/dist/transform/next-flight.d.ts.map +1 -1
- package/dist/transform/next-flight.js +8 -2
- package/dist/transform/shared.js +4 -4
- package/dist/transform/transform.d.ts +1 -1
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +14 -15
- package/dist/transform/types.d.ts +2 -2
- package/dist/transform/types.d.ts.map +1 -1
- package/dist/transform/worker-pool.d.ts +3 -3
- package/dist/transform/worker-pool.d.ts.map +1 -1
- package/dist/transform/worker-pool.js +2 -2
- package/package.json +1 -1
- package/dist/lib/cache.d.ts +0 -48
- package/dist/lib/cache.d.ts.map +0 -1
- package/dist/lib/cache.js +0 -273
package/README.md
CHANGED
|
@@ -10,15 +10,15 @@ A web content fetcher MCP server that converts HTML to clean, AI and human reada
|
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
12
12
|
|
|
13
|
-
The Fetch URL MCP Server provides a standardized interface for fetching public web content and transforming it into Markdown enriched with structured metadata. It validates URLs
|
|
13
|
+
The Fetch URL MCP Server provides a standardized interface for fetching public web content and transforming it into Markdown enriched with structured metadata. It validates URLs and applies noise removal heuristics. The server supports both inline and task-based execution modes, making it suitable for a wide range of client applications and LLM interactions.
|
|
14
14
|
|
|
15
15
|
## Key Features
|
|
16
16
|
|
|
17
17
|
- `fetch-url` validates public HTTP(S) URLs, fetches the page, and returns cleaned Markdown plus structured metadata.
|
|
18
18
|
- The tool advertises optional task support and emits progress updates while fetching and transforming larger pages.
|
|
19
19
|
- GitHub, GitLab, Bitbucket, and Gist page URLs are rewritten to raw-content endpoints when possible before fetch.
|
|
20
|
-
- `internal://instructions`
|
|
21
|
-
- HTTP mode adds host/origin validation, auth, rate limiting, health checks, OAuth protected-resource metadata, and
|
|
20
|
+
- `internal://instructions` exposes built-in guidance as an MCP resource.
|
|
21
|
+
- HTTP mode adds host/origin validation, auth, rate limiting, health checks, OAuth protected-resource metadata, and session-bound URLs.
|
|
22
22
|
|
|
23
23
|
## Requirements
|
|
24
24
|
|
|
@@ -476,7 +476,6 @@ For more info, see [Kilo Code docs](https://kilocode.ai/docs).
|
|
|
476
476
|
|
|
477
477
|
- Fetch documentation pages, blog posts, or reference material into Markdown before sending them to an LLM.
|
|
478
478
|
- Retrieve repository-hosted content from GitHub, GitLab, Bitbucket, or Gists and let the server rewrite page URLs to raw endpoints when possible.
|
|
479
|
-
- Reuse cached Markdown through `internal://cache/{namespace}/{hash}` or bypass the cache with `forceRefresh` for time-sensitive pages.
|
|
480
479
|
- Use task mode for large pages or slower sites when the fetch might otherwise be delayed, cancelled, or better handled asynchronously.
|
|
481
480
|
|
|
482
481
|
## Architecture
|
|
@@ -488,7 +487,6 @@ For more info, see [Kilo Code docs](https://kilocode.ai/docs).
|
|
|
488
487
|
├─ `GET /health`
|
|
489
488
|
├─ `GET /.well-known/oauth-protected-resource`
|
|
490
489
|
├─ `GET /.well-known/oauth-protected-resource/mcp`
|
|
491
|
-
├─ `GET /mcp/downloads/{namespace}/{hash}`
|
|
492
490
|
└─ `POST|GET|DELETE /mcp`
|
|
493
491
|
|
|
494
492
|
`createMcpServer()`
|
|
@@ -496,15 +494,14 @@ For more info, see [Kilo Code docs](https://kilocode.ai/docs).
|
|
|
496
494
|
├─ registers prompt: `get-help`
|
|
497
495
|
├─ registers resources:
|
|
498
496
|
│ - `internal://instructions`
|
|
499
|
-
|
|
500
|
-
├─ enables capabilities: completions, logging, resources, prompts, tasks
|
|
497
|
+
├─ enables capabilities: logging, resources, prompts, tasks
|
|
501
498
|
└─ installs task handlers, log-level handling, and shutdown cleanup
|
|
502
499
|
|
|
503
500
|
`fetch-url` execution
|
|
504
501
|
├─ validate input with `fetchUrlInputSchema`
|
|
505
502
|
├─ normalize URL and block local/private targets unless allowed
|
|
506
503
|
├─ rewrite supported code-host URLs to raw endpoints when possible
|
|
507
|
-
├─ fetch
|
|
504
|
+
├─ fetch content via the shared pipeline
|
|
508
505
|
├─ transform HTML into Markdown in the transform worker path
|
|
509
506
|
└─ validate `structuredContent` with `fetchUrlOutputSchema`
|
|
510
507
|
```
|
|
@@ -525,14 +522,13 @@ For more info, see [Kilo Code docs](https://kilocode.ai/docs).
|
|
|
525
522
|
|
|
526
523
|
#### `fetch-url`
|
|
527
524
|
|
|
528
|
-
Fetch public webpages and convert HTML into AI-readable Markdown. The tool is read-only, does not execute page JavaScript,
|
|
525
|
+
Fetch public webpages and convert HTML into AI-readable Markdown. The tool is read-only, does not execute page JavaScript, and supports optional task mode for larger or slower fetches.
|
|
529
526
|
|
|
530
|
-
| Parameter
|
|
531
|
-
|
|
|
532
|
-
| `url`
|
|
533
|
-
| `forceRefresh` | `boolean` | no | Bypass cache and fetch fresh content. |
|
|
527
|
+
| Parameter | Type | Required | Description |
|
|
528
|
+
| --------- | -------- | -------- | --------------------------- |
|
|
529
|
+
| `url` | `string` | yes | Target URL. Max 2048 chars. |
|
|
534
530
|
|
|
535
|
-
The response is returned as MCP text content and, when validation succeeds, as `structuredContent` containing `url`, `resolvedUrl`, `finalUrl`, `title`, `metadata`, `markdown`, `
|
|
531
|
+
The response is returned as MCP text content and, when validation succeeds, as `structuredContent` containing `url`, `resolvedUrl`, `finalUrl`, `title`, `metadata`, `markdown`, `fetchedAt`, `contentSize`, and `truncated`. A `truncated: true` result means the content hit server-enforced fetch or inline limits.
|
|
536
532
|
|
|
537
533
|
```text
|
|
538
534
|
1. [Client] -- tools/call {name: "fetch-url", arguments} --> [Server]
|
|
@@ -544,27 +540,26 @@ The response is returned as MCP text content and, when validation succeeds, as `
|
|
|
544
540
|
|
|
545
541
|
### Resources
|
|
546
542
|
|
|
547
|
-
| Resource | URI
|
|
548
|
-
| ---------------------------- |
|
|
549
|
-
| `fetch-url-mcp-instructions` | `internal://instructions`
|
|
550
|
-
| `fetch-url-mcp-cache-entry` | `internal://cache/{namespace}/{hash}` | `text/markdown` | Read cached markdown generated by previous `fetch-url` calls. |
|
|
543
|
+
| Resource | URI | MIME Type | Description |
|
|
544
|
+
| ---------------------------- | ------------------------- | --------------- | -------------------------------------------- |
|
|
545
|
+
| `fetch-url-mcp-instructions` | `internal://instructions` | `text/markdown` | Guidance for using the Fetch URL MCP server. |
|
|
551
546
|
|
|
552
547
|
### Prompts
|
|
553
548
|
|
|
554
|
-
| Prompt | Arguments | Description
|
|
555
|
-
| ---------- | --------- |
|
|
556
|
-
| `get-help` | none | Return Fetch URL server instructions: workflows,
|
|
549
|
+
| Prompt | Arguments | Description |
|
|
550
|
+
| ---------- | --------- | ------------------------------------------------------------------------------- |
|
|
551
|
+
| `get-help` | none | Return Fetch URL server instructions: workflows, task mode, and error handling. |
|
|
557
552
|
|
|
558
553
|
## MCP Capabilities
|
|
559
554
|
|
|
560
|
-
| Capability | Status | Notes
|
|
561
|
-
| ------------------------------- | --------- |
|
|
562
|
-
| completions | confirmed | Advertised in `createServerCapabilities()
|
|
563
|
-
| logging | confirmed | Advertised in `createServerCapabilities()` and handled through `SetLevelRequestSchema`.
|
|
564
|
-
| resources subscribe/listChanged | confirmed | Advertised in `createServerCapabilities()
|
|
565
|
-
| prompts | confirmed | `get-help` is registered during server startup.
|
|
566
|
-
| tasks | confirmed | Advertised in `createServerCapabilities()` and backed by registered task handlers plus optional tool task support.
|
|
567
|
-
| progress notifications | confirmed | Tool execution reports `notifications/progress` updates during fetch and transform stages.
|
|
555
|
+
| Capability | Status | Notes |
|
|
556
|
+
| ------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
557
|
+
| completions | confirmed | Advertised in `createServerCapabilities()`. |
|
|
558
|
+
| logging | confirmed | Advertised in `createServerCapabilities()` and handled through `SetLevelRequestSchema`. |
|
|
559
|
+
| resources subscribe/listChanged | confirmed | Advertised in `createServerCapabilities()`. |
|
|
560
|
+
| prompts | confirmed | `get-help` is registered during server startup. |
|
|
561
|
+
| tasks | confirmed | Advertised in `createServerCapabilities()` and backed by registered task handlers plus optional tool task support. |
|
|
562
|
+
| progress notifications | confirmed | Tool execution reports `notifications/progress` updates during fetch and transform stages. |
|
|
568
563
|
|
|
569
564
|
### Tool Annotations
|
|
570
565
|
|
|
@@ -607,13 +602,11 @@ The response is returned as MCP text content and, when validation succeeds, as `
|
|
|
607
602
|
| `SERVER_KEEP_ALIVE_TIMEOUT_BUFFER_MS` | unset | HTTP mode | Optional keep-alive tuning buffer. |
|
|
608
603
|
| `SERVER_MAX_HEADERS_COUNT` | unset | HTTP mode | Optional header count limit. |
|
|
609
604
|
| `SERVER_BLOCK_PRIVATE_CONNECTIONS` | `false` | HTTP mode | Enables inbound private-network protections. |
|
|
610
|
-
| `MCP_STRICT_PROTOCOL_VERSION_HEADER` | `true` | HTTP mode | Requires `MCP-Protocol-Version` on session init. |
|
|
611
605
|
| `ALLOWED_HOSTS` | empty | HTTP mode | Additional allowed `Host` and `Origin` values. |
|
|
612
606
|
| `ALLOW_LOCAL_FETCH` | `false` | Fetching | Allows loopback and private-network fetch targets. |
|
|
613
607
|
| `FETCH_TIMEOUT_MS` | `15000` | Fetching | Network fetch timeout in milliseconds. |
|
|
614
608
|
| `USER_AGENT` | `fetch-url-mcp/<version>` | Fetching | Override the outbound user agent string. |
|
|
615
609
|
| `MAX_INLINE_CONTENT_CHARS` | `0` | Tool output | `0` means no explicit inline truncation limit. |
|
|
616
|
-
| `CACHE_ENABLED` | `true` | Caching | Enables in-memory fetch result caching. |
|
|
617
610
|
| `TASKS_MAX_TOTAL` | `5000` | Tasks | Total task capacity. |
|
|
618
611
|
| `TASKS_MAX_PER_OWNER` | `1000` | Tasks | Per-owner task cap, clamped to the total cap. |
|
|
619
612
|
| `TASKS_STATUS_NOTIFICATIONS` | `false` | Tasks | Enables status notifications for tasks. |
|
|
@@ -641,7 +634,6 @@ The response is returned as MCP text content and, when validation succeeds, as `
|
|
|
641
634
|
| `POST` | `/mcp` | yes | Session initialization and JSON-RPC requests. |
|
|
642
635
|
| `GET` | `/mcp` | yes | Session-bound server-to-client stream handling. |
|
|
643
636
|
| `DELETE` | `/mcp` | yes | Session shutdown. |
|
|
644
|
-
| `GET` | `/mcp/downloads/{namespace}/{hash}` | yes | Download route used by HTTP-mode cached fetch results. |
|
|
645
637
|
|
|
646
638
|
## Security
|
|
647
639
|
|
|
@@ -649,7 +641,7 @@ The response is returned as MCP text content and, when validation succeeds, as `
|
|
|
649
641
|
| -------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
650
642
|
| Host and origin validation | implemented | HTTP requests are rejected unless `Host` and `Origin` match the allowlist built from loopback, the configured host, and `ALLOWED_HOSTS`. |
|
|
651
643
|
| Authentication | implemented | HTTP mode supports static bearer tokens locally or OAuth token introspection; remote bindings require OAuth. |
|
|
652
|
-
| Protocol version checks | implemented | HTTP
|
|
644
|
+
| Protocol version checks | implemented | Session-bound MCP HTTP requests validate `MCP-Protocol-Version` and pin it to the negotiated session version. |
|
|
653
645
|
| Rate limiting | implemented | Requests pass through the HTTP rate limiter before route dispatch. |
|
|
654
646
|
| Outbound SSRF protections | implemented | Local/private IPs, metadata endpoints, and `.local`/`.internal` hosts are blocked unless `ALLOW_LOCAL_FETCH=true`. |
|
|
655
647
|
| TLS | optional | HTTPS is enabled when both TLS key and certificate files are configured. |
|
package/dist/http/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/http/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EACL,iBAAiB,EAElB,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAY/E,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,cAAc,CAAC;AAMtB,cAAM,UAAU;IAId,MAAM,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO;CAuBrC;AAED,eAA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UN;AAED,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,OAAO,SAA+C,GACrD,IAAI,CAYN;AAED,wBAAgB,sCAAsC,CAAC,GAAG,EAAE,eAAe,GAAG;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAeA;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAKzE;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
package/dist/http/auth.js
CHANGED
|
@@ -106,7 +106,7 @@ class HostOriginPolicy {
|
|
|
106
106
|
const hostHeader = getHeaderValue(req, 'host');
|
|
107
107
|
if (!hostHeader)
|
|
108
108
|
return null;
|
|
109
|
-
const isEncrypted = req.socket
|
|
109
|
+
const isEncrypted = Reflect.get(req.socket, 'encrypted') === true;
|
|
110
110
|
const scheme = isEncrypted ? 'https' : 'http';
|
|
111
111
|
const parsed = parseUrlOrNull(`${scheme}://${hostHeader}`);
|
|
112
112
|
if (!parsed)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/http/health.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/http/health.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,cAAc,CAAC;AAY7D,wBAAgB,wBAAwB,IAAI,IAAI,CAI/C;AAED,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAqKD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAKnE;AAiCD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,OAAO,GACnB,OAAO,CAOT"}
|
package/dist/http/health.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { freemem, hostname, totalmem } from 'node:os';
|
|
2
2
|
import { monitorEventLoopDelay, performance } from 'node:perf_hooks';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import { keys as cacheKeys } from '../lib/cache.js';
|
|
5
4
|
import { config, serverVersion } from '../lib/core.js';
|
|
6
5
|
import { getTransformPoolStats } from '../transform/transform.js';
|
|
7
6
|
import { sendJson } from './helpers.js';
|
|
@@ -96,7 +95,6 @@ function buildHealthResponse(store, includeDiagnostics) {
|
|
|
96
95
|
: {}),
|
|
97
96
|
stats: {
|
|
98
97
|
activeSessions: store.size(),
|
|
99
|
-
cacheKeys: cacheKeys().length,
|
|
100
98
|
workerPool: poolStats ?? {
|
|
101
99
|
queueDepth: 0,
|
|
102
100
|
activeWorkers: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/http/native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/http/native.ts"],"names":[],"mappings":"AAqmCA,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CA0DD"}
|
package/dist/http/native.js
CHANGED
|
@@ -8,7 +8,6 @@ import process from 'node:process';
|
|
|
8
8
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
9
9
|
import { isInitializeRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
10
10
|
import { composeCloseHandlers, config, createSessionStore, createSlotTracker, enableHttpMode, ensureSessionCapacity, logError, logInfo, registerMcpSessionServer, reserveSessionSlot, runWithRequestContext, startSessionCleanupLoop, } from '../lib/core.js';
|
|
11
|
-
import { handleDownload } from '../lib/http.js';
|
|
12
11
|
import { acceptsEventStream, acceptsJsonAndEventStream, isJsonRpcBatchRequest, isMcpMessageBody, isMcpRequestBody, } from '../lib/mcp-interop.js';
|
|
13
12
|
import { applyHttpServerTuning, drainConnectionsOnShutdown, isObject, toError, } from '../lib/utils.js';
|
|
14
13
|
import { createMcpServerForHttpSession } from '../server.js';
|
|
@@ -425,19 +424,6 @@ class McpSessionGateway {
|
|
|
425
424
|
}
|
|
426
425
|
}
|
|
427
426
|
// ---------------------------------------------------------------------------
|
|
428
|
-
// Download route
|
|
429
|
-
// ---------------------------------------------------------------------------
|
|
430
|
-
function checkDownloadRoute(path) {
|
|
431
|
-
const downloadMatch = /^\/mcp\/downloads\/([^/]+)\/([^/]+)$/.exec(path);
|
|
432
|
-
if (!downloadMatch)
|
|
433
|
-
return null;
|
|
434
|
-
const namespace = downloadMatch[1];
|
|
435
|
-
const hash = downloadMatch[2];
|
|
436
|
-
if (!namespace || !hash)
|
|
437
|
-
return null;
|
|
438
|
-
return { namespace, hash };
|
|
439
|
-
}
|
|
440
|
-
// ---------------------------------------------------------------------------
|
|
441
427
|
// HTTP dispatcher
|
|
442
428
|
// ---------------------------------------------------------------------------
|
|
443
429
|
class HttpDispatcher {
|
|
@@ -461,15 +447,6 @@ class HttpDispatcher {
|
|
|
461
447
|
sendHealthRouteResponse(this.store, ctx, true);
|
|
462
448
|
return true;
|
|
463
449
|
}
|
|
464
|
-
tryHandleDownloadRoute(ctx) {
|
|
465
|
-
if (ctx.method !== 'GET')
|
|
466
|
-
return false;
|
|
467
|
-
const download = checkDownloadRoute(ctx.url.pathname);
|
|
468
|
-
if (!download)
|
|
469
|
-
return false;
|
|
470
|
-
handleDownload(ctx.res, download.namespace, download.hash);
|
|
471
|
-
return true;
|
|
472
|
-
}
|
|
473
450
|
tryHandleProtectedResourceMetadataRoute(ctx) {
|
|
474
451
|
if (ctx.method !== 'GET')
|
|
475
452
|
return false;
|
|
@@ -491,8 +468,6 @@ class HttpDispatcher {
|
|
|
491
468
|
if (!auth)
|
|
492
469
|
return;
|
|
493
470
|
const authCtx = { ...ctx, auth };
|
|
494
|
-
if (this.tryHandleDownloadRoute(authCtx))
|
|
495
|
-
return;
|
|
496
471
|
if (isMcpRoute(ctx.url.pathname)) {
|
|
497
472
|
const handled = await this.handleMcpRoutes(authCtx);
|
|
498
473
|
if (handled)
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -75,12 +75,6 @@ interface AppTasksConfig {
|
|
|
75
75
|
emitStatusNotifications: boolean;
|
|
76
76
|
requireInterception: boolean;
|
|
77
77
|
}
|
|
78
|
-
interface AppCacheConfig {
|
|
79
|
-
enabled: boolean;
|
|
80
|
-
ttl: number;
|
|
81
|
-
maxKeys: number;
|
|
82
|
-
maxSizeBytes: number;
|
|
83
|
-
}
|
|
84
78
|
interface AppNoiseRemovalConfig {
|
|
85
79
|
extraTokens: string[];
|
|
86
80
|
extraSelectors: string[];
|
|
@@ -112,7 +106,6 @@ export declare const config: {
|
|
|
112
106
|
timeoutMs: number;
|
|
113
107
|
};
|
|
114
108
|
tasks: AppTasksConfig;
|
|
115
|
-
cache: AppCacheConfig;
|
|
116
109
|
extraction: {
|
|
117
110
|
maxBlockLength: number;
|
|
118
111
|
minParagraphLength: number;
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAgD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MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AA2BD,UAAU,wBAAwB;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAiBD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8ClB,CAAC;AAEF,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
|
package/dist/lib/config.js
CHANGED
|
@@ -5,10 +5,13 @@ import { z } from 'zod';
|
|
|
5
5
|
import { buildIpv4, isIP, normalizeHostname, stripTrailingDots, } from './url.js';
|
|
6
6
|
import { getErrorMessage } from './utils.js';
|
|
7
7
|
// ── Version ─────────────────────────────────────────────────────────
|
|
8
|
+
function getObjectProperty(value, key) {
|
|
9
|
+
return value[key];
|
|
10
|
+
}
|
|
8
11
|
function hasPackageJsonVersion(value) {
|
|
9
12
|
return (typeof value === 'object' &&
|
|
10
13
|
value !== null &&
|
|
11
|
-
typeof value
|
|
14
|
+
typeof getObjectProperty(value, 'version') === 'string');
|
|
12
15
|
}
|
|
13
16
|
function readServerVersion(moduleUrl) {
|
|
14
17
|
const packageJsonPath = findPackageJSON(moduleUrl);
|
|
@@ -57,7 +60,7 @@ class ConfigError extends Error {
|
|
|
57
60
|
function isMissingEnvFileError(error) {
|
|
58
61
|
if (!error || typeof error !== 'object')
|
|
59
62
|
return false;
|
|
60
|
-
const
|
|
63
|
+
const code = getObjectProperty(error, 'code');
|
|
61
64
|
return code === 'ENOENT' || code === 'ERR_ENV_FILE_NOT_FOUND';
|
|
62
65
|
}
|
|
63
66
|
function loadEnvFileIfAvailable() {
|
|
@@ -387,14 +390,6 @@ function buildTasksConfig() {
|
|
|
387
390
|
requireInterception: EnvParser.boolean(env['TASKS_REQUIRE_INTERCEPTION'], true, 'TASKS_REQUIRE_INTERCEPTION'),
|
|
388
391
|
};
|
|
389
392
|
}
|
|
390
|
-
function buildCacheConfig() {
|
|
391
|
-
return {
|
|
392
|
-
enabled: EnvParser.boolean(env['CACHE_ENABLED'], true, 'CACHE_ENABLED'),
|
|
393
|
-
ttl: 86400,
|
|
394
|
-
maxKeys: 100,
|
|
395
|
-
maxSizeBytes: 50 * 1024 * 1024,
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
393
|
function buildNoiseRemovalConfig() {
|
|
399
394
|
return {
|
|
400
395
|
extraTokens: EnvParser.list(env['FETCH_URL_MCP_EXTRA_NOISE_TOKENS']),
|
|
@@ -438,7 +433,6 @@ export const config = {
|
|
|
438
433
|
timeoutMs: DEFAULT_TOOL_TIMEOUT_MS,
|
|
439
434
|
},
|
|
440
435
|
tasks: buildTasksConfig(),
|
|
441
|
-
cache: buildCacheConfig(),
|
|
442
436
|
extraction: {
|
|
443
437
|
maxBlockLength: 5000,
|
|
444
438
|
minParagraphLength: 10,
|
package/dist/lib/core.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import type { SessionEntry } from './session.js';
|
|
3
3
|
import type { SessionStore } from './session.js';
|
|
4
4
|
export { config, enableHttpMode, serverVersion } from './config.js';
|
|
5
|
-
export { createCacheKey, get, getEntryMeta, isEnabled, keys, onCacheUpdate, parseCacheKey, set, } from './cache.js';
|
|
6
|
-
type McpLogLevel = 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency';
|
|
7
5
|
type LogMetadata = Record<string, unknown>;
|
|
8
6
|
interface RequestContext {
|
|
9
7
|
readonly requestId: string;
|
|
@@ -23,7 +21,6 @@ export declare function logInfo(message: string, meta?: LogMetadata): void;
|
|
|
23
21
|
export declare function logDebug(message: string, meta?: LogMetadata): void;
|
|
24
22
|
export declare function logWarn(message: string, meta?: LogMetadata): void;
|
|
25
23
|
export declare function logError(message: string, error?: Error | LogMetadata): void;
|
|
26
|
-
export declare function getMcpLogLevel(sessionId?: string): McpLogLevel;
|
|
27
24
|
export declare function setLogLevel(level: string, sessionId?: string): void;
|
|
28
25
|
export declare function redactUrl(rawUrl: string): string;
|
|
29
26
|
export type { SessionEntry, SessionStore } from './session.js';
|
package/dist/lib/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/lib/core.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/lib/core.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYpE,KAAK,WAAW,GAAG,MAAM,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AC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAUnE;AACD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQhD;AACD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAmJtB,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACA,eAAe,CAOjB"}
|
package/dist/lib/core.js
CHANGED
|
@@ -5,7 +5,6 @@ import {} from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
5
5
|
import { config } from './config.js';
|
|
6
6
|
import { getErrorMessage, isAbortError, startAbortableIntervalLoop, } from './utils.js';
|
|
7
7
|
export { config, enableHttpMode, serverVersion } from './config.js';
|
|
8
|
-
export { createCacheKey, get, getEntryMeta, isEnabled, keys, onCacheUpdate, parseCacheKey, set, } from './cache.js';
|
|
9
8
|
const requestContext = new AsyncLocalStorage({
|
|
10
9
|
name: 'requestContext',
|
|
11
10
|
});
|
|
@@ -314,12 +313,6 @@ export function logError(message, error) {
|
|
|
314
313
|
const errorMeta = error instanceof Error ? formatErrorMeta(error) : (error ?? {});
|
|
315
314
|
writeLog('error', message, errorMeta);
|
|
316
315
|
}
|
|
317
|
-
export function getMcpLogLevel(sessionId) {
|
|
318
|
-
if (sessionId) {
|
|
319
|
-
return (sessionMcpLogLevels.get(sessionId) ?? toMcpLogLevel(config.logging.level));
|
|
320
|
-
}
|
|
321
|
-
return stdioMcpLogLevel ?? toMcpLogLevel(config.logging.level);
|
|
322
|
-
}
|
|
323
316
|
export function setLogLevel(level, sessionId) {
|
|
324
317
|
const normalized = normalizeLogLevel(level);
|
|
325
318
|
if (!normalized)
|
|
@@ -16,41 +16,28 @@ export declare function finalizeInlineMarkdown(markdown: string | undefined, opt
|
|
|
16
16
|
}): string | undefined;
|
|
17
17
|
interface FetchPipelineOptions<T> {
|
|
18
18
|
url: string;
|
|
19
|
-
cacheNamespace: string;
|
|
20
19
|
signal?: AbortSignal;
|
|
21
|
-
cacheVary?: Record<string, unknown> | string;
|
|
22
|
-
forceRefresh?: boolean;
|
|
23
20
|
onStage?: (stage: SharedFetchStage) => void;
|
|
24
21
|
transform: (input: FetchTransformInput, url: string) => T | Promise<T>;
|
|
25
|
-
serialize?: (result: T) => string;
|
|
26
|
-
deserialize?: (cached: string) => T | undefined;
|
|
27
22
|
}
|
|
28
23
|
export interface PipelineResult<T> {
|
|
29
24
|
data: T;
|
|
30
|
-
fromCache: boolean;
|
|
31
25
|
url: string;
|
|
32
26
|
originalUrl?: string;
|
|
33
27
|
finalUrl?: string;
|
|
34
28
|
fetchedAt: string;
|
|
35
|
-
cacheKey?: string | null;
|
|
36
29
|
}
|
|
37
|
-
export type SharedFetchStage = 'resolve_url' | '
|
|
30
|
+
export type SharedFetchStage = 'resolve_url' | 'fetch_remote' | 'response_ready' | 'transform_start' | 'prepare_output' | 'finalize_output';
|
|
38
31
|
export declare function executeFetchPipeline<T>(options: FetchPipelineOptions<T>): Promise<PipelineResult<T>>;
|
|
39
32
|
export type MarkdownPipelineResult = MarkdownTransformResult & {
|
|
40
33
|
readonly content: string;
|
|
41
34
|
};
|
|
42
|
-
export declare function parseCachedMarkdownResult(cached: string): MarkdownPipelineResult | undefined;
|
|
43
35
|
export declare const markdownTransform: (input: FetchTransformInput, url: string, signal?: AbortSignal) => Promise<MarkdownPipelineResult>;
|
|
44
|
-
export declare function serializeMarkdownResult(result: MarkdownPipelineResult): string;
|
|
45
36
|
interface MarkdownFetchOptions {
|
|
46
37
|
readonly url: string;
|
|
47
38
|
readonly signal?: AbortSignal;
|
|
48
|
-
readonly cacheVary?: Record<string, unknown> | string;
|
|
49
|
-
readonly forceRefresh?: boolean;
|
|
50
39
|
readonly onStage?: (stage: SharedFetchStage) => void;
|
|
51
40
|
readonly transform: (input: FetchTransformInput, normalizedUrl: string) => MarkdownPipelineResult | Promise<MarkdownPipelineResult>;
|
|
52
|
-
readonly serialize?: (result: MarkdownPipelineResult) => string;
|
|
53
|
-
readonly deserialize?: (cached: string) => MarkdownPipelineResult | undefined;
|
|
54
41
|
}
|
|
55
42
|
interface SharedFetchDeps {
|
|
56
43
|
readonly executeFetchPipeline?: typeof executeFetchPipeline;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-pipeline.d.ts","sourceRoot":"","sources":["../../src/lib/fetch-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-pipeline.d.ts","sourceRoot":"","sources":["../../src/lib/fetch-pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAOrE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,CAAC;AAGtB,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AACD,UAAU,mBAAmB;IAC3B,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAmGD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAClC,MAAM,GAAG,SAAS,CAQpB;AAyBD,UAAU,oBAAoB,CA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