Token导航 LogoToken导航

MCP Server · 文档知识

Context Bench

Context Bench是一个用于测量不同MCP服务器在AI框架集成任务中提供上下文有效性的基准测试工具,适用于评估文档完整性和上下文质量的场景。

stdio官方级别未说明来源级核验工具 0tsx
TypeScriptClaude文档处理

快速开始

作者 / 组织
opactorai
提供方
opactorai
运行时
Node.js

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

13

仓库热度

收录来源

1 个

MCP World

选型结论

Context Bench 属于文档知识类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,适配 Claude,有可以直接复制的安装命令;接入前要先准备 访问 Token。

分类

文档知识

传输方式

stdio

认证方式

访问 Token

部署方式

公开资料未说明

安装与配置

安装命令

npx tsx harness/cli.ts \

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 0 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

上下文工作台

衡量MCP服务器向编码代理提供上下文的准确性的基准

Context Bench衡量不同的MCP服务器如何有效地帮助AI代理理解和实现复杂的AI框架工作流程。它侧重于 onehot场景 其中单个MCP工具调用为编码代理提供文档上下文。

______________________________________________________________________

这个基准是什么

问题: *在实施现代人工智能框架时,哪个MCP服务器提供了最有效的上下文?*

  • 任务:AI框架集成(Autogen、LangGraph、OpenAI代理、Agno、OpenRouter)
  • MCP服务器已测试:

- 国家移民管理局:混合包搜索和文档回退 - 背景7:图书馆特定文档检索 - Deepcon:跨代码库的深入上下文理解 - Exa:语义网搜索和代码发现

______________________________________________________________________

基准测试是如何工作的

概述

Context Bench评估MCP服务器是否提供 充分的背景 用于实现复杂的AI框架工作流。与测试代码执行的传统基准不同,此基准衡量 文件完整性 -MCP服务器提供的上下文的质量和充分性。

场景设计

每个场景都经过精心设计 现实而富有挑战性

  • 复杂查询场景需要分散在多个文档页面上的信息,模拟真实世界的开发任务,开发人员需要综合来自各种来源的知识(例如,在单个实现中结合流媒体、工具调用和错误处理)。
  • Oracle代码创建:对于每个场景查询,我们根据场景中引用的官方文档创建oracle实现代码 sources 现场。此oracle代码表示 典型工作示例 如何使用框架推荐的模式和最佳实践来实现所请求的功能。
  • 实际要求:查询指定了具体的任务(例如,“构建具有团队终止条件的多智能体系统”),而不是简单的API查找,测试MCP服务器是否可以为多方面实现提供全面的上下文。

目标是测试MCP服务器是否能够检索和呈现文档,使开发人员能够实现复杂的多组件功能,而不仅仅是查找单个API签名。

基准过程

┌─────────────────────────────────────────────────────────────────┐
│ Step 1: Query MCP Server (Oneshot Mode)                        │
│ • Send scenario query to MCP server                            │
│ • MCP server returns documentation/code examples               │
│ • Single tool call per scenario                                │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Step 2: Multi-Model Evaluation                                 │
│ • 3 LLMs evaluate in parallel:                                 │
│   - GPT-5 (OpenAI)                                             │
│   - Grok-4 (xAI)                                               │
│   - Deepseek-v3.2 (Deepseek)                                   │
│ • Each model compares MCP context against oracle code          │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Step 3: Scoring Criteria                                       │
│ • Completeness (Boolean): Can all requirements be inferred?    │
│   - API names, parameter types, return values                  │
│   - Usage patterns, error handling                             │
│ • Relevance (Boolean): Does context address the task?          │
│ • Overall Score (1-5): Quality assessment                      │
│ • Confidence (high/medium/low): Evaluator certainty            │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Step 4: Majority Vote Decision                                 │
│ • Completeness: 2/3 models must agree = PASS                   │
│ • Relevance: 2/3 models must agree = PASS                      │
│ • Final Verdict: BOTH must pass for scenario to pass           │
└─────────────────────────────────────────────────────────────────┘

