SuperAPI AI Directory

Context-First-MCP

Session memory with tiered storage, context health monitoring, reasoning quality checks and truthfulness verification.

Open website

About this tool

Context-First MCP is an MCP (Model Context Protocol) server whose goal is to solve the problems that easily arise in long conversations with AI, such as context fragmentation, state loss, degraded reasoning quality, and factual inaccuracy. It claims to "keep AI grounded, coherent, and honest in every turn of the conversation," and can be used with Claude Desktop, Cursor, VS Code, any MCP client, and Vercel remote environments, with no API key required.

Main capabilities The server provides 37 tools, divided into 7 layers, plus 1 orchestrator for unified scheduling:

  • Layer 1: Core context health (9 tools)
  • Layer 1b: State management (4 tools)
  • Layer 2: Sandbox and discovery (3 tools)
  • Layer 3: Persistent memory (6 tools)
  • Layer 4: Advanced reasoning (5 tools)
  • Layer 5: Truthfulness and verification (7 tools)
  • Research pipeline and export (2 tools)
  • Export assistance (1 tool)

The core orchestrator context_loop can run multiple stages in a single call, returns a unified action directive, and follows the synthesis priority of "abstain > reset > clarify > continue." Each stage runs independently with error isolation, and the results include the duration, status, and detailed results of each stage for easy observability.

How to use

  • npx zero-install: run the context-first-mcp entry point via npx, using stdio transport.
  • Cursor / VS Code: connect as an MCP client.
  • Remote (Streamable HTTP): you can deploy your own Vercel instance, and the remote server provides 37 tools.
  • The core library @xjtlumedia/context-first-mcp-server contains all tool implementations, is heuristic-based by default, and requires no external API key.
  • You can try all 37 tools in the browser at context-first-mcp.vercel.app.

Usage protocol and compliance mechanisms The server has four built-in zero-configuration compliance mechanisms:

  1. Server instructions: inject the full usage protocol through ServerOptions.instructions during the MCP handshake.
  2. Bootstrap gate: the first non-context_loop calls append a strong redirection reminder.
  3. Cross-tool reminder: after 3 consecutive calls without invoking context_loop, a reminder appears in the tool response.
  4. MCP prompts: provide context-first-protocol and research-protocol prompt templates on demand. Users can also reinforce this themselves in the system prompt.

Research Task Workflow research_pipeline orchestrates memory, stage control, reasoning, and autonomous file writing. It is not itself a web crawler; users need to provide sources themselves (such as web search, GitHub, scraping tools, PDFs, or other MCPs). Autonomous file writing is always on, and by default writes to the ./context-first-research-output/ directory, without requiring LLM cooperation, and can be overridden via the outputDir parameter.

Technical Implementation and Research Basis Every core algorithm traces back to published papers:

  • Agent entropy (ERGO): replaces inaccessible token-level logprobs with 4 response-level proxy signals (lexical diversity, contradiction density, hedge word frequency, n-gram repetition), and triggers an adaptive context reset when the composite score exceeds a threshold.
  • TF-IDF discovery (MCP-Zero): a pure TypeScript implementation with zero external dependencies. At startup, it indexes all tool descriptions and routes queries to the most relevant top-k tools via cosine similarity.
  • Inference-time abstention (RLAAR): replaces the reinforcement learning training loop with 5-dimensional confidence scoring, and abstains with targeted questions when confidence is below a threshold, rather than falling back to hallucination.

Applicable Scenarios Suitable for AI application development scenarios that need long conversations to remain coherent, need persistent memory, need reasoning quality monitoring, need authenticity verification, and need structured research with automatic file export.

Limitations The materials do not provide specific pricing, fees, platform compatibility details, performance data, or effectiveness guarantees. The research pipeline does not include web crawling functionality, and users must provide their own sources.