{
  "markdown": "# FreshContext\n\nI asked Claude to help me find a job. It gave me a list of openings. I applied to three of them. Two didn't exist anymore. One had been closed for two years.\n\nClaude had no idea. It presented everything with the same confidence.\n\nThat's the problem freshcontext fixes.\n\nThis repository is the integrated FreshContext Core/MCP package. FreshContext is the context judgment layer between retrieval and reasoning. Core is the reusable engine that scores, ranks, explains, and turns candidate context into decision-ready context; MCP is the first live host/interface over that engine.\n\n[![npm version](https://img.shields.io/npm/v/freshcontext-mcp)](https://www.npmjs.com/package/freshcontext-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-Listed-blue)](https://registry.modelcontextprotocol.io)\n\n> **Live demo:** [freshcontext-mcp.gimmanuel73.workers.dev/demo](https://freshcontext-mcp.gimmanuel73.workers.dev/demo) — same model, same query, two completely different answers. Only the temporal layer changed.\n\n---\n\n## The problem\n\nLarge language models retrieve web data semantically. Cosine similarity finds the documents that match a query best — but cosine doesn't know when a document was written.\n\nSo a 2022 blog post and a 2026 paper can score nearly identically. The model gets a context window full of stale documents and faithfully summarizes 2022 advice for a 2026 question.\n\nThat's not hallucination. That's correct summarization of corrupted retrieval.\n\n> **Most RAG pipelines rank context correctly semantically but incorrectly temporally.**\n\n---\n\n## The layer\n\nFreshContext is **context integrity infrastructure for AI agents and retrieval systems**. It sits between retrieval and reasoning:\n\n```text\ncandidate context\n  -> FreshContext Core\n  -> decision-ready context\n  -> model / agent / app\n```\n\nFreshContext evaluates freshness, source profile, confidence, utility, provenance material, and failure honesty before context reaches the LLM. The temporal core uses Decay-Adjusted Relevancy:\n\n```\nR_t = R_0 · e^(−λt)\n```\n\n- `R_0` — base semantic relevancy (whatever your retriever already gives you)\n- `λ` — source-specific decay constant (HN ≈14h half-life, blogs ≈29d, academic papers ≈1.6y)\n- `t` — hours elapsed since publication\n- `R_t` — decay-adjusted relevancy at query time\n\nThat's the core correction. No model swap. No re-embedding. No re-indexing. The layer drops onto whatever retrieval pipeline you already have.\n\n**The layer is the product.** The named adapters shipped with this repo demonstrate compatibility across different source classes. The DAR engine, the freshness envelope, Source Profiles, and the FreshContext Specification are the moat.\n\n---\n\n## The standard\n\nEvery FreshContext-compatible response wraps content in a structured envelope:\n\n```\n[FRESHCONTEXT]\nSource: https://github.com/owner/repo\nPublished: 2024-11-03\nRetrieved: 2026-03-05T09:19:00Z\nConfidence: high\n---\n... content ...\n[/FRESHCONTEXT]\n```\n\n**When** it was retrieved. **Where** it came from. **How confident** we are the date is accurate.\n\nThe FreshContext Specification v1.2 is published as an open standard under MIT licence. Any tool, agent, or system that wraps retrieved data in this envelope is FreshContext-compatible. → [Read the spec](./FRESHCONTEXT_SPEC.md) · [Read the methodology](./METHODOLOGY.md)\n\n---\n\n## Architecture boundary\n\nFreshContext Core is the reusable center of the current integrated package. It owns signal normalization, freshness scoring, Source Profiles, decision output, envelope formatting, failure guards, shared types, rank/explain primitives, and the context-conditioned utility primitive.\n\nMCP is the primary reference/interface implementation over Core. Claude Desktop is supported, but not required. The MCP tool surface exposes named reference adapters and a live interface for using the system.\n\nThe production Cloudflare Worker now uses Core-backed envelope generation. Worker-specific concerns remain outside Core: MCP transport, runtime guards, KV cache policy, cache metadata injection, JSON parse/replace cache helpers, D1 feeds, cron, rate limiting, and Store/feed scoring/provenance.\n\nSee [Core / MCP Boundary](./docs/CORE_MCP_BOUNDARY.md) for the current package boundary and the staged path toward a future standalone Core package.\n\n### Core import path\n\nFreshContext Core is also available directly from the current MCP package:\n\n```ts\nimport {\n  evaluateSignals,\n  interpretEvaluations,\n  getSourceProfile,\n  normalizeSignal,\n  calculateHaPriV2,\n} from \"freshcontext-mcp/core\";\n```\n\nThis is a Core subpath export inside `freshcontext-mcp`, not a standalone `freshcontext-core` package yet. The root package and `freshcontext-mcp` binary remain the MCP reference host.\n\n---\n\n## Primary MCP interface\n\nThe clearest MCP path is `evaluate_context`.\n\nIt accepts candidate context from any retriever, agent, database, local script, note parser, or adapter output:\n\n```json\n{\n  \"profile\": \"academic_research\",\n  \"intent\": \"citation_check\",\n  \"signals\": [\n    {\n      \"title\": \"Example source\",\n      \"content\": \"Candidate context text...\",\n      \"source\": \"https://example.com/source\",\n      \"source_type\": \"arxiv\",\n      \"published_at\": \"2026-05-24T12:00:00.000Z\",\n      \"retrieved_at\": \"2026-05-24T13:00:00.000Z\",\n      \"semantic_score\": 0.92\n    }\n  ]\n}\n```\n\nFreshContext returns decision-first output:\n\n- Decision\n- Meaning\n- Action\n- Warnings\n- Source\n- Freshness\n- Rank score\n- Utility\n- Confidence\n- Why\n\nStructured results also include a `readable` object for humans:\n\n```json\n{\n  \"decision\": \"cite_as_primary\",\n  \"label\": \"Cite as primary\",\n  \"readable\": {\n    \"label\": \"Primary source\",\n    \"summary\": \"This source is strong enough to use as main evidence.\",\n    \"why\": [\n      \"Strong semantic match and current freshness for arxiv.\",\n      \"source profile academic_research uses lenient date policy\",\n      \"intent profile citation_check selected\"\n    ],\n    \"action\": \"Use this as main evidence while preserving citation and provenance.\",\n    \"warnings\": [\n      \"FreshContext judges citation readiness and context usefulness; it does not certify truth.\"\n    ]\n  }\n}\n```\n\nThe readable object translates Core decisions into user-facing language. It does not change ranking, decision labels, utility scoring, or source intake. Utility helps explain usefulness for the current question; it remains explanatory and does not control default decision labels or ranking.\n\nFreshContext does not certify truth. It records why context was used, supported, questioned, refreshed, watched, or excluded before it reaches a model.\n\n`evaluate_context` does not fetch URLs, crawl, scrape, browse, read folders, or call adapters. It only evaluates candidate context the caller provides.\n\nCurrent boundary: `evaluate_context` ships in the npm/local stdio MCP server. The hosted Cloudflare Worker MCP endpoint is a separate deployment surface and is verified independently — check `/v1/health` for its live version and tool count rather than assuming parity with the package. The Worker remains a separate deployment surface, so future package interfaces should be re-verified remotely before being claimed live.\n\n### Network Boundary\n\nFreshContext's primary `evaluate_context` path does not fetch, crawl, scrape, browse, read folders, or call adapters. The MCP package also includes read-only reference adapters that use network access only when those adapter tools are invoked. Supply-chain scanners may therefore report package network access; that applies to the optional adapter surface, not to caller-provided context evaluation.\n\n---\n\n## Advanced Worker/feed surface\n\nBeyond the per-call Core/MCP paths, the production Worker deployment exposes a continuous, decay-scored, deduplicated feed. This is an advanced deployment surface, not the required way to use FreshContext Core:\n\n```\nGET /v1/intel/feed/:profile_id?limit=20&min_rt=0\n```\n\nEvery signal is stamped with `base_score`, `rt_score`, `entropy_level` (low / stable / high), `ha_pri_sig` (Ha-Pri v1 SHA-256 provenance reference), `semantic_fingerprint` (cross-adapter dedup), and `published_at`. Ready for direct LLM or agent consumption — no synthesis required.\n\nProduction endpoint: `https://freshcontext-mcp.gimmanuel73.workers.dev`\n\n---\n\n## Reference adapters\n\nThe repo ships named reference adapters that demonstrate how different source classes can become FreshContext-compatible. Each adapter keeps its own name because it represents a source boundary; the adapter count is operational proof, not the product headline.\n\n### Intelligence\n| Adapter | What it returns |\n|---|---|\n| `extract_github` | README, stars, forks, language, topics, last commit |\n| `extract_hackernews` | Top stories or search results with scores and timestamps |\n| `extract_scholar` | Research papers — titles, authors, years, snippets |\n| `extract_arxiv` | arXiv papers via official API |\n| `extract_reddit` | Posts and community sentiment from any subreddit |\n\n### Competitive research\n| Adapter | What it returns |\n|---|---|\n| `extract_yc` | YC company listings by keyword |\n| `extract_producthunt` | Recent launches by topic |\n| `search_repos` | GitHub repos ranked by stars with activity signals |\n| `package_trends` | npm and PyPI metadata — version history, release cadence |\n\n### Market data\n| Adapter | What it returns |\n|---|---|\n| `extract_finance` | No-key Stooq quote data — close, OHLC, volume, quote timestamp, source. Up to 5 tickers. |\n| `search_jobs` | Remote job listings from Remotive, RemoteOK, HN \"Who is Hiring\" |\n\n### Composites — multiple sources, one call\n| Adapter | Sources | Purpose |\n|---|---|---|\n| `extract_landscape` | 6 | YC + GitHub + HN + Reddit + Product Hunt + npm in parallel |\n| `extract_idea_landscape` | 6 | HN + YC + GitHub + Jobs + npm + Product Hunt — full idea validation |\n| `extract_gov_landscape` | 4 | Gov contracts + HN + GitHub + changelog |\n| `extract_finance_landscape` | 5 | Finance + HN + Reddit + GitHub + changelog |\n| `extract_company_landscape` | 5 | The full picture on any company |\n\n### Official, regulatory, and procurement sources\n| Adapter | Source | What it returns |\n|---|---|---|\n| `extract_changelog` | GitHub Releases / npm / auto-discover | Update history from any repo, package, or website |\n| `extract_govcontracts` | USASpending.gov | US federal contract awards — company, amount, agency, period |\n| `extract_sec_filings` | SEC EDGAR | 8-K filings — legally mandated material event disclosures |\n| `extract_gdelt` | GDELT Project | Global news intelligence — 100+ languages, 15-min updates |\n| `extract_gebiz` | data.gov.sg | Singapore Government procurement tenders — open dataset |\n\n---\n\n## Quick start\n\nFor Claude Desktop, Codex, `npx`, global npm, and source-checkout setup, see the concise [client setup guide](./docs/CLIENT_SETUP.md).\n\n### Cloud (no install)\n\nAdd to your Claude Desktop config and restart:\n\n**Mac:** `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"freshcontext\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-remote\", \"https://freshcontext-mcp.gimmanuel73.workers.dev/mcp\"]\n    }\n  }\n}\n```\n\nRestart Claude. Done.\n\n> Prefer a guided setup? Visit **[freshcontext-site.pages.dev](https://freshcontext-site.pages.dev)** — 3 steps, no terminal.\n\n### Local (full Playwright)\n\n**Requires:** Node.js 20+ ([nodejs.org](https://nodejs.org))\n\n```bash\ngit clone https://github.com/PrinceGabriel-lgtm/freshcontext-mcp\ncd freshcontext-mcp\nnpm install\nnpx playwright install chromium\nnpm run build\n```\n\nAdd to Claude Desktop config:\n\n**Mac:**\n```json\n{\n  \"mcpServers\": {\n    \"freshcontext\": {\n      \"command\": \"node\",\n      \"args\": [\"/Users/YOUR_USERNAME/path/to/freshcontext-mcp/dist/server.js\"]\n    }\n  }\n}\n```\n\n**Windows:**\n```json\n{\n  \"mcpServers\": {\n    \"freshcontext\": {\n      \"command\": \"node\",\n      \"args\": [\"C:\\\\Users\\\\YOUR_USERNAME\\\\path\\\\to\\\\freshcontext-mcp\\\\dist\\\\server.js\"]\n    }\n  }\n}\n```\n\n#### Mac troubleshooting\n\n**\"command not found: node\"** — Use the full path:\n```bash\nwhich node  # copy this output, replace \"node\" in config\n```\n\n**Config file doesn't exist:**\n```bash\nmkdir -p ~/Library/Application\\ Support/Claude\ntouch ~/Library/Application\\ Support/Claude/claude_desktop_config.json\n```\n\n---\n\n## Usage examples\n\nThe `npm run demo:*` commands below are source-checkout workflows for contributors and evaluators using a cloned repository. The published npm package is the MCP server/runtime package and does not include repo-only source examples or tests.\n\nFrom an installed npm package, the supported runtime entrypoints are `npm start` and the `freshcontext-mcp` binary. Repo-only scripts such as tests, demos, smoke checks, and trust scans print a source-checkout notice when their source files are not present.\n\nThe Apify Actor entrypoint remains available in the source checkout for separate actor packaging, but it is intentionally not part of the published MCP npm runtime package.\n\n### Release trust gate\n\nRun the local release gate before a release, package review, demo, or PR review:\n\n```bash\nnpm run trust:gate\n```\n\nThe gate runs the Trust Scanner with repo-map reporting, npm package-boundary inspection, deterministic claim checks, and `--fail-on fail`. It is local-only, does not publish or deploy, does not send telemetry, and does not replace dedicated security scanners.\n\nGenerate review reports when you need a shareable summary:\n\n```bash\nnpm run trust:report\nnpm run trust:report:json\n```\n\nTo write a Markdown report file explicitly:\n\n```bash\nnpm run trust:report -- --output TRUST_SCAN_REPORT.md\n```\n\n### Bring your own source list\n\nFreshContext can evaluate candidate context you provide as a local JSON file:\n\n```bash\nnpm run demo:evaluate:file\n```\n\nTo pass a different file:\n\n```bash\nnpm run demo:evaluate:file -- path/to/sources.json\n```\n\nIncluded examples:\n\n```bash\nnpm run demo:evaluate:file -- examples/sources.academic.example.json\nnpm run demo:evaluate:file -- examples/sources.jobs.example.json\n```\n\nMinimal shape:\n\n```json\n{\n  \"profile\": \"academic_research\",\n  \"intent\": \"citation_check\",\n  \"signals\": [\n    {\n      \"title\": \"...\",\n      \"content\": \"...\",\n      \"source\": \"...\",\n      \"source_type\": \"arxiv\",\n      \"published_at\": \"...\",\n      \"retrieved_at\": \"...\",\n      \"semantic_score\": 0.92\n    }\n  ]\n}\n```\n\nThis local demo does not fetch URLs, crawl, or read folders. It evaluates candidate context you provide and returns decision-first output: Decision, Meaning, Action, Warnings, and supporting metrics.\n\nIn an MCP client, use `evaluate_context` when you already have candidate context from another retriever, database, agent, or script:\n\n```text\nUse evaluate_context with profile \"academic_research\", intent \"citation_check\", and these candidate signals: [...]\n```\n\nUse the named reference adapters when you want FreshContext's current MCP package to fetch public source examples for you.\n\n**Should I build this idea?**\n```\nUse extract_idea_landscape with idea \"procurement intelligence saas\"\n```\nReturns funding signal, pain signal, crowding signal, market signal, ecosystem signal, and launch signal — all timestamped.\n\n**Full company intelligence in one call:**\n```\nUse extract_company_landscape with company \"Palantir\" and ticker \"PLTR\"\n```\nSEC filings + federal contracts + global news + changelog + market data.\n\n**Did that company just disclose something material?**\n```\nUse extract_sec_filings with url \"Palantir Technologies\"\n```\n8-K filings are legally mandated within 4 business days of any material event — CEO change, acquisition, breach, major contract.\n\n**Is this dependency still actively maintained?**\n```\nUse extract_changelog with url \"https://github.com/org/repo\"\n```\nReturns the last 8 releases with exact dates. If the last release was 18 months ago, you'll know before you pin the version.\n\n---\n\n## Deployment & infrastructure\n\nThe reference implementation runs on Cloudflare's global edge:\n\n| Endpoint | Method | Purpose |\n|---|---|---|\n| `/` | GET | Service info + endpoint list |\n| `/health` | GET | Liveness check |\n| `/mcp` | POST | MCP JSON-RPC transport |\n| `/demo` | GET | Live before/after demo (no auth token required) |\n| `/briefing` | GET | Latest stored briefing |\n| `/v1/intel/feed/:profile_id` | GET | DAR-scored intelligence feed |\n| `/watched-queries` | GET | List all watched queries |\n\n- **D1 database** — 18 watched queries running on 6-hour cron with relevancy scoring\n- **KV-backed rate limiting** — 60 req/min per IP across all edge nodes\n- **Defensive valves** — clock-skew rejection (5min tolerance), hard floor at R_t<5, lazy decay at read time\n- **Provenance** — Ha-Pri v1 SHA-256 provenance stamps on stored signals; hard tamper enforcement is a future Ha-Pri v2 path\n- **Schema migrations** — promise-gated, idempotent, run on first request after deploy\n\nProduction: `https://freshcontext-mcp.gimmanuel73.workers.dev`\n\n---\n\n## Roadmap\n\n- [x] FreshContext Specification v1.2 published (MIT, open standard)\n- [x] DAR engine with source-specific lambda constants\n- [x] Ha-Pri v1 provenance signatures on stored signals\n- [x] Semantic deduplication via fingerprinting\n- [x] Live before/after demo at `/demo`\n- [x] METHODOLOGY.md — methodology and engineering documentation\n- [x] Named reference adapters across intelligence, competitive research, market data, and composites\n- [x] Generic MCP `evaluate_context` tool for caller-provided candidate context\n- [x] Core-backed envelope generation shared by npm/MCP and the Cloudflare Worker\n- [x] Cloudflare Workers deployment — global edge, KV cache, KV rate limiting\n- [x] Published on npm and listed for MCP usage; Apify/feed assets are separated from the normal MCP runtime package\n- [x] Ha-Pri v2 Core helper and deterministic golden vectors\n- [x] Ha-Pri v2 production-enforcement design document\n- [ ] Ha-Pri v2 Worker/D1 production enforcement\n- [x] GitHub Actions release workflow — manual or `v*` tag-triggered npm publish path\n- [ ] Webhook triggers — push high-entropy signals on threshold\n- [ ] Dashboard — React frontend for the D1 intelligence pipeline\n- [ ] GKG upgrade for `extract_gdelt` — tone scores, goldstein scale, event codes\n\nFuture work is organized in [FreshContext Future Lanes](./docs/FUTURE_LANES.md). Roadmap items are not live product claims until implemented and validated.\n\n---\n\n## Contributing\n\nPRs welcome. The highest-value contributions improve the caller-provided context path, decision output, host integrations, and FreshContext-compatible signal quality. New reference adapters are useful when they preserve source boundaries and emit timestamped, failure-honest context — see `src/adapters/` for examples and [`FRESHCONTEXT_SPEC.md`](./FRESHCONTEXT_SPEC.md) for the compatibility contract.\n\nIf you're building something FreshContext-compatible, open an issue and we'll add you to the ecosystem list.\n\n---\n\n## Trust and security\n\n- [LICENSE](./LICENSE)\n- [SECURITY.md](./SECURITY.md)\n- [NOTICE.md](./NOTICE.md)\n- [TRADEMARKS.md](./TRADEMARKS.md)\n- [Dependency diligence notes](./docs/DEPENDENCY_DILIGENCE.md)\n- [Release integrity notes](./docs/RELEASE_INTEGRITY.md)\n- [Release notes](./docs/RELEASE_NOTES.md)\n\n---\n\n## License\n\nMIT\n\n---\n\n*Built by Prince Gabriel — Grootfontein, Namibia 🇳🇦*\n*\"The work isn't gone. It's just waiting to be continued.\"*\n\n---\n\n**Also on:** [MCP Registry](https://registry.modelcontextprotocol.io) · [npm](https://www.npmjs.com/package/freshcontext-mcp)\n",
  "bytes": 19620,
  "sha": "7b6ac3fed2a0043207ac042ed6c576cca93005a03e8fe7a45d786174b7a6f2ed",
  "repo_slug": "princegabriel-lgtm/freshcontext-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_princegabriel_lgtm_freshcontex_3bd11e5a/readme"
}