评价哲学

我们评估的内容:

  • ✅ MCP上下文是否包含足够的信息来实现oracle代码?
  • ✅ API签名、参数和返回类型是否可以从示例中推断出来?
  • ✅ 使用模式是否得到了清晰的展示?
  • ✅ 文档是否涵盖了所有用户要求?

我们不评估的内容:

  • ❌ 实现是否与oracle完全匹配(功能等效是可以的)
  • ❌ 代码质量或风格
  • ❌ 性能或效率

______________________________________________________________________

基准结果

MCP服务器的准确性

跨20个AI框架集成场景的多模型评估(GPT-5、Grok-4、Deepseek-v3.2)

MCP服务器场景已通过
Deepcon18
背景713
国家移民管理局11
Exa5
基线(克劳德十四行诗4.5)0

关键发现Deepcon为AI框架集成任务提供了最有效的文档环境,成功率达到90%。

备注:基线测试使用Claude Sonnet 4.5,没有任何工具。如果没有外部工具,该模型无法成功实现20个AI框架集成场景中的任何一个(因为知识截止)。

MCP服务器的令牌使用情况

基于最近在20个场景中的基准测试:

MCP服务器平均令牌/场景总令牌
背景75,626112,515
Exa4,75395,065
Deepcon2,36547,290
国家移民管理局1,87337,457

关键发现:更多的令牌并不能保证更好的准确性。Deepcon仅用2365个平均令牌实现了90%的成功,而Context7提供了5626个令牌,但实现了65%的成功。

效率分析

上面的效率图显示了准确性和令牌使用之间的关系。Deepcon在理想象限(高精度、低令牌)中脱颖而出,展示了卓越的上下文质量和效率。

查看完整结果

完整的基准测试结果,包括详细的评估、MCP响应和每个场景的细分,可在 sample_workspace/。每个运行目录包含:

  • 具有完整MCP上下文的单个场景结果
  • 多模型评估分数和推理
  • 每个场景的令牌使用统计
  • MCP服务器汇总报告

示例:浏览 sample_workspace/run-2025-11-06-1653/ 查看4台MCP服务器上所有20个场景的完整基准运行。

______________________________________________________________________

快速开始

先决条件

安装

git clone https://github.com/your-org/context-bench.git
cd context-bench
npm install

设置

# Create environment file
cp .env.example .env

# Add your API keys
nano .env

所需的环境变量:

# MCP Server Credentials
NIA_API_KEY=your_nia_api_key
CONTEXT7_API_KEY=your_context7_api_key
DEEPCON_API_KEY=your_deepcon_api_key

# Evaluation
OPENROUTER_API_KEY=your_openrouter_api_key  # For multi-model evaluation

运行第一个基准测试

单一场景
# Test with NIA server
npx tsx harness/cli.ts \
  --scenario autogen:streaming-tools \
  --mode oneshot \
  --config nia

# Test with Context7 server
npx tsx harness/cli.ts \
  --scenario autogen:streaming-tools \
  --mode oneshot \
  --config context7

# Test with Deepcon server
npx tsx harness/cli.ts \
  --scenario autogen:streaming-tools \
  --mode oneshot \
  --config deepcon
多个场景
# Run all autogen scenarios with NIA
npx tsx harness/cli.ts \
  --package autogen \
  --mode oneshot \
  --config nia

# Run specific scenarios
npx tsx harness/cli.ts \
  --scenarios autogen:streaming-tools,langgraph:parallel-brief \
  --mode oneshot \
  --config context7
比较所有MCP服务器
# Run single scenario across all MCP configs
npx tsx harness/cli.ts \
  --scenario autogen:streaming-tools \
  --mode oneshot \
  --all-configs

# Run all scenarios with all configs (parallel execution)
npx tsx harness/cli.ts \
  --all-packages \
  --mode oneshot \
  --all-configs \
  --max-workers 4

