
Context First Mcp
io.github.XJTLUmedia由 GitHub 账号 XJTLUmedia 发布v1.2.2更新于 Oct 25, 2026
37-tool MCP server: context health, memory, reasoning, truthfulness & research pipeline.
概览
一个本地 MCP 服务器,为助手提供上下文健康、记忆、推理与真实性检查,让长对话保持有据可依、前后一致。
- 可以做什么
- 运行一次上下文循环,回顾意图、标记冲突、歧义与漂移,并返回带健康分数和澄清问题的单一行动指令。锁定并读取已确认事实与任务状态,查看压缩后的对话历史。存储、召回、压缩、整理并构建持久记忆图谱,并把子任务上下文隔离到可合并的隔离区。按自然语言查询路由到相关工具,并运行结构化推理与自我批评流程。运行分阶段研究流水线,把报告片段和原始证据批次写入磁盘。
- 适用场景
- 适合长时间、多步骤的会话,尤其是助手容易忘记早先决定、与已锁定事实矛盾,或未经验证就宣称成功的情况。也适合需要最终把结果写成磁盘文件的结构化研究任务。
- 运行要求
- 通过 stdio 在本地运行,通常用 npx 启动,因此需要 Node.js。README 还提到可改用托管远程端点。未声明任何 API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Context First Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Context-First MCP
The MCP server that keeps your AI grounded, coherent, and honest — across every turn.
[npm version] [npm downloads] [License: MIT] [MCP Compatible] [Smithery] [Glama] [Node ≥18] [TypeScript]
Works instantly with Claude Desktop · Cursor · VS Code · any MCP client · Vercel remote — zero API keys needed.
37 research-backed tools across 7 layers — context health, state, sandboxing, persistent memory, advanced reasoning, truthfulness verification, orchestration, structured research, and autonomous file export. One
context_loopcall replaces 6–7 individual tools and returns a unified action directive.
Why Your AI Conversations Break Down
Long AI conversations fail in predictable ways. Context-First fixes all four:
What You Get
37 production-ready tools grouped into 7 layers — plus 1 orchestrator that runs them all:
One call. One directive. One score.
Quick Start
npx — zero install
Claude Desktop
Cursor / VS Code
Remote (Streamable HTTP)
Deploy your own Vercel instance
Tool Reference
Layer 1: Core Context Health (9 tools)
Layer 1b: State Management (4 tools)
Layer 2: Sandbox & Discovery (3 tools)
Layer 3: Persistent Memory (6 tools)
Layer 4: Advanced Reasoning (5 tools)
Layer 5: Truthfulness & Verification (7 tools)
Research Pipeline & Export (2 tools)
Built on Peer-Reviewed Research
Every core algorithm traces back to a published paper:
Implementation highlights:
- Proxy Entropy (ERGO): 4 response-level proxy signals (lexical diversity, contradiction density, hedge-word frequency, n-gram repetition) replace inaccessible token-level logprobs. Composite score above threshold triggers adaptive context reset.
- TF-IDF Discovery (MCP-Zero): Pure TypeScript, zero external dependencies. Indexes all tool descriptions at startup; cosine similarity routes queries to the top-k relevant tools only.
- Inference-Time Abstention (RLAAR): 5-dimension confidence scoring replaces the RL training loop. Abstains with targeted questions when confidence < threshold — no hallucination fallback.
Export Helper (1 tool)
context_loop Pipeline
Synthesis Priority: abstain > reset > clarify > proceed
Each stage runs with independent error isolation — a failure in one stage doesn't block the others. The result includes per-stage timing, status, and detailed results for observability.
LLM Directive (NEW)
The context_loop response includes a top-level directive object designed for LLM consumption — a compact, actionable instruction that replaces the need to parse nested stage results:
How context_loop Works
Synthesis priority: abstain > reset > clarify > proceed
Each stage runs with independent error isolation. The directive response field carries everything an LLM needs:
Smart defaults: currentInput is auto-inferred from the last user message. Facts like "use React" are extracted and stored automatically.
Usage Protocol: Getting the Most from Context-First
The #1 mistake: LLMs treat
context_loopas optional. It's not — it's the backbone.
Built-in Enforcement (v1.2.1+)
The server ships with four compliance mechanisms that require zero configuration:
- Server Instructions — Full usage protocol injected at MCP handshake via
ServerOptions.instructions - Bootstrap Gate — First non-
context_loopcall appends a strong redirect reminder - Cross-Tool Reminders — After 3 consecutive calls without
context_loop, reminders appear in tool responses - MCP Prompts —
context-first-protocolandresearch-protocolprompt templates available on demand
Reinforce in Your System Prompt (Optional)
Research Task Workflow
research_pipeline orchestrates memory, phase control, reasoning, and autonomous file writing. It is not a web crawler — bring your own sources from web search, GitHub, fetch tools, PDFs, or any other MCP.
Autonomous file writing is always on. Files are written to ./context-first-research-output/ by default — no LLM cooperation required. Pass outputDir to override.
Architecture
- Core library (
@xjtlumedia/context-first-mcp-server): All tool implementations. Zero external API keys — heuristic-based by default. - stdio-server (
context-first-mcp):npxentry point, stdio transport, 37 tools. - remote-server: Vercel serverless, Streamable HTTP transport, 37 tools.
Frontend Demo
Try all 37 tools live in your browser at context-first-mcp.vercel.app.
Development
Contributing
See CONTRIBUTING.md.
License
Context-First MCP · @xjtlumedia/context-first-mcp-server · context-first-mcp
Built for every developer tired of watching their AI lose the plot.
来源:README.md,提交 2732b90
工具
0版本历史
1- v1.2.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分