@j0hanz/fetch-url-mcp 1.10.25 → 1.11.0
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/dist/http/native.d.ts.map +1 -1
- package/dist/http/native.js +7 -4
- package/package.json +2 -3
|
@@ -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":"AAooCA,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
|
@@ -51,6 +51,9 @@ function isInitializedNotification(method) {
|
|
|
51
51
|
function isPingRequest(method) {
|
|
52
52
|
return method === 'ping';
|
|
53
53
|
}
|
|
54
|
+
function isMcpRoute(pathname) {
|
|
55
|
+
return pathname === '/mcp' || pathname === '/mcp/';
|
|
56
|
+
}
|
|
54
57
|
function createSessionTeardownOptions(mode, context) {
|
|
55
58
|
switch (mode) {
|
|
56
59
|
case 'ended':
|
|
@@ -136,8 +139,8 @@ class McpSessionGateway {
|
|
|
136
139
|
}
|
|
137
140
|
validatePostRequest(ctx) {
|
|
138
141
|
if (!acceptsJsonAndEventStream(getHeaderValue(ctx.req, 'accept'))) {
|
|
139
|
-
sendJson(ctx.res,
|
|
140
|
-
error: '
|
|
142
|
+
sendJson(ctx.res, 406, {
|
|
143
|
+
error: 'Not Acceptable: expected application/json and text/event-stream',
|
|
141
144
|
});
|
|
142
145
|
return null;
|
|
143
146
|
}
|
|
@@ -494,7 +497,7 @@ class HttpDispatcher {
|
|
|
494
497
|
const authCtx = { ...ctx, auth };
|
|
495
498
|
if (this.tryHandleDownloadRoute(authCtx))
|
|
496
499
|
return;
|
|
497
|
-
if (ctx.url.pathname
|
|
500
|
+
if (isMcpRoute(ctx.url.pathname)) {
|
|
498
501
|
const handled = await this.handleMcpRoutes(authCtx);
|
|
499
502
|
if (handled)
|
|
500
503
|
return;
|
|
@@ -568,7 +571,7 @@ const BODY_PARSE_ERRORS = {
|
|
|
568
571
|
function sendBodyParseError(ctx, bodyErrorKind, rawReq) {
|
|
569
572
|
const errorDef = BODY_PARSE_ERRORS[bodyErrorKind ?? 'default'] ?? DEFAULT_BODY_ERROR;
|
|
570
573
|
if (bodyErrorKind !== 'read-failed' || !rawReq.destroyed) {
|
|
571
|
-
if (ctx.url.pathname
|
|
574
|
+
if (isMcpRoute(ctx.url.pathname)) {
|
|
572
575
|
sendError(ctx.res, errorDef.mcpCode, errorDef.mcpMsg, errorDef.statusCode, null);
|
|
573
576
|
}
|
|
574
577
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@j0hanz/fetch-url-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"mcpName": "io.github.j0hanz/fetch-url-mcp",
|
|
5
5
|
"description": "A web content fetcher MCP server that converts HTML to clean, AI and human readable markdown.",
|
|
6
6
|
"type": "module",
|
|
@@ -59,10 +59,9 @@
|
|
|
59
59
|
"type-check:diagnostics": "tsc --noEmit --extendedDiagnostics",
|
|
60
60
|
"type-check:trace": "node -e \"require('fs').rmSync('.ts-trace',{recursive:true,force:true})\" && tsc --noEmit --generateTrace .ts-trace",
|
|
61
61
|
"lint": "eslint .",
|
|
62
|
-
"lint:tests": "eslint
|
|
62
|
+
"lint:tests": "eslint __tests__",
|
|
63
63
|
"lint:fix": "eslint . --fix",
|
|
64
64
|
"test": "node scripts/tasks.mjs test",
|
|
65
|
-
"test:fast": "node --test --import tsx/esm src/__tests__/**/*.test.ts node-tests/**/*.test.ts",
|
|
66
65
|
"test:coverage": "node scripts/tasks.mjs test --coverage",
|
|
67
66
|
"knip": "knip",
|
|
68
67
|
"knip:fix": "knip --fix",
|