预期输出:

Context Bench v1.0.0

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Run ID: run-2025-11-07-0900
Mode: oneshot
Scenarios: autogen:streaming-tools
Configs: nia
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

▶ Running config: nia

  ▶ Scenario: autogen:streaming-tools
    [1/8] Loading scenario specification... ✓
    [2/8] Validating environment variables... ✓
    [3/8] Initializing workspace... ✓
    [4/8] Applying MCP configuration... ✓
    [5/8] Running oneshot mode (single MCP tool call)... ✓
    [7.6/8] Evaluating result against oracle... ✓
    [8/8] Generating report... ✓

    ✓ PASS: 1/1 passed

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Results: 1/1 scenarios passed (100%)
Elapsed: 45.2s
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

______________________________________________________________________

基准结构

包和场景

基准包括 5个AI框架包 随着 20种情景:

scenarios/
├── autogen.yaml                  # Package definition
├── autogen/                      # Oracle implementations
│   ├── streaming_tools.py
│   ├── selector_groupchat.py
│   ├── team_termination.py
│   └── hitl_persist.py
├── langgraph.yaml
├── langgraph/
│   ├── parallel_brief.py
│   ├── hil_writer.py
│   ├── functional_review.py
│   └── two_agent_subgraphs.py
├── openai-agents.yaml
├── openai-agents/
│   ├── streaming_tools.py
│   ├── handoffs_guardrails.py
│   ├── sessions_context.py
│   └── realtime_agent.py
├── agno.yaml
├── agno/
│   ├── trend_scout.py
│   ├── content_team.py
│   ├── visual_explainer.py
│   └── copy_workflow.py
├── openrouter-sdk.yaml
└── openrouter-sdk/               # TypeScript implementations
    ├── usage_and_keys.ts
    ├── models_and_providers.ts
    ├── structured_tools.ts
    └── auto_router_stream.ts

包定义格式

每个包的定义见 .yaml 在 scenarios/ 根:

package-id: autogen
language: python                   # Runtime language
registry: py_pi                    # Package registry (py_pi, npm, for Nia)
context7-id: /microsoft/autogen    # Context7 library identifier
deepcon-id: autogen                # Deepcon package name (optional)

scenarios:
  - id: streaming-tools
    query: "Using the Autogen Python library, build an agent with tool
            calling and streaming capabilities. Plan a 30-second 'market
            brief' for EUR→KRW travelers..."
    oracle: scenarios/autogen/streaming_tools.py
    sources:
      - https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/quickstart.html
      - https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/tutorial/agents.html

  - id: selector-groupchat
    query: "Using the Autogen Python library with selector-based group
            chat, create a small research 'crew': (1) Plan subtasks;
            (2) run a mock web search; (3) compute a percentage change..."
    oracle: scenarios/autogen/selector_groupchat.py
    sources:
      - https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/tutorial/selector-group-chat.html

runtime:
  version: "python3.11"

env_vars:
  OPENAI_API_KEY: "${OPENAI_API_KEY}"

Oracle文件

每个场景都有一个oracle实现文件(Python .py 或TypeScript .ts)其中包含参考实现代码。多模型评估系统使用这些oracle实现来评估MCP提供的文档是否包含足够的信息来实现所需的功能。

备注:大多数软件包都使用Python,但是 openrouter-sdk 使用TypeScript,因为它是一个npm包。

______________________________________________________________________

了解结果

目录结构

workspace/
└── run-2025-11-07-0900/
    ├── oneshot/                          # Oneshot execution results
    │   ├── nia/                          # NIA MCP server results
    │   │   ├── autogen:streaming-tools/
    │   │   │   ├── oneshot_result.md    # Raw MCP response
    │   │   │   ├── final_result.md      # Full report with evaluation
    │   │   │   └── evaluation_oneshot.json
    │   │   └── autogen:selector-groupchat/
    │   ├── context7/                     # Context7 results
    │   └── deepcon/                      # Deepcon results
    ├── nia/
    │   └── nia_result.md                 # Config summary + token stats
    ├── context7/
    │   └── context7_result.md
    └── deepcon/
        └── deepcon_result.md

