freshcontext-mcp 0.3.17 → 0.3.18

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,140 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+
5
+ const SOURCE_CHECKOUT_MESSAGE = [
6
+ "This npm script is for the FreshContext source checkout.",
7
+ "The installed npm package supports `npm start` and the `freshcontext-mcp` binary.",
8
+ "Clone the repository to run tests, demos, trust scans, smoke checks, or development scripts.",
9
+ ].join(" ");
10
+
11
+ const commands = {
12
+ build: {
13
+ required: ["src", "tsconfig.json"],
14
+ command: "tsc",
15
+ args: [],
16
+ },
17
+ dev: {
18
+ required: ["src/server.ts"],
19
+ command: "tsx",
20
+ args: ["watch", "src/server.ts"],
21
+ },
22
+ inspect: {
23
+ required: ["src/server.ts"],
24
+ command: "npx",
25
+ args: ["@modelcontextprotocol/inspector", "tsx", "src/server.ts"],
26
+ },
27
+ "example:ha-pri-v2": {
28
+ required: ["examples/ha-pri-v2-example.ts"],
29
+ command: "tsx",
30
+ args: ["examples/ha-pri-v2-example.ts"],
31
+ },
32
+ "demo:arxiv": {
33
+ required: ["examples/evaluate-arxiv-signals.ts"],
34
+ command: "tsx",
35
+ args: ["examples/evaluate-arxiv-signals.ts"],
36
+ },
37
+ "demo:evaluate": {
38
+ required: ["examples/evaluate-with-source-profile.ts"],
39
+ command: "tsx",
40
+ args: ["examples/evaluate-with-source-profile.ts"],
41
+ },
42
+ "demo:evaluate:file": {
43
+ required: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
44
+ command: "tsx",
45
+ args: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
46
+ passThroughArgs: true,
47
+ },
48
+ "smoke:stdio": {
49
+ required: ["scripts/smoke-stdio.mjs"],
50
+ command: "node",
51
+ args: ["scripts/smoke-stdio.mjs"],
52
+ },
53
+ "trust:gate": {
54
+ required: ["scripts/trust-scan.mjs"],
55
+ command: "node",
56
+ args: ["scripts/trust-scan.mjs", "--path", ".", "--repo-map", "--package-gate", "--claim-check", "--fail-on", "fail"],
57
+ },
58
+ "trust:report": {
59
+ required: ["scripts/trust-scan.mjs"],
60
+ command: "node",
61
+ args: ["scripts/trust-scan.mjs", "--path", ".", "--repo-map", "--package-gate", "--claim-check", "--markdown"],
62
+ passThroughArgs: true,
63
+ },
64
+ "trust:report:json": {
65
+ required: ["scripts/trust-scan.mjs"],
66
+ command: "node",
67
+ args: ["scripts/trust-scan.mjs", "--path", ".", "--repo-map", "--package-gate", "--claim-check", "--json"],
68
+ passThroughArgs: true,
69
+ },
70
+ "trust:scan": {
71
+ required: ["scripts/trust-scan.mjs"],
72
+ command: "node",
73
+ args: ["scripts/trust-scan.mjs"],
74
+ passThroughArgs: true,
75
+ },
76
+ "trust:scan:json": {
77
+ required: ["scripts/trust-scan.mjs"],
78
+ command: "node",
79
+ args: ["scripts/trust-scan.mjs", "--json"],
80
+ },
81
+ "trust:scan:markdown": {
82
+ required: ["scripts/trust-scan.mjs"],
83
+ command: "node",
84
+ args: ["scripts/trust-scan.mjs", "--markdown"],
85
+ },
86
+ test: {
87
+ required: ["tests", "tests/trustScan.test.mjs"],
88
+ command: "tsx",
89
+ args: [
90
+ "--test",
91
+ "tests/freshnessStamp.test.ts",
92
+ "tests/hackernews.test.ts",
93
+ "tests/arxivSignals.test.ts",
94
+ "tests/arxivDecisionIntegration.test.ts",
95
+ "tests/core.test.ts",
96
+ "tests/rank.test.ts",
97
+ "tests/workerEnvelope.test.ts",
98
+ "tests/workerCoreEnvelopeParity.test.ts",
99
+ "tests/coreEnvelopeOptions.test.ts",
100
+ "tests/mathSpine.test.ts",
101
+ "tests/coreApiContract.test.ts",
102
+ "tests/corePipeline.test.ts",
103
+ "tests/decision.test.ts",
104
+ "tests/restHandler.test.ts",
105
+ "tests/sourceProfiles.test.ts",
106
+ "tests/adapterRegistry.test.ts",
107
+ "tests/trustScan.test.mjs",
108
+ ],
109
+ },
110
+ };
111
+
112
+ const scriptName = process.argv[2];
113
+ const config = commands[scriptName];
114
+
115
+ if (!config) {
116
+ console.error(`Unknown FreshContext package script: ${scriptName ?? "(missing)"}`);
117
+ process.exit(1);
118
+ }
119
+
120
+ const hasSourceCheckoutFiles = config.required.every((path) => existsSync(path));
121
+ if (!hasSourceCheckoutFiles) {
122
+ console.log(SOURCE_CHECKOUT_MESSAGE);
123
+ process.exit(0);
124
+ }
125
+
126
+ const args = [
127
+ ...config.args,
128
+ ...(config.passThroughArgs ? process.argv.slice(3) : []),
129
+ ];
130
+ const child = spawnSync(config.command, args, {
131
+ stdio: "inherit",
132
+ shell: process.platform === "win32",
133
+ });
134
+
135
+ if (child.error) {
136
+ console.error(child.error.message);
137
+ process.exit(1);
138
+ }
139
+
140
+ process.exit(child.status ?? 0);
package/package.json CHANGED
@@ -1,59 +1,92 @@
1
- {
2
- "name": "freshcontext-mcp",
3
- "mcpName": "io.github.PrinceGabriel-lgtm/freshcontext",
4
- "version": "0.3.17",
5
- "description": "Real-time web intelligence for AI agents. 21 tools, no required API keys. Every result timestamped with a freshness score.",
6
- "keywords": [
7
- "mcp",
8
- "mcp-server",
9
- "ai-agents",
10
- "llm",
11
- "freshness",
12
- "web-scraping",
13
- "github-analytics",
14
- "hackernews",
15
- "yc",
16
- "typescript",
17
- "context",
18
- "model-context-protocol"
19
- ],
20
- "homepage": "https://github.com/PrinceGabriel-lgtm/freshcontext-mcp",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/PrinceGabriel-lgtm/freshcontext-mcp.git"
24
- },
25
- "license": "MIT",
26
- "type": "module",
27
- "engines": {
28
- "node": ">=20"
29
- },
30
- "main": "dist/server.js",
31
- "bin": {
32
- "freshcontext-mcp": "dist/server.js"
33
- },
34
- "scripts": {
35
- "build": "tsc",
36
- "dev": "tsx watch src/server.ts",
37
- "start": "node dist/server.js",
38
- "inspect": "npx @modelcontextprotocol/inspector tsx src/server.ts",
39
- "smoke:stdio": "node scripts/smoke-stdio.mjs",
40
- "test": "jest"
41
- },
42
- "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.0.0",
44
- "apify": "^3.0.0",
45
- "dotenv": "^16.4.0",
46
- "playwright": "^1.44.0",
47
- "zod": "^3.23.0"
48
- },
49
- "devDependencies": {
50
- "@types/jest": "^29.0.0",
51
- "@types/node": "^20.0.0",
52
- "jest": "^29.0.0",
53
- "tsx": "^4.0.0",
54
- "typescript": "^5.4.0"
55
- },
56
- "overrides": {
57
- "file-type": "21.3.4"
58
- }
59
- }
1
+ {
2
+ "name": "freshcontext-mcp",
3
+ "mcpName": "io.github.PrinceGabriel-lgtm/freshcontext",
4
+ "version": "0.3.18",
5
+ "description": "Real-time web intelligence for AI agents. 21 tools, no required API keys. Every result timestamped with a freshness score.",
6
+ "keywords": [
7
+ "mcp",
8
+ "mcp-server",
9
+ "ai-agents",
10
+ "llm",
11
+ "freshness",
12
+ "web-scraping",
13
+ "github-analytics",
14
+ "hackernews",
15
+ "yc",
16
+ "typescript",
17
+ "context",
18
+ "model-context-protocol"
19
+ ],
20
+ "homepage": "https://github.com/PrinceGabriel-lgtm/freshcontext-mcp",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/PrinceGabriel-lgtm/freshcontext-mcp.git"
24
+ },
25
+ "license": "MIT",
26
+ "type": "module",
27
+ "engines": {
28
+ "node": ">=20"
29
+ },
30
+ "main": "dist/server.js",
31
+ "bin": {
32
+ "freshcontext-mcp": "dist/server.js"
33
+ },
34
+ "files": [
35
+ ".env.example",
36
+ "dist/",
37
+ "!dist/apify.js",
38
+ "docs/API_DESIGN.md",
39
+ "docs/CODEX_MCP_USAGE.md",
40
+ "docs/CORE_API.md",
41
+ "docs/DEPENDENCY_DILIGENCE.md",
42
+ "docs/HA_PRI_V2_DESIGN.md",
43
+ "docs/OPERATIONAL_DEMO_RUNBOOK.md",
44
+ "docs/RELEASE_INTEGRITY.md",
45
+ "docs/RELEASE_NOTES.md",
46
+ "docs/SIGNAL_CONTRACT.md",
47
+ "docs/SOURCE_PROFILES.md",
48
+ "freshcontext.schema.json",
49
+ "NOTICE.md",
50
+ "package-script-guard.mjs",
51
+ "SECURITY.md",
52
+ "server.json",
53
+ "TRADEMARKS.md"
54
+ ],
55
+ "scripts": {
56
+ "build": "node package-script-guard.mjs build",
57
+ "dev": "node package-script-guard.mjs dev",
58
+ "start": "node dist/server.js",
59
+ "inspect": "node package-script-guard.mjs inspect",
60
+ "example:ha-pri-v2": "node package-script-guard.mjs example:ha-pri-v2",
61
+ "demo:arxiv": "node package-script-guard.mjs demo:arxiv",
62
+ "demo:evaluate": "node package-script-guard.mjs demo:evaluate",
63
+ "demo:evaluate:file": "node package-script-guard.mjs demo:evaluate:file",
64
+ "smoke:stdio": "node package-script-guard.mjs smoke:stdio",
65
+ "trust:gate": "node package-script-guard.mjs trust:gate",
66
+ "trust:report": "node package-script-guard.mjs trust:report",
67
+ "trust:report:json": "node package-script-guard.mjs trust:report:json",
68
+ "trust:scan": "node package-script-guard.mjs trust:scan",
69
+ "trust:scan:json": "node package-script-guard.mjs trust:scan:json",
70
+ "trust:scan:markdown": "node package-script-guard.mjs trust:scan:markdown",
71
+ "test": "node package-script-guard.mjs test"
72
+ },
73
+ "dependencies": {
74
+ "@modelcontextprotocol/sdk": "^1.0.0",
75
+ "dotenv": "^16.4.0",
76
+ "playwright": "^1.44.0",
77
+ "zod": "^3.23.0"
78
+ },
79
+ "devDependencies": {
80
+ "@types/jest": "^29.0.0",
81
+ "@types/node": "^20.0.0",
82
+ "apify": "^3.0.0",
83
+ "jest": "^29.0.0",
84
+ "tsx": "^4.0.0",
85
+ "typescript": "^5.4.0"
86
+ },
87
+ "overrides": {
88
+ "file-type": "21.3.4",
89
+ "qs": "6.15.2",
90
+ "ws": "8.20.1"
91
+ }
92
+ }
package/server.json CHANGED
@@ -1,28 +1,27 @@
1
- {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
3
- "name": "io.github.PrinceGabriel-lgtm/freshcontext",
4
- "description": "Real-time web intelligence for AI agents. 21 tools, no required API keys. GitHub, HN, Reddit, arXiv, SEC filings, US gov contracts, GDELT global news, Singapore GeBIZ, changelog & more — every result timestamped with a freshness score.",
5
- "repository": {
6
- "url": "https://github.com/PrinceGabriel-lgtm/freshcontext-mcp",
7
- "source": "github"
8
- },
9
- "version": "0.3.17",
10
- "website_url": "https://freshcontext-site.pages.dev",
11
- "packages": [
12
- {
13
- "registry_type": "npm",
14
- "registry_base_url": "https://registry.npmjs.org",
15
- "identifier": "freshcontext-mcp",
16
- "version": "0.3.17",
17
- "transport": {
18
- "type": "stdio"
19
- }
20
- }
21
- ],
22
- "remotes": [
23
- {
24
- "type": "streamable-http",
25
- "url": "https://freshcontext-mcp.gimmanuel73.workers.dev/mcp"
26
- }
27
- ]
28
- }
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
3
+ "name": "io.github.PrinceGabriel-lgtm/freshcontext",
4
+ "description": "Freshness-aware AI retrieval with 21 MCP tools for timestamped, decay-ranked live signals.",
5
+ "repository": {
6
+ "url": "https://github.com/PrinceGabriel-lgtm/freshcontext-mcp",
7
+ "source": "github"
8
+ },
9
+ "version": "0.3.18",
10
+ "website_url": "https://freshcontext-site.pages.dev",
11
+ "packages": [
12
+ {
13
+ "registryType": "npm",
14
+ "identifier": "freshcontext-mcp",
15
+ "version": "0.3.18",
16
+ "transport": {
17
+ "type": "stdio"
18
+ }
19
+ }
20
+ ],
21
+ "remotes": [
22
+ {
23
+ "type": "streamable-http",
24
+ "url": "https://freshcontext-mcp.gimmanuel73.workers.dev/mcp"
25
+ }
26
+ ]
27
+ }
package/dist/apify.js DELETED
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Apify Actor entry point — FreshContext MCP v0.3.13
4
- *
5
- * Reads Actor input, calls the appropriate adapter, pushes to dataset, exits.
6
- * All 19 tools supported. Robust error handling throughout.
7
- */
8
- import { Actor } from "apify";
9
- import { githubAdapter } from "./adapters/github.js";
10
- import { hackerNewsAdapter } from "./adapters/hackernews.js";
11
- import { scholarAdapter } from "./adapters/scholar.js";
12
- import { arxivAdapter } from "./adapters/arxiv.js";
13
- import { redditAdapter } from "./adapters/reddit.js";
14
- import { ycAdapter } from "./adapters/yc.js";
15
- import { productHuntAdapter } from "./adapters/productHunt.js";
16
- import { repoSearchAdapter } from "./adapters/repoSearch.js";
17
- import { packageTrendsAdapter } from "./adapters/packageTrends.js";
18
- import { financeAdapter } from "./adapters/finance.js";
19
- import { jobsAdapter } from "./adapters/jobs.js";
20
- import { changelogAdapter } from "./adapters/changelog.js";
21
- import { govContractsAdapter } from "./adapters/govcontracts.js";
22
- import { secFilingsAdapter } from "./adapters/secFilings.js";
23
- import { gdeltAdapter } from "./adapters/gdelt.js";
24
- import { gebizAdapter } from "./adapters/gebiz.js";
25
- import { stampFreshness } from "./tools/freshnessStamp.js";
26
- async function main() {
27
- await Actor.init();
28
- let input;
29
- try {
30
- const raw = await Actor.getInput();
31
- if (!raw || !raw.tool) {
32
- await Actor.fail("Missing input. Provide a 'tool' field. E.g. { \"tool\": \"extract_hackernews\", \"url\": \"https://news.ycombinator.com\" }");
33
- return;
34
- }
35
- input = raw;
36
- }
37
- catch (err) {
38
- const msg = err instanceof Error ? err.message : String(err);
39
- await Actor.fail(`Failed to read input: ${msg}`);
40
- return;
41
- }
42
- // Resolve the primary string input — different tools use different field names
43
- const url = input.url ?? input.query ?? input.topic ?? input.company ?? input.tickers ?? "";
44
- const maxLength = input.max_length ?? 8000;
45
- console.log(`FreshContext Actor | tool: ${input.tool} | input: "${url}"`);
46
- try {
47
- let result;
48
- switch (input.tool) {
49
- // ── Standard tools ────────────────────────────────────────────
50
- case "extract_github":
51
- result = await githubAdapter({ url, maxLength });
52
- break;
53
- case "extract_hackernews":
54
- result = await hackerNewsAdapter({ url, maxLength });
55
- break;
56
- case "extract_scholar":
57
- result = await scholarAdapter({ url, maxLength });
58
- break;
59
- case "extract_arxiv":
60
- result = await arxivAdapter({ url, maxLength });
61
- break;
62
- case "extract_reddit":
63
- result = await redditAdapter({ url, maxLength });
64
- break;
65
- case "extract_yc":
66
- result = await ycAdapter({ url, maxLength });
67
- break;
68
- case "extract_producthunt":
69
- result = await productHuntAdapter({ url, maxLength });
70
- break;
71
- case "search_repos":
72
- result = await repoSearchAdapter({ url, maxLength });
73
- break;
74
- case "package_trends":
75
- result = await packageTrendsAdapter({ url, maxLength });
76
- break;
77
- case "extract_finance":
78
- result = await financeAdapter({ url, maxLength });
79
- break;
80
- case "search_jobs":
81
- result = await jobsAdapter({ url, maxLength });
82
- break;
83
- case "extract_changelog":
84
- result = await changelogAdapter({ url, maxLength });
85
- break;
86
- // ── Unique tools ──────────────────────────────────────────────
87
- case "extract_govcontracts":
88
- result = await govContractsAdapter({ url, maxLength });
89
- break;
90
- case "extract_sec_filings":
91
- result = await secFilingsAdapter({ url, maxLength });
92
- break;
93
- case "extract_gdelt":
94
- result = await gdeltAdapter({ url, maxLength });
95
- break;
96
- case "extract_gebiz":
97
- result = await gebizAdapter({ url, maxLength });
98
- break;
99
- default:
100
- await Actor.fail(`Unknown tool: "${input.tool}". Valid tools: ` +
101
- "extract_github, extract_hackernews, extract_scholar, extract_arxiv, " +
102
- "extract_reddit, extract_yc, extract_producthunt, search_repos, " +
103
- "package_trends, extract_finance, search_jobs, extract_changelog, " +
104
- "extract_govcontracts, extract_sec_filings, extract_gdelt, extract_gebiz");
105
- return;
106
- }
107
- const ctx = stampFreshness(result, { url, maxLength }, input.tool);
108
- await Actor.pushData({
109
- tool: ctx.adapter,
110
- source_url: ctx.source_url,
111
- content: ctx.content,
112
- retrieved_at: ctx.retrieved_at,
113
- content_date: ctx.content_date ?? null,
114
- freshness_confidence: ctx.freshness_confidence,
115
- });
116
- console.log(`✓ Done | retrieved: ${ctx.retrieved_at} | confidence: ${ctx.freshness_confidence}`);
117
- await Actor.exit();
118
- }
119
- catch (err) {
120
- const message = err instanceof Error ? err.message : String(err);
121
- console.error(`FreshContext error: ${message}`);
122
- await Actor.fail(message);
123
- }
124
- }
125
- main().catch(async (err) => {
126
- const message = err instanceof Error ? err.message : String(err);
127
- console.error(`Fatal error: ${message}`);
128
- try {
129
- await Actor.fail(message);
130
- }
131
- catch { /* ignore */ }
132
- process.exit(1);
133
- });