@j0hanz/superfetch 2.4.4 → 2.4.5

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/config.d.ts CHANGED
@@ -48,6 +48,7 @@ export declare const config: {
48
48
  metadataFormat: TransformMetadataFormat;
49
49
  };
50
50
  tools: {
51
+ enabled: string[];
51
52
  timeoutMs: number;
52
53
  };
53
54
  cache: {
package/dist/config.js CHANGED
@@ -204,6 +204,7 @@ export const config = {
204
204
  metadataFormat: parseTransformMetadataFormat(process.env.TRANSFORM_METADATA_FORMAT),
205
205
  },
206
206
  tools: {
207
+ enabled: parseList(process.env.ENABLED_TOOLS ?? 'fetch-url'),
207
208
  timeoutMs: parseInteger(process.env.TOOL_TIMEOUT_MS, DEFAULT_TOOL_TIMEOUT_MS, 1000, 300000),
208
209
  },
209
210
  cache: {
package/dist/mcp.js CHANGED
@@ -220,6 +220,26 @@ function registerTaskHandlers(server) {
220
220
  });
221
221
  });
222
222
  }
223
+ function registerPrompts(server) {
224
+ if (config.tools.enabled.includes(FETCH_URL_TOOL_NAME)) {
225
+ server.registerPrompt('summarize-webpage', {
226
+ description: 'Summarize the content of a webpage given its URL.',
227
+ argsSchema: {
228
+ url: z.string().describe('The URL to summarize'),
229
+ },
230
+ }, (args) => ({
231
+ messages: [
232
+ {
233
+ role: 'user',
234
+ content: {
235
+ type: 'text',
236
+ text: `Please summarize the content of the webpage at the following URL: ${args.url}`,
237
+ },
238
+ },
239
+ ],
240
+ }));
241
+ }
242
+ }
223
243
  export function createMcpServer() {
224
244
  const instructions = createServerInstructions(config.server.version);
225
245
  const server = new McpServer(createServerInfo(), {
@@ -228,11 +248,12 @@ export function createMcpServer() {
228
248
  });
229
249
  setMcpServer(server);
230
250
  const localIcons = getLocalIcons();
231
- registerTools(server, localIcons);
251
+ registerTools(server);
232
252
  registerCachedContentResource(server, localIcons);
233
253
  registerInstructionsResource(server, instructions);
234
254
  registerConfigResource(server);
235
255
  registerTaskHandlers(server);
256
+ registerPrompts(server);
236
257
  return server;
237
258
  }
238
259
  function attachServerErrorHandler(server) {
package/dist/tools.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { CallToolResult, ContentBlock } from '@modelcontextprotocol/sdk/types.js';
3
- import * as cache from './cache.js';
4
3
  import type { MarkdownTransformResult } from './transform-types.js';
5
4
  export interface FetchUrlInput {
6
5
  url: string;
@@ -73,7 +72,7 @@ export interface ToolHandlerExtra {
73
72
  sendNotification?: (notification: ProgressNotification) => Promise<void>;
74
73
  }
75
74
  export declare const FETCH_URL_TOOL_NAME = "fetch-url";
76
- export declare const FETCH_URL_TOOL_DESCRIPTION = "Fetches a webpage and converts it to clean Markdown format";
75
+ export declare const FETCH_URL_TOOL_DESCRIPTION: string;
77
76
  interface ProgressReporter {
78
77
  report: (progress: number, message: string) => Promise<void>;
79
78
  }
@@ -119,5 +118,5 @@ type MarkdownPipelineResult = MarkdownTransformResult & {
119
118
  export declare function parseCachedMarkdownResult(cached: string): MarkdownPipelineResult | undefined;
120
119
  export declare function fetchUrlToolHandler(input: FetchUrlInput, extra?: ToolHandlerExtra): Promise<ToolResponseBase>;
121
120
  export declare function withRequestContextIfMissing<TParams, TResult, TExtra = unknown>(handler: (params: TParams, extra?: TExtra) => Promise<TResult>): (params: TParams, extra?: TExtra) => Promise<TResult>;
122
- export declare function registerTools(server: McpServer, serverIcons?: cache.McpIcon[]): void;
121
+ export declare function registerTools(server: McpServer): void;
123
122
  export {};
package/dist/tools.js CHANGED
@@ -15,7 +15,7 @@ const fetchUrlInputSchema = z.strictObject({
15
15
  .url({ protocol: /^https?$/i })
16
16
  .min(1)
17
17
  .max(config.constants.maxUrlLength)
18
- .describe('The URL to fetch'),
18
+ .describe('The URL of the webpage to fetch and convert to Markdown'),
19
19
  });
20
20
  const fetchUrlOutputSchema = z.strictObject({
21
21
  url: z
@@ -46,7 +46,23 @@ const fetchUrlOutputSchema = z.strictObject({
46
46
  .describe('Error message if the request failed'),
47
47
  });
48
48
  export const FETCH_URL_TOOL_NAME = 'fetch-url';
49
- export const FETCH_URL_TOOL_DESCRIPTION = 'Fetches a webpage and converts it to clean Markdown format';
49
+ export const FETCH_URL_TOOL_DESCRIPTION = `
50
+ Fetches a webpage and converts it to clean Markdown format optimized for LLM context.
51
+
52
+ This tool is useful for:
53
+ - Reading documentation, blog posts, or articles.
54
+ - Extracting main content while removing navigation and ads (noise removal).
55
+ - Caching content to speed up repeated queries.
56
+
57
+ Limitations:
58
+ - Returns truncated content if it exceeds ${config.constants.maxInlineContentChars} characters.
59
+ - Does not execute complex client-side JavaScript interactions.
60
+ `.trim();
61
+ // Specific icon for the fetch-url tool (download cloud / web)
62
+ const TOOL_ICON = {
63
+ src: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNMjEgMTV2NGEyIDIgMCAwIDEtMiAySDVhMiAyIDAgMCAxLTItMnYtNCIvPjxwb2x5bGluZSBwb2ludHM9IjcgMTAgMTIgMTUgMTcgMTAiLz48bGluZSB4MT0iMTIiIHkxPSIxNSIgeDI9IjEyIiB5Mj0iMyIvPjwvc3ZnPg==',
64
+ mimeType: 'image/svg+xml',
65
+ };
50
66
  /* -------------------------------------------------------------------------------------------------
51
67
  * Progress reporting
52
68
  * ------------------------------------------------------------------------------------------------- */
@@ -512,13 +528,16 @@ function resolveRequestIdFromExtra(extra) {
512
528
  return String(requestId);
513
529
  return undefined;
514
530
  }
515
- export function registerTools(server, serverIcons) {
516
- server.registerTool(TOOL_DEFINITION.name, {
517
- title: TOOL_DEFINITION.title,
518
- description: TOOL_DEFINITION.description,
519
- inputSchema: TOOL_DEFINITION.inputSchema,
520
- outputSchema: TOOL_DEFINITION.outputSchema,
521
- annotations: TOOL_DEFINITION.annotations,
522
- ...(serverIcons ? { icons: serverIcons } : {}),
523
- }, withRequestContextIfMissing(TOOL_DEFINITION.handler));
531
+ export function registerTools(server) {
532
+ if (config.tools.enabled.includes(FETCH_URL_TOOL_NAME)) {
533
+ server.registerTool(TOOL_DEFINITION.name, {
534
+ title: TOOL_DEFINITION.title,
535
+ description: TOOL_DEFINITION.description,
536
+ inputSchema: TOOL_DEFINITION.inputSchema,
537
+ outputSchema: TOOL_DEFINITION.outputSchema,
538
+ annotations: TOOL_DEFINITION.annotations,
539
+ // Use specific tool icon here
540
+ icons: [TOOL_ICON],
541
+ }, withRequestContextIfMissing(TOOL_DEFINITION.handler));
542
+ }
524
543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/superfetch",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "mcpName": "io.github.j0hanz/superfetch",
5
5
  "description": "Intelligent web content fetcher MCP server that converts HTML to clean, AI-readable Markdown",
6
6
  "type": "module",