______________________________________________________________________

CLI参考

主CLI选项

npx tsx harness/cli.ts [options]

Options:
  --package          Run all scenarios in a package
  --scenario 
      Run specific scenario (format: package:scenario)
  --scenarios         Comma-separated scenario IDs
  --mode             Execution mode: oneshot or agent (default: agent)
  --config           MCP configuration (nia, context7, deepcon)
  --all-configs            Run with all MCP configurations
  --all-packages           Run all packages
  --max-workers         Parallel execution limit (default: 1)
  --timeout       Timeout per scenario (default: 120)
  --verbose                Detailed logging to stdout
  --list-packages          List all available packages
  --list-scenarios         List all available scenarios
  --list-configs           List all available MCP configs
  --show-package     Show package details
  --show-scenario      Show scenario details

列出命令

# List all packages
npx tsx harness/cli.ts --list-packages

# List all scenarios
npx tsx harness/cli.ts --list-scenarios

# List all MCP configs
npx tsx harness/cli.ts --list-configs

# Show package details
npx tsx harness/cli.ts --show-package autogen

# Show scenario details
npx tsx harness/cli.ts --show-scenario autogen:streaming-tools

______________________________________________________________________

令牌计数

在一个热门结果中计数令牌:

# Count tokens for specific config and run
npx tsx scripts/count-tokens.ts workspace/run-2025-11-07-0900 nia

# Count tokens for all configs in a run
npx tsx scripts/count-tokens.ts workspace/run-2025-11-07-0900

# Output
============================================================
Processing config: nia
============================================================
Counting tokens for nia/autogen:streaming-tools...
Counting tokens for nia/autogen:selector-groupchat...
...
✅ Token statistics appended to workspace/run-2025-11-07-0900/nia/nia_result.md
   Total scenarios: 20
   Total tokens: 37,457
   Average tokens: 1,873

令牌统计信息会自动附加到配置摘要标记文件中。

______________________________________________________________________

添加新场景

1.创建包目录

mkdir -p scenarios/new-framework

2.定义包

创建 scenarios/new-framework.yaml 在 scenarios/ 根目录:

package-id: new-framework
language: python
registry: py_pi
context7-id: /company/new-framework
deepcon-id: new-framework

scenarios:
  - id: basic-agent
    query: "Using the New Framework, create a basic agent that can respond
            to user queries with streaming output."
    oracle: scenarios/new-framework/basic_agent.py
    sources:
      - https://docs.new-framework.ai/quickstart
      - https://docs.new-framework.ai/streaming

  - id: multi-agent-team
    query: "Build a multi-agent team with task delegation and result
            aggregation."
    oracle: scenarios/new-framework/multi_agent_team.py
    sources:
      - https://docs.new-framework.ai/multi-agent

runtime:
  version: "python3.11"

env_vars:
  OPENAI_API_KEY: "${OPENAI_API_KEY}"

3.创建Oracle文件

创建 scenarios/new-framework/basic_agent.py:

"""
Oracle implementation for basic-agent scenario.
This is the reference implementation used for evaluation.
"""
from new_framework import Agent

def main():
    # Initialize agent with streaming
    agent = Agent(
        model="gpt-4",
        streaming=True
    )

    # Handle user query
    for chunk in agent.stream("Tell me about AI"):
        print(chunk, end="", flush=True)

if __name__ == "__main__":
    main()

4.测试

# Test with single MCP server
npx tsx harness/cli.ts \
  --scenario new-framework:basic-agent \
  --mode oneshot \
  --config nia

# Test with all servers
npx tsx harness/cli.ts \
  --scenario new-framework:basic-agent \
  --mode oneshot \
  --all-configs

