@j0hanz/superfetch 2.4.8 → 2.4.11

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/cache.d.ts CHANGED
@@ -41,6 +41,10 @@ export declare function get(cacheKey: string | null): CacheEntry | undefined;
41
41
  export declare function set(cacheKey: string | null, content: string, metadata: CacheEntryMetadata): void;
42
42
  export declare function keys(): readonly string[];
43
43
  export declare function isEnabled(): boolean;
44
+ export declare function getRecentCachedUrls(): {
45
+ url: string;
46
+ title?: string;
47
+ }[];
44
48
  export declare function registerCachedContentResource(server: McpServer, serverIcons?: McpIcon[]): void;
45
49
  export declare function generateSafeFilename(url: string, title?: string, hashFallback?: string, extension?: string): string;
46
50
  export declare function handleDownload(res: ServerResponse, namespace: string, hash: string): void;
package/dist/cache.js CHANGED
@@ -273,6 +273,24 @@ export function keys() {
273
273
  export function isEnabled() {
274
274
  return store.isEnabled();
275
275
  }
276
+ export function getRecentCachedUrls() {
277
+ const cacheKeys = store.keys();
278
+ const maxResults = 20;
279
+ const results = [];
280
+ for (let i = 0; i < Math.min(cacheKeys.length, maxResults); i++) {
281
+ const key = cacheKeys[i];
282
+ if (!key)
283
+ continue;
284
+ const entry = store.get(key);
285
+ if (entry) {
286
+ results.push({
287
+ url: entry.url,
288
+ ...(entry.title ? { title: entry.title } : {}),
289
+ });
290
+ }
291
+ }
292
+ return results;
293
+ }
276
294
  /* -------------------------------------------------------------------------------------------------
277
295
  * MCP cached content resource (superfetch://cache/markdown/{urlHash})
278
296
  * ------------------------------------------------------------------------------------------------- */
package/dist/mcp.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { z } from 'zod';
3
+ import { completable } from '@modelcontextprotocol/sdk/server/completable.js';
3
4
  import { McpServer, ResourceTemplate, } from '@modelcontextprotocol/sdk/server/mcp.js';
4
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
6
  import { CallToolRequestSchema, ErrorCode, McpError, } from '@modelcontextprotocol/sdk/types.js';
6
- import { registerCachedContentResource } from './cache.js';
7
+ import { getRecentCachedUrls, registerCachedContentResource, } from './cache.js';
7
8
  import { config } from './config.js';
8
9
  import { destroyAgents } from './fetch.js';
9
10
  import { logError, logInfo, setMcpServer } from './observability.js';
@@ -394,9 +395,10 @@ function registerTaskHandlers(server) {
394
395
  function registerPrompts(server) {
395
396
  if (config.tools.enabled.includes(FETCH_URL_TOOL_NAME)) {
396
397
  server.registerPrompt('summarize-webpage', {
398
+ title: 'Summarize Webpage',
397
399
  description: 'Summarize the content of a webpage given its URL.',
398
400
  argsSchema: {
399
- url: z.string().describe('The URL to summarize'),
401
+ url: completable(z.string().describe('The URL to summarize'), () => getRecentCachedUrls().map((entry) => entry.url)),
400
402
  },
401
403
  }, (args) => ({
402
404
  messages: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/superfetch",
3
- "version": "2.4.8",
3
+ "version": "2.4.11",
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",