@j0hanz/superfetch 2.4.9 → 2.4.12
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 +0 -4
- package/dist/cache.d.ts +4 -0
- package/dist/cache.js +18 -0
- package/dist/mcp.js +0 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -263,10 +263,6 @@ Large content handling:
|
|
|
263
263
|
| `internal://instructions` | Server usage instructions. | `text/markdown` |
|
|
264
264
|
| `internal://config` | Current runtime config (secrets redacted). | `application/json` |
|
|
265
265
|
|
|
266
|
-
### Prompts
|
|
267
|
-
|
|
268
|
-
- `summarize-webpage` (registered when `fetch-url` is enabled)
|
|
269
|
-
|
|
270
266
|
### Tasks
|
|
271
267
|
|
|
272
268
|
`fetch-url` supports async execution via MCP tasks. Call `tools/call` with a
|
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
|
@@ -40,7 +40,6 @@ function createServerCapabilities() {
|
|
|
40
40
|
return {
|
|
41
41
|
tools: { listChanged: false },
|
|
42
42
|
resources: { listChanged: false, subscribe: false },
|
|
43
|
-
prompts: { listChanged: false },
|
|
44
43
|
logging: {},
|
|
45
44
|
tasks: {
|
|
46
45
|
list: {},
|
|
@@ -391,27 +390,6 @@ function registerTaskHandlers(server) {
|
|
|
391
390
|
});
|
|
392
391
|
});
|
|
393
392
|
}
|
|
394
|
-
function registerPrompts(server) {
|
|
395
|
-
if (config.tools.enabled.includes(FETCH_URL_TOOL_NAME)) {
|
|
396
|
-
server.registerPrompt('summarize-webpage', {
|
|
397
|
-
title: 'Summarize Webpage',
|
|
398
|
-
description: 'Summarize the content of a webpage given its URL.',
|
|
399
|
-
argsSchema: {
|
|
400
|
-
url: z.string().describe('The URL to summarize'),
|
|
401
|
-
},
|
|
402
|
-
}, (args) => ({
|
|
403
|
-
messages: [
|
|
404
|
-
{
|
|
405
|
-
role: 'user',
|
|
406
|
-
content: {
|
|
407
|
-
type: 'text',
|
|
408
|
-
text: `Please summarize the content of the webpage at the following URL: ${args.url}`,
|
|
409
|
-
},
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
}));
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
393
|
export async function createMcpServer() {
|
|
416
394
|
const instructions = await createServerInstructions(config.server.version);
|
|
417
395
|
const serverInfo = await createServerInfo();
|
|
@@ -426,7 +404,6 @@ export async function createMcpServer() {
|
|
|
426
404
|
registerInstructionsResource(server, instructions);
|
|
427
405
|
registerConfigResource(server);
|
|
428
406
|
registerTaskHandlers(server);
|
|
429
|
-
registerPrompts(server);
|
|
430
407
|
return server;
|
|
431
408
|
}
|
|
432
409
|
function attachServerErrorHandler(server) {
|
package/package.json
CHANGED