5.添加NIA回退(如果需要)

如果包不在PyPI/NMP注册表中,请在中添加回退映射 harness/oneshot-runner.ts:

const NIA_DOC_FALLBACK_MAP: Record = {
  'autogen': '5cc05f18-2f15-4046-885d-4dd9cb4c5f59',
  'openrouter-sdk': 'https://openrouter.ai/docs',
  'new-framework': 'https://docs.new-framework.ai',  // Add this
};

6.Deepcon ID覆盖(可选)

如果Deepcon MCP服务器需要的包名与 package-id,添加 deepcon-id 到你的YAML:

package-id: openai-agents
deepcon-id: agents-sdk    # Deepcon uses "agents-sdk" instead of "openai-agents"

当 deepcon-id 如果指定了,它将用作 name 调用Deepcon时的参数 search_documentation 工具。否则, package-id 默认情况下使用。

______________________________________________________________________

🛠️ 配置

MCP服务器配置

MCP服务器定义 mcp-configs/:

// mcp-configs/nia.ts
export const niaConfig: MCPConfig = {
  config_name: 'nia',
  description: 'Claude Code + NIA MCP (stdio)',
  mcp_servers: {
    nia: {
      command: 'uvx',
      args: ['nia-mcp-server'],
      env: {
        NIA_API_KEY: process.env.NIA_API_KEY!,
      },
    },
  },
  env_requirements: ['NIA_API_KEY'],
};

环境变量

创建 .env 文件:

# MCP Server API Keys
NIA_API_KEY=your_nia_api_key_here
CONTEXT7_API_KEY=your_context7_api_key_here
DEEPCON_API_KEY=your_deepcon_api_key_here

# Evaluation
OPENROUTER_API_KEY=your_openrouter_api_key_here

# Optional: Specific evaluation models
EVALUATOR_MODELS=openai/gpt-5,x-ai/grok-4,deepseek/deepseek-v3.2-exp

______________________________________________________________________

贡献

欢迎投稿!拜托:

  1. 在包结构之后添加新场景
  2. 包含全面的oracle文件
  3. 使用所有MCP配置进行测试
  4. 添加场景后更新令牌统计信息

______________________________________________________________________

许可证

MIT许可证-请参阅 许可证 了解详情。

______________________________________________________________________

链接

______________________________________________________________________

专为AI框架文档研究而构建

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

AI框架集成TypeScript本地部署文档评估上下文质量基准测试MCP服务器

支持客户端

Claude

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

读长文档提问

把 PDF、Markdown 和笔记交给模型,按章节追问细节。

整理知识库

把零散资料归档、打标签,检索时更容易命中。

批量出摘要

提取要点,输出能直接引用的段落。

选择建议

值得选的地方

  • 只提供 0 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 公开说明写得比较完整,接入前能看清能力边界。

先想清楚的地方

  • stdio 方式要求本地装好 Node.js,换机器要重新装一遍。
  • 需要自备访问 Token,没有凭据没法直接试。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在文档知识场景里让模型直接调用外部能力的人。
  • 已经在用 Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 暂时拿不到访问 Token的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Context Bench

MCP World · 本页

0stdio有1 个2026-05-17
Cherry Studio

MCP World

0未说明未标注1 个2026-05-17
Pdf Math Translate

MCP World

0stdio有1 个2026-05-17
report generation

MCP World

0stdio有1 个2026-05-17
Anything To Notebooklm

MCP World

0stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Context Bench 怎么安装?

公开资料给出的安装命令是 npx tsx harness/cli.ts \,运行环境为 Node.js。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Context Bench 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 Node.js;保存后完全退出客户端再打开,配置才会生效。

Context Bench 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Context Bench 需要 API Key 吗?

公开资料标注的认证方式是访问 Token,也就是要先拿到凭据才能连上;凭据只填在自己本地的配置里,不要写进公开仓库。

Context Bench 支持哪些客户端?

公开资料标注支持 Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP