freshcontext-mcp 0.1.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.
@@ -0,0 +1,33 @@
1
+ import { FreshContext, AdapterResult, ExtractOptions } from "../types.js";
2
+
3
+ export function stampFreshness(
4
+ result: AdapterResult,
5
+ options: ExtractOptions,
6
+ adapter: string
7
+ ): FreshContext {
8
+ return {
9
+ content: result.raw.slice(0, options.maxLength ?? 8000),
10
+ source_url: options.url,
11
+ content_date: result.content_date,
12
+ retrieved_at: new Date().toISOString(),
13
+ freshness_confidence: result.freshness_confidence,
14
+ adapter,
15
+ };
16
+ }
17
+
18
+ export function formatForLLM(ctx: FreshContext): string {
19
+ const dateInfo = ctx.content_date
20
+ ? `Published: ${ctx.content_date}`
21
+ : "Publish date: unknown";
22
+
23
+ return [
24
+ `[FRESHCONTEXT]`,
25
+ `Source: ${ctx.source_url}`,
26
+ `${dateInfo}`,
27
+ `Retrieved: ${ctx.retrieved_at}`,
28
+ `Confidence: ${ctx.freshness_confidence}`,
29
+ `---`,
30
+ ctx.content,
31
+ `[/FRESHCONTEXT]`,
32
+ ].join("\n");
33
+ }
package/src/types.ts ADDED
@@ -0,0 +1,22 @@
1
+ // Core data types for freshcontext-mcp
2
+
3
+ export interface FreshContext {
4
+ content: string;
5
+ source_url: string;
6
+ content_date: string | null; // When the content was originally published
7
+ retrieved_at: string; // When WE fetched it (always now)
8
+ freshness_confidence: "high" | "medium" | "low";
9
+ adapter: string;
10
+ }
11
+
12
+ export interface ExtractOptions {
13
+ url: string;
14
+ prompt?: string; // What specifically to look for
15
+ maxLength?: number; // Truncate content to this length
16
+ }
17
+
18
+ export interface AdapterResult {
19
+ raw: string;
20
+ content_date: string | null;
21
+ freshness_confidence: "high" | "medium" | "low";
22
+ }
@@ -0,0 +1,2 @@
1
+ @echo off
2
+ "C:\Program Files\nodejs\npx.cmd" tsx "C:\Users\Immanuel Gabriel\Downloads\freshcontext-mcp\src\server.ts"
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "lib": ["ES2022"],
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "resolveJsonModule": true
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "dist", "tests"]
17
+ }