MCP Server Everything - The Official Comprehensive MCP Protocol Testing Server | MCP Server Everything - 官方 MCP 协议全功能测试服务器

Introduction | 简介

English:

MCP Server Everything is the official Model Context Protocol (MCP) reference testing server developed by Anthropic. With over 70,000 GitHub stars, this is THE definitive reference implementation for the MCP protocol. Unlike production-oriented MCP servers, this server is specifically engineered as a comprehensive protocol demonstration platform for MCP client developers to test, validate, and learn the complete MCP specification.

This server implements EVERY major feature of the MCP protocol:

  • 11 distinct tools covering simple operations (echo, add), long-running operations with progress notifications, LLM sampling, image processing, structured content, resource references, client interaction elicitation, and system introspection
  • 100 test resources with intelligent format distribution (plaintext for even IDs, binary blobs for odd IDs), complete pagination support, and real-time update notifications
  • 3 prompt templates demonstrating simple, complex, and resource-embedded conversation patterns
  • Multiple transport protocols including stdio, HTTP+SSE, and streamable HTTP
  • Continuous logging with random log messages every 15 seconds to test client log handling capabilities

For MCP ecosystem developers, this is the essential reference tool for validating client implementations, understanding protocol nuances, and learning best practices directly from the protocol creators at Anthropic.

中文:

MCP Server Everything 是 Anthropic 官方开发的 Model Context Protocol (MCP) 全功能参考测试服务器。这个拥有超过 70,000 GitHub 星标的项目是 MCP 协议的权威参考实现。与面向生产的 MCP 服务器不同,该服务器专门设计为一个全面的协议演示平台,供 MCP 客户端开发者测试、验证和学习完整的 MCP 规范。

该服务器实现了 MCP 协议的所有主要特性:

  • 11 个不同的工具 涵盖简单操作(echo、add)、带进度通知的长时间运行操作、LLM 采样、图像处理、结构化内容、资源引用、客户端交互引导和系统内省
  • 100 个测试资源 具有智能格式分配(偶数 ID 为纯文本,奇数 ID 为二进制 blob)、完整的分页支持和实时更新通知
  • 3 个提示模板 演示简单、复杂和嵌入资源的对话模式
  • 多种传输协议 包括 stdio、HTTP+SSE 和可流式传输的 HTTP
  • 持续日志记录 每 15 秒发送随机日志消息以测试客户端日志处理能力

对于 MCP 生态系统的开发者来说,这是验证客户端实现、理解协议细节和直接从 Anthropic 协议创建者那里学习最佳实践的必备参考工具。

Table of Contents | 目录

  1. Core Features
  2. Complete Tool Reference
  3. Resource System
  4. Prompt Templates
  5. Transport Protocols
  6. Installation & Configuration
  7. Testing Workflows
  8. Integration with MCP Inspector
  9. Use Cases for Client Developers
  10. Best Practices
  11. FAQ

Core Features | 核心功能

Feature Overview | 功能概览

English:

MCP Server Everything provides a complete test suite for the MCP protocol:

11 Testing Tools

  • Simple tools (echo, add) for basic functionality testing
  • Long-running operations with progress notifications
  • LLM sampling demonstration
  • Binary data handling (tiny PNG image)
  • Structured content and annotations
  • Resource reference management
  • Interactive elicitation flows
  • System introspection (environment variables, roots)

100 Test Resources

  • Intelligent format distribution: even IDs (plaintext), odd IDs (binary)
  • URI scheme: test://resource/{id} where id ranges from 0-99
  • Pagination with cursor-based navigation
  • Resource update subscriptions
  • Automatic updates every 5 seconds for testing notification systems

3 Prompt Templates

  • simple_prompt: Basic single-message pattern
  • complex_prompt: Multi-turn with parameter support
  • resource_prompt: Embedded resource references

Advanced MCP Features

  • Roots protocol support for hierarchical organization
  • Content annotations with metadata
  • Structured content types
  • Progress notifications for long operations
  • LLM sampling capabilities
  • Random logging (every 15 seconds) for log handling tests

Multiple Transport Protocols

  • stdio: Primary recommended transport
  • HTTP+SSE: Deprecated but supported for legacy clients
  • Streamable HTTP: Modern streaming protocol support

Official Maintenance

  • Maintained by Anthropic (MCP protocol creators)
  • High code quality with TypeScript
  • Regular updates aligned with protocol evolution
  • Comprehensive test coverage

中文:

MCP Server Everything 为 MCP 协议提供了完整的测试套件:

11 个测试工具

  • 简单工具(echo、add)用于基本功能测试
  • 带进度通知的长时间运行操作
  • LLM 采样演示
  • 二进制数据处理(微型 PNG 图像)
  • 结构化内容和注释
  • 资源引用管理
  • 交互式引导流程
  • 系统内省(环境变量、根目录)

100 个测试资源

  • 智能格式分配:偶数 ID(纯文本),奇数 ID(二进制)
  • URI 方案:test://resource/{id},其中 id 范围为 0-99
  • 基于游标的分页导航
  • 资源更新订阅
  • 每 5 秒自动更新以测试通知系统

3 个提示模板

  • simple_prompt:基本单消息模式
  • complex_prompt:支持参数的多轮对话
  • resource_prompt:嵌入资源引用

高级 MCP 特性

  • 用于分层组织的 Roots 协议支持
  • 带元数据的内容注释
  • 结构化内容类型
  • 长时间操作的进度通知
  • LLM 采样能力
  • 随机日志记录(每 15 秒)用于日志处理测试

多种传输协议

  • stdio:主要推荐传输方式
  • HTTP+SSE:已弃用但支持旧版客户端
  • Streamable HTTP:现代流式协议支持

官方维护

  • 由 Anthropic(MCP 协议创建者)维护
  • TypeScript 高代码质量
  • 与协议演进同步的定期更新
  • 全面的测试覆盖

Complete Tool Reference | 完整工具参考

Tool Categories | 工具分类

English:

The 11 tools are organized into four functional categories:

  1. Simple Tools (2 tools): Basic functionality testing
  2. Advanced Operations (2 tools): Complex workflows and LLM integration
  3. Content & Data Tools (4 tools): Structured content, images, annotations
  4. System & Interactive Tools (3 tools): System introspection, client interaction

中文:

11 个工具分为四个功能类别:

  1. 简单工具(2 个工具):基本功能测试
  2. 高级操作(2 个工具):复杂工作流和 LLM 集成
  3. 内容与数据工具(4 个工具):结构化内容、图像、注释
  4. 系统与交互工具(3 个工具):系统内省、客户端交互

1. echo - Message Echo Tool | 消息回显工具

English:

The most basic tool for testing fundamental tool invocation and response handling.

Purpose:

  • Verify client can successfully call tools
  • Test JSON serialization/deserialization
  • Validate basic request-response flow
  • Confirm text handling in tool responses

Parameters:

  • message (string, required): The message to echo back

Return Value:
Text content containing the exact message provided

Example Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Client request
{
"tool": "echo",
"arguments": {
"message": "Hello, MCP Protocol!"
}
}

// Server response
{
"content": [
{
"type": "text",
"text": "Hello, MCP Protocol!"
}
]
}

Testing Scenarios:

  1. Basic Echo: Send simple ASCII text
  2. Unicode Support: Test with emoji and international characters (你好世界 🌍)
  3. Special Characters: Test escaping with quotes, newlines, JSON special chars
  4. Empty String: Verify handling of empty message
  5. Large Message: Test with multi-kilobyte strings

Common Issues:

  • Character encoding problems (especially UTF-8 handling)
  • JSON escaping failures with quotes or backslashes
  • Truncation of long messages

中文:

最基本的工具,用于测试基本的工具调用和响应处理。

用途:

  • 验证客户端可以成功调用工具
  • 测试 JSON 序列化/反序列化
  • 验证基本的请求-响应流程
  • 确认工具响应中的文本处理

参数:

  • message(字符串,必需):要回显的消息

返回值:
包含所提供的确切消息的文本内容

使用示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 客户端请求
{
"tool": "echo",
"arguments": {
"message": "你好,MCP 协议!"
}
}

// 服务器响应
{
"content": [
{
"type": "text",
"text": "你好,MCP 协议!"
}
]
}

测试场景:

  1. 基本回显:发送简单的 ASCII 文本
  2. Unicode 支持:使用表情符号和国际字符测试(Hello World 🌍)
  3. 特殊字符:使用引号、换行符、JSON 特殊字符测试转义
  4. 空字符串:验证空消息的处理
  5. 大消息:使用多千字节字符串测试

常见问题:

  • 字符编码问题(尤其是 UTF-8 处理)
  • 引号或反斜杠的 JSON 转义失败
  • 长消息截断

2. add - Number Addition Tool | 数字加法工具

English:

Tests numeric parameter handling and mathematical operations.

Purpose:

  • Verify client can pass numeric types correctly
  • Test parameter validation
  • Validate type conversion and numeric precision
  • Test multiple parameter handling

Parameters:

  • a (number, required): First number to add
  • b (number, required): Second number to add

Return Value:
Text content containing the sum as a string (e.g., “42”)

Example Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Integer addition
{
"tool": "add",
"arguments": {
"a": 15,
"b": 27
}
}
// Response: "42"

// Floating point
{
"tool": "add",
"arguments": {
"a": 3.14,
"b": 2.86
}
}
// Response: "6"

// Negative numbers
{
"tool": "add",
"arguments": {
"a": -10,
"b": 15
}
}
// Response: "5"

Testing Scenarios:

  1. Integer Addition: Positive integers
  2. Floating Point: Decimals (test precision)
  3. Negative Numbers: Negative values
  4. Zero: Adding zero
  5. Large Numbers: Testing numeric limits
  6. Type Coercion: What happens with string numbers like “42”?

Edge Cases:

  • Very large numbers (beyond JavaScript safe integer range)
  • Floating point precision errors
  • NaN and Infinity handling
  • Type mismatch (strings instead of numbers)

中文:

测试数字参数处理和数学运算。

用途:

  • 验证客户端可以正确传递数字类型
  • 测试参数验证
  • 验证类型转换和数字精度
  • 测试多参数处理

参数:

  • a(数字,必需):要相加的第一个数字
  • b(数字,必需):要相加的第二个数字

返回值:
包含总和的字符串文本内容(例如 “42”)

使用示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 整数加法
{
"tool": "add",
"arguments": {
"a": 15,
"b": 27
}
}
// 响应:"42"

// 浮点数
{
"tool": "add",
"arguments": {
"a": 3.14,
"b": 2.86
}
}
// 响应:"6"

// 负数
{
"tool": "add",
"arguments": {
"a": -10,
"b": 15
}
}
// 响应:"5"

测试场景:

  1. 整数加法:正整数
  2. 浮点数:小数(测试精度)
  3. 负数:负值
  4. :加零
  5. 大数:测试数字限制
  6. 类型强制转换:字符串数字如 “42” 会发生什么?

边缘情况:

  • 非常大的数字(超出 JavaScript 安全整数范围)
  • 浮点精度错误
  • NaN 和 Infinity 处理
  • 类型不匹配(字符串而不是数字)

3. longRunningOperation - Progress Notification Demo | 进度通知演示

English:

Demonstrates MCP’s progress notification system for long-running operations.

Purpose:

  • Test client’s progress notification handling
  • Verify progress UI updates
  • Validate async operation handling
  • Test notification ordering and timing

Parameters:
None (no arguments required)

Behavior:

  1. Immediately returns acknowledgment
  2. Sends progress notifications at intervals:
    • 25% complete at ~2.5 seconds
    • 50% complete at ~5 seconds
    • 75% complete at ~7.5 seconds
    • 100% complete at ~10 seconds
  3. Each notification includes progress percentage and status message

Progress Notification Format:

1
2
3
4
5
6
7
8
{
"method": "notifications/progress",
"params": {
"progressToken": "operation-123",
"progress": 50,
"total": 100
}
}

Example Client Flow:

1
2
3
4
5
6
7
8
9
10
11
12
// 1. Call the tool
await client.callTool({
name: "longRunningOperation"
});

// 2. Client receives progress notifications
// Progress: 25/100 - "Processing..."
// Progress: 50/100 - "Halfway there..."
// Progress: 75/100 - "Almost done..."
// Progress: 100/100 - "Complete!"

// 3. Final result returned

Testing Scenarios:

  1. Progress UI: Does client show progress bar/indicator?
  2. Cancellation: Can client cancel mid-operation?
  3. Concurrent Operations: Multiple simultaneous long operations
  4. Progress Ordering: Are notifications received in correct sequence?
  5. Connection Loss: What happens if connection drops during operation?

Client Implementation Checklist:

  • Register progress notification handler
  • Display progress to user (progress bar, percentage, etc.)
  • Handle operation completion
  • Implement cancellation (optional)
  • Handle errors during progress updates
  • Cleanup resources on completion/cancellation

中文:

演示 MCP 长时间运行操作的进度通知系统。

用途:

  • 测试客户端的进度通知处理
  • 验证进度 UI 更新
  • 验证异步操作处理
  • 测试通知顺序和时序

参数:
无(不需要参数)

行为:

  1. 立即返回确认
  2. 按间隔发送进度通知:
    • 约 2.5 秒时完成 25%
    • 约 5 秒时完成 50%
    • 约 7.5 秒时完成 75%
    • 约 10 秒时完成 100%
  3. 每个通知包括进度百分比和状态消息

进度通知格式:

1
2
3
4
5
6
7
8
{
"method": "notifications/progress",
"params": {
"progressToken": "operation-123",
"progress": 50,
"total": 100
}
}

客户端流程示例:

1
2
3
4
5
6
7
8
9
10
11
12
// 1. 调用工具
await client.callTool({
name: "longRunningOperation"
});

// 2. 客户端接收进度通知
// 进度:25/100 - "处理中..."
// 进度:50/100 - "完成一半..."
// 进度:75/100 - "即将完成..."
// 进度:100/100 - "完成!"

// 3. 返回最终结果

测试场景:

  1. 进度 UI:客户端是否显示进度条/指示器?
  2. 取消:客户端可以中途取消吗?
  3. 并发操作:多个同时的长时间操作
  4. 进度顺序:通知是否按正确顺序接收?
  5. 连接丢失:操作期间连接断开会发生什么?

客户端实现清单:

  • 注册进度通知处理程序
  • 向用户显示进度(进度条、百分比等)
  • 处理操作完成
  • 实现取消(可选)
  • 处理进度更新期间的错误
  • 完成/取消时清理资源

4. sampleLLM - LLM Sampling Demonstration | LLM 采样演示

English:

Demonstrates MCP’s LLM sampling capability, allowing servers to request LLM completions.

Purpose:

  • Test client’s LLM sampling implementation
  • Verify prompt transmission and response handling
  • Validate streaming vs. non-streaming responses
  • Test temperature and parameter control

Parameters:

  • prompt (string, required): The prompt to send to the LLM

Behavior:
Server requests the client to sample from an LLM using the provided prompt. The client’s LLM generates a response, which the server then returns as the tool result.

Example Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Client calls tool
{
"tool": "sampleLLM",
"arguments": {
"prompt": "Tell me a short joke about programming"
}
}

// Server requests sampling from client
{
"method": "sampling/createMessage",
"params": {
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "Tell me a short joke about programming"
}
}
],
"maxTokens": 100
}
}

// Client's LLM responds
{
"content": {
"type": "text",
"text": "Why do programmers prefer dark mode? Because light attracts bugs!"
}
}

// Server returns LLM response as tool result

Sampling Parameters (Advanced):

1
2
3
4
5
6
7
8
9
10
11
12
{
"messages": [...],
"modelPreferences": {
"hints": [
{ "name": "claude-3-5-sonnet-20241022" }
]
},
"systemPrompt": "You are a helpful assistant",
"temperature": 0.7,
"maxTokens": 1000,
"stopSequences": ["\n\n"]
}

Testing Scenarios:

  1. Basic Sampling: Simple prompt, get completion
  2. Long Prompts: Test with multi-paragraph prompts
  3. Streaming: Request streaming responses
  4. Model Selection: Test model preference hints
  5. Parameter Tuning: Various temperature/maxTokens values
  6. Error Handling: What if LLM is unavailable?

Client Requirements:

  • Must have access to an LLM (local or API)
  • Must implement sampling/createMessage handler
  • Should support streaming responses (optional)
  • Should respect maxTokens and stopSequences

Use Cases:

  • Servers that need AI assistance (e.g., code analysis server asking LLM for suggestions)
  • Recursive AI operations (AI agent using tools that use AI)
  • Hybrid human-AI workflows

中文:

演示 MCP 的 LLM 采样能力,允许服务器请求 LLM 完成。

用途:

  • 测试客户端的 LLM 采样实现
  • 验证提示传输和响应处理
  • 验证流式与非流式响应
  • 测试温度和参数控制

参数:

  • prompt(字符串,必需):要发送给 LLM 的提示

行为:
服务器使用提供的提示请求客户端从 LLM 采样。客户端的 LLM 生成响应,服务器然后将其作为工具结果返回。

使用示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 客户端调用工具
{
"tool": "sampleLLM",
"arguments": {
"prompt": "给我讲一个关于编程的短笑话"
}
}

// 服务器请求客户端采样
{
"method": "sampling/createMessage",
"params": {
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "给我讲一个关于编程的短笑话"
}
}
],
"maxTokens": 100
}
}

// 客户端的 LLM 响应
{
"content": {
"type": "text",
"text": "为什么程序员喜欢深色模式?因为光会吸引 bug!"
}
}

// 服务器返回 LLM 响应作为工具结果

采样参数(高级):

1
2
3
4
5
6
7
8
9
10
11
12
{
"messages": [...],
"modelPreferences": {
"hints": [
{ "name": "claude-3-5-sonnet-20241022" }
]
},
"systemPrompt": "你是一个有帮助的助手",
"temperature": 0.7,
"maxTokens": 1000,
"stopSequences": ["\n\n"]
}

测试场景:

  1. 基本采样:简单提示,获取完成
  2. 长提示:使用多段提示测试
  3. 流式传输:请求流式响应
  4. 模型选择:测试模型偏好提示
  5. 参数调整:各种温度/maxTokens 值
  6. 错误处理:如果 LLM 不可用会怎样?

客户端要求:

  • 必须能够访问 LLM(本地或 API)
  • 必须实现 sampling/createMessage 处理程序
  • 应支持流式响应(可选)
  • 应遵守 maxTokens 和 stopSequences

使用场景:

  • 需要 AI 辅助的服务器(例如,代码分析服务器向 LLM 寻求建议)
  • 递归 AI 操作(使用使用 AI 的工具的 AI 代理)
  • 混合人机 AI 工作流

5. getTinyImage - Image Data Tool | 图像数据工具

English:

Returns a tiny PNG image to test binary data handling.

Purpose:

  • Verify client can handle binary/base64 data
  • Test image content types
  • Validate blob resource handling
  • Test MIME type processing

Parameters:
None

Return Value:
Image content with:

  • Type: image
  • Data: Base64-encoded PNG (1x1 pixel transparent image)
  • MIME type: image/png

Example Response:

1
2
3
4
5
6
7
8
9
{
"content": [
{
"type": "image",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"mimeType": "image/png"
}
]
}

Testing Scenarios:

  1. Display Image: Can client render the image?
  2. Base64 Decoding: Proper decoding of base64 data
  3. MIME Type Handling: Recognition of image/png
  4. Large Images: Extend test with larger images
  5. Other Image Formats: JPEG, GIF, WebP support (requires server modification)

Client Implementation:

1
2
3
4
5
6
7
8
// Decode and display image
const imageContent = response.content[0];
if (imageContent.type === 'image') {
const imageData = atob(imageContent.data); // Decode base64
const blob = new Blob([imageData], { type: imageContent.mimeType });
const imageUrl = URL.createObjectURL(blob);
// Display imageUrl in <img> tag
}

Common Issues:

  • Base64 padding errors
  • MIME type mismatches
  • Memory issues with large images
  • Browser CORS restrictions

中文:

返回一个微型 PNG 图像以测试二进制数据处理。

用途:

  • 验证客户端可以处理二进制/base64 数据
  • 测试图像内容类型
  • 验证 blob 资源处理
  • 测试 MIME 类型处理

参数:

返回值:
图像内容包含:

  • 类型:image
  • 数据:Base64 编码的 PNG(1x1 像素透明图像)
  • MIME 类型:image/png

响应示例:

1
2
3
4
5
6
7
8
9
{
"content": [
{
"type": "image",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"mimeType": "image/png"
}
]
}

测试场景:

  1. 显示图像:客户端可以渲染图像吗?
  2. Base64 解码:正确解码 base64 数据
  3. MIME 类型处理:识别 image/png
  4. 大图像:使用更大的图像扩展测试
  5. 其他图像格式:JPEG、GIF、WebP 支持(需要服务器修改)

客户端实现:

1
2
3
4
5
6
7
8
// 解码并显示图像
const imageContent = response.content[0];
if (imageContent.type === 'image') {
const imageData = atob(imageContent.data); // 解码 base64
const blob = new Blob([imageData], { type: imageContent.mimeType });
const imageUrl = URL.createObjectURL(blob);
// 在 <img> 标签中显示 imageUrl
}

常见问题:

  • Base64 填充错误
  • MIME 类型不匹配
  • 大图像的内存问题
  • 浏览器 CORS 限制

6. annotatedMessage - Content Annotation Demo | 内容注释演示

English:

Demonstrates MCP’s content annotation system for adding metadata to responses.

Purpose:

  • Test client’s annotation handling
  • Verify metadata preservation
  • Validate annotation rendering
  • Test priority and audience targeting

Parameters:
None

Return Value:
Text content with annotations including:

  • Audience targeting (e.g., user, assistant)
  • Priority levels (low, normal, high)
  • Custom metadata

Example Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"content": [
{
"type": "text",
"text": "This is an important message",
"annotations": {
"audience": ["user"],
"priority": 1.0 // High priority
}
},
{
"type": "text",
"text": "Debug information for developers",
"annotations": {
"audience": ["assistant"],
"priority": 0.2 // Low priority
}
}
]
}

Annotation Properties:

  1. audience (array of strings):

    • "user": Visible to end users
    • "assistant": For AI assistant only
    • Multiple audiences possible
  2. priority (number, 0.0 to 1.0):

    • 0.0 - 0.3: Low priority (debug, verbose info)
    • 0.4 - 0.7: Normal priority (regular content)
    • 0.8 - 1.0: High priority (important, urgent)

Testing Scenarios:

  1. Filtering by Audience: Show only user-relevant content
  2. Priority Sorting: Display high-priority items first
  3. Conditional Rendering: Hide low-priority content in summary view
  4. Multi-Audience: Content visible to both user and assistant
  5. Custom Annotations: Add your own metadata fields

Use Cases:

  • Separating user-facing vs. internal information
  • Highlighting critical information
  • Progressive disclosure (show important first)
  • Context-aware content filtering

中文:

演示 MCP 的内容注释系统,用于向响应添加元数据。

用途:

  • 测试客户端的注释处理
  • 验证元数据保留
  • 验证注释渲染
  • 测试优先级和受众定位

参数:

返回值:
带注释的文本内容,包括:

  • 受众定位(例如,user、assistant)
  • 优先级级别(低、正常、高)
  • 自定义元数据

响应示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"content": [
{
"type": "text",
"text": "这是一条重要消息",
"annotations": {
"audience": ["user"],
"priority": 1.0 // 高优先级
}
},
{
"type": "text",
"text": "开发者调试信息",
"annotations": {
"audience": ["assistant"],
"priority": 0.2 // 低优先级
}
}
]
}

注释属性:

  1. audience(字符串数组):

    • "user":对最终用户可见
    • "assistant":仅供 AI 助手使用
    • 可能有多个受众
  2. priority(数字,0.0 到 1.0):

    • 0.0 - 0.3:低优先级(调试、详细信息)
    • 0.4 - 0.7:正常优先级(常规内容)
    • 0.8 - 1.0:高优先级(重要、紧急)

测试场景:

  1. 按受众过滤:仅显示与用户相关的内容
  2. 优先级排序:首先显示高优先级项目
  3. 条件渲染:在摘要视图中隐藏低优先级内容
  4. 多受众:对用户和助手都可见的内容
  5. 自定义注释:添加您自己的元数据字段

使用场景:

  • 分离面向用户与内部信息
  • 突出显示关键信息
  • 渐进式披露(首先显示重要内容)
  • 上下文感知内容过滤

7. structuredContent - Structured Data Tool | 结构化数据工具

English:

Returns structured, hierarchical content to test complex data handling.

Purpose:

  • Verify client can handle nested data structures
  • Test JSON object rendering
  • Validate complex content types
  • Test schema-based content

Parameters:
None

Return Value:
Structured content with nested objects, arrays, and various data types.

Example Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"content": [
{
"type": "text",
"text": "User Profile Data"
},
{
"type": "resource",
"resource": {
"uri": "structured://data/user",
"mimeType": "application/json",
"text": JSON.stringify({
"user": {
"id": 12345,
"name": "Jane Developer",
"roles": ["admin", "developer"],
"metadata": {
"createdAt": "2024-01-15T10:30:00Z",
"lastLogin": "2025-10-14T08:15:00Z"
},
"projects": [
{
"id": 1,
"name": "MCP Client",
"status": "active"
},
{
"id": 2,
"name": "API Server",
"status": "completed"
}
]
}
}, null, 2)
}
}
]
}

Testing Scenarios:

  1. Nested Objects: Multi-level object hierarchies
  2. Arrays: Lists of items
  3. Mixed Types: Strings, numbers, booleans, null
  4. Date Handling: ISO 8601 timestamps
  5. Large Structures: Deep nesting, many properties
  6. Rendering: JSON pretty-printing, collapsible trees

Client Display Options:

  • Raw JSON view
  • Tree/hierarchical view
  • Table view (for arrays)
  • Search/filter within structure
  • Expandable/collapsible sections

中文:

返回结构化的分层内容以测试复杂的数据处理。

用途:

  • 验证客户端可以处理嵌套数据结构
  • 测试 JSON 对象渲染
  • 验证复杂内容类型
  • 测试基于模式的内容

参数:

返回值:
具有嵌套对象、数组和各种数据类型的结构化内容。

响应示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
"content": [
{
"type": "text",
"text": "用户配置文件数据"
},
{
"type": "resource",
"resource": {
"uri": "structured://data/user",
"mimeType": "application/json",
"text": JSON.stringify({
"user": {
"id": 12345,
"name": "张开发",
"roles": ["admin", "developer"],
"metadata": {
"createdAt": "2024-01-15T10:30:00Z",
"lastLogin": "2025-10-14T08:15:00Z"
},
"projects": [
{
"id": 1,
"name": "MCP 客户端",
"status": "active"
},
{
"id": 2,
"name": "API 服务器",
"status": "completed"
}
]
}
}, null, 2)
}
}
]
}

测试场景:

  1. 嵌套对象:多级对象层次结构
  2. 数组:项目列表
  3. 混合类型:字符串、数字、布尔值、null
  4. 日期处理:ISO 8601 时间戳
  5. 大型结构:深度嵌套、许多属性
  6. 渲染:JSON 美化打印、可折叠树

客户端显示选项:

  • 原始 JSON 视图
  • 树/分层视图
  • 表格视图(用于数组)
  • 在结构内搜索/过滤
  • 可展开/可折叠部分

8. getResourceReference - Resource Reference Tool | 资源引用工具

English:

Generates a reference to one of the server’s test resources.

Purpose:

  • Test resource reference handling
  • Verify URI resolution
  • Validate cross-referencing between tools and resources
  • Test lazy resource loading

Parameters:
None (returns a random resource reference)

Return Value:
Resource content with URI pointing to one of the 100 test resources.

Example Response:

1
2
3
4
5
6
7
8
9
10
11
{
"content": [
{
"type": "resource",
"resource": {
"uri": "test://resource/42",
"text": "This is a reference to resource 42. Use resources/read to fetch full content."
}
}
]
}

Resource URI Format:

  • Scheme: test://
  • Path: resource/{id} where id is 0-99
  • Example: test://resource/7

Client Workflow:

  1. Call getResourceReference tool
  2. Receive URI in response
  3. Optionally dereference URI using resources/read to get full content
  4. Display or process resource data

Testing Scenarios:

  1. Reference Display: Show URI without fetching content
  2. Lazy Loading: Fetch content only when user clicks/expands
  3. Batch Fetching: Get multiple referenced resources efficiently
  4. Caching: Cache fetched resources to avoid redundant requests
  5. Dead Links: Handle invalid or deleted resource URIs

Use Cases:

  • Tools that return references to large datasets
  • Lazy loading of expensive resources
  • Building resource dependency graphs
  • Resource cataloging and indexing

中文:

生成对服务器测试资源之一的引用。

用途:

  • 测试资源引用处理
  • 验证 URI 解析
  • 验证工具和资源之间的交叉引用
  • 测试延迟资源加载

参数:
无(返回随机资源引用)

返回值:
指向 100 个测试资源之一的 URI 的资源内容。

响应示例:

1
2
3
4
5
6
7
8
9
10
11
{
"content": [
{
"type": "resource",
"resource": {
"uri": "test://resource/42",
"text": "这是对资源 42 的引用。使用 resources/read 获取完整内容。"
}
}
]
}

资源 URI 格式:

  • 方案:test://
  • 路径:resource/{id},其中 id 为 0-99
  • 示例:test://resource/7

客户端工作流:

  1. 调用 getResourceReference 工具
  2. 在响应中接收 URI
  3. 可选地使用 resources/read 解引用 URI 以获取完整内容
  4. 显示或处理资源数据

测试场景:

  1. 引用显示:显示 URI 而不获取内容
  2. 延迟加载:仅在用户点击/展开时获取内容
  3. 批量获取:有效地获取多个引用的资源
  4. 缓存:缓存获取的资源以避免冗余请求
  5. 死链接:处理无效或已删除的资源 URI

使用场景:

  • 返回对大型数据集的引用的工具
  • 昂贵资源的延迟加载
  • 构建资源依赖关系图
  • 资源编目和索引

9. startElicitation - Interactive Client Elicitation | 交互式客户端引导

English:

Initiates an interactive elicitation flow where the server guides the client through a series of selections.

Purpose:

  • Test interactive workflows
  • Verify multi-turn tool interactions
  • Validate client UI for selections
  • Test state management across tool calls

Parameters:
None

Behavior:
Starts an interactive session where the server presents choices to the client, and the client must respond with selections. This demonstrates MCP’s capability for complex, stateful interactions.

Example Flow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 1. Client calls startElicitation
await client.callTool({ name: "startElicitation" });

// 2. Server responds with initial choices
{
"content": [
{
"type": "text",
"text": "Please select an option:"
}
],
"elicitation": {
"prompt": "Choose your favorite color:",
"options": [
{ "id": "red", "label": "Red" },
{ "id": "blue", "label": "Blue" },
{ "id": "green", "label": "Green" }
]
}
}

// 3. Client presents UI, user selects "blue"
await client.respondToElicitation({ selected: "blue" });

// 4. Server continues elicitation or completes
{
"content": [
{
"type": "text",
"text": "You selected Blue! Now choose a shade:"
}
],
"elicitation": {
"prompt": "Choose shade:",
"options": [
{ "id": "light", "label": "Light Blue" },
{ "id": "dark", "label": "Dark Blue" }
]
}
}

// 5. Eventually completes
{
"content": [
{
"type": "text",
"text": "Configuration complete: Dark Blue selected."
}
],
"isComplete": true
}

Testing Scenarios:

  1. Single Selection: Choose from list
  2. Multi-Step: Multiple rounds of selections
  3. Conditional Flow: Options change based on previous selections
  4. Cancellation: User cancels mid-flow
  5. Timeout: What happens if user doesn’t respond?
  6. Invalid Selection: User selects non-existent option

Client Requirements:

  • UI for displaying options (dropdown, radio buttons, etc.)
  • State tracking across multiple elicitation rounds
  • Cancellation support
  • Error handling for invalid selections

Use Cases:

  • Configuration wizards
  • Interactive setup flows
  • Guided troubleshooting
  • Multi-step data collection

中文:

启动交互式引导流程,服务器引导客户端通过一系列选择。

用途:

  • 测试交互式工作流
  • 验证多轮工具交互
  • 验证客户端 UI 的选择
  • 测试工具调用之间的状态管理

参数:

行为:
启动交互式会话,服务器向客户端呈现选择,客户端必须响应选择。这演示了 MCP 对复杂有状态交互的能力。

流程示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 1. 客户端调用 startElicitation
await client.callTool({ name: "startElicitation" });

// 2. 服务器响应初始选择
{
"content": [
{
"type": "text",
"text": "请选择一个选项:"
}
],
"elicitation": {
"prompt": "选择您最喜欢的颜色:",
"options": [
{ "id": "red", "label": "红色" },
{ "id": "blue", "label": "蓝色" },
{ "id": "green", "label": "绿色" }
]
}
}

// 3. 客户端呈现 UI,用户选择"蓝色"
await client.respondToElicitation({ selected: "blue" });

// 4. 服务器继续引导或完成
{
"content": [
{
"type": "text",
"text": "您选择了蓝色!现在选择色调:"
}
],
"elicitation": {
"prompt": "选择色调:",
"options": [
{ "id": "light", "label": "浅蓝色" },
{ "id": "dark", "label": "深蓝色" }
]
}
}

// 5. 最终完成
{
"content": [
{
"type": "text",
"text": "配置完成:选择了深蓝色。"
}
],
"isComplete": true
}

测试场景:

  1. 单选:从列表中选择
  2. 多步骤:多轮选择
  3. 条件流程:选项根据先前的选择而变化
  4. 取消:用户中途取消流程
  5. 超时:如果用户不响应会发生什么?
  6. 无效选择:用户选择不存在的选项

客户端要求:

  • 用于显示选项的 UI(下拉列表、单选按钮等)
  • 跨多个引导轮次的状态跟踪
  • 取消支持
  • 无效选择的错误处理

使用场景:

  • 配置向导
  • 交互式设置流程
  • 引导式故障排除
  • 多步骤数据收集

10. printEnv - Environment Variable Inspector | 环境变量检查器

English:

Prints environment variables for debugging and system introspection.

Purpose:

  • Debug server configuration
  • Verify environment variable passing
  • Test system information access
  • Validate security (ensure secrets aren’t leaked)

Parameters:
None

Return Value:
Text content listing environment variables and their values.

Example Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"content": [
{
"type": "text",
"text": `Environment Variables:
NODE_ENV=production
PATH=/usr/local/bin:/usr/bin:/bin
HOME=/home/user
MCP_SERVER_NAME=everything
MCP_TRANSPORT=stdio
...
(Note: Sensitive variables like API keys are typically filtered)
`
}
]
}

Testing Scenarios:

  1. Variable Presence: Check for expected environment variables
  2. Value Verification: Confirm correct values are set
  3. Secret Filtering: Ensure sensitive data (API keys, passwords) are redacted
  4. Cross-Platform: Test on different OSes (Linux, macOS, Windows)
  5. Container Environments: Test in Docker, Kubernetes

Security Considerations:

  • Server should filter sensitive variables (API_KEY, PASSWORD, SECRET, TOKEN)
  • Consider implementing allowlist/denylist for variable disclosure
  • Log access to environment variables for audit trail

Use Cases:

  • Debugging server startup issues
  • Verifying configuration in different environments
  • Troubleshooting path and dependency issues
  • Security auditing

中文:

打印环境变量以进行调试和系统内省。

用途:

  • 调试服务器配置
  • 验证环境变量传递
  • 测试系统信息访问
  • 验证安全性(确保不泄露密钥)

参数:

返回值:
列出环境变量及其值的文本内容。

响应示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"content": [
{
"type": "text",
"text": `环境变量:
NODE_ENV=production
PATH=/usr/local/bin:/usr/bin:/bin
HOME=/home/user
MCP_SERVER_NAME=everything
MCP_TRANSPORT=stdio
...
(注意:通常会过滤像 API 密钥这样的敏感变量)
`
}
]
}

测试场景:

  1. 变量存在:检查预期的环境变量
  2. 值验证:确认设置了正确的值
  3. 密钥过滤:确保敏感数据(API 密钥、密码)已编辑
  4. 跨平台:在不同操作系统上测试(Linux、macOS、Windows)
  5. 容器环境:在 Docker、Kubernetes 中测试

安全注意事项:

  • 服务器应过滤敏感变量(API_KEY、PASSWORD、SECRET、TOKEN)
  • 考虑实施变量披露的允许列表/拒绝列表
  • 记录对环境变量的访问以进行审计跟踪

使用场景:

  • 调试服务器启动问题
  • 在不同环境中验证配置
  • 故障排除路径和依赖项问题
  • 安全审计

11. listRoots - MCP Roots Management | MCP Roots 管理

English:

Lists the MCP roots registered with the server, demonstrating the roots protocol.

Purpose:

  • Test roots protocol implementation
  • Verify hierarchical organization
  • Validate root discovery
  • Test root metadata handling

Parameters:
None

Return Value:
List of roots with their URIs and metadata.

Example Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"content": [
{
"type": "text",
"text": "MCP Roots:"
}
],
"roots": [
{
"uri": "file:///workspace",
"name": "Workspace Root",
"description": "Main development workspace"
},
{
"uri": "test://resources",
"name": "Test Resources",
"description": "100 test resources for client validation"
}
]
}

Roots Protocol Concepts:

  1. Root URI: Base URI for a resource hierarchy
  2. Name: Human-readable root name
  3. Description: What this root contains
  4. Capabilities: What operations are supported on this root

Testing Scenarios:

  1. Root Discovery: List all available roots
  2. Root Navigation: Browse resources under a root
  3. Root Metadata: Access root properties
  4. Dynamic Roots: Roots that change over time
  5. Access Control: Permissions per root

Client Implementation:

1
2
3
4
5
6
7
8
9
// List roots
const roots = await client.listRoots();

// Display roots in UI (tree view, sidebar, etc.)
for (const root of roots) {
console.log(`${root.name}: ${root.uri}`);
// Optionally: fetch resources under this root
const resources = await client.listResources(root.uri);
}

Use Cases:

  • File system navigation
  • Project/workspace organization
  • Resource categorization
  • Multi-tenant systems
  • Hierarchical access control

中文:

列出在服务器上注册的 MCP roots,演示 roots 协议。

用途:

  • 测试 roots 协议实现
  • 验证分层组织
  • 验证根发现
  • 测试根元数据处理

参数:

返回值:
具有其 URI 和元数据的根列表。

响应示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"content": [
{
"type": "text",
"text": "MCP Roots:"
}
],
"roots": [
{
"uri": "file:///workspace",
"name": "工作区根",
"description": "主开发工作区"
},
{
"uri": "test://resources",
"name": "测试资源",
"description": "用于客户端验证的 100 个测试资源"
}
]
}

Roots 协议概念:

  1. 根 URI:资源层次结构的基础 URI
  2. 名称:人类可读的根名称
  3. 描述:此根包含的内容
  4. 能力:此根支持的操作

测试场景:

  1. 根发现:列出所有可用的根
  2. 根导航:浏览根下的资源
  3. 根元数据:访问根属性
  4. 动态根:随时间变化的根
  5. 访问控制:每个根的权限

客户端实现:

1
2
3
4
5
6
7
8
9
// 列出根
const roots = await client.listRoots();

// 在 UI 中显示根(树视图、侧边栏等)
for (const root of roots) {
console.log(`${root.name}: ${root.uri}`);
// 可选:获取此根下的资源
const resources = await client.listResources(root.uri);
}

使用场景:

  • 文件系统导航
  • 项目/工作区组织
  • 资源分类
  • 多租户系统
  • 分层访问控制

Resource System | 资源系统

Overview | 概览

English:

MCP Server Everything provides 100 test resources designed to comprehensively test client resource handling capabilities. These resources demonstrate pagination, different content types, update notifications, and resource templates.

Key Features:

  • 100 Resources: IDs from 0 to 99
  • Format Distribution:
    • Even IDs (0, 2, 4, …): Plaintext resources
    • Odd IDs (1, 3, 5, …): Binary blob resources
  • URI Scheme: test://resource/{id}
  • Pagination: 10 resources per page, cursor-based navigation
  • Update Notifications: Resources update every 5 seconds
  • Resource Templates: Support for template-based resource generation

中文:

MCP Server Everything 提供 100 个测试资源,旨在全面测试客户端资源处理能力。这些资源演示了分页、不同内容类型、更新通知和资源模板。

主要功能:

  • 100 个资源:ID 从 0 到 99
  • 格式分配
    • 偶数 ID(0、2、4、…):纯文本资源
    • 奇数 ID(1、3、5、…):二进制 blob 资源
  • URI 方案test://resource/{id}
  • 分页:每页 10 个资源,基于游标的导航
  • 更新通知:资源每 5 秒更新一次
  • 资源模板:支持基于模板的资源生成

Resource Format Examples | 资源格式示例

English:

Plaintext Resource (Even ID):

1
2
3
4
5
6
7
8
9
10
// Request: resources/read test://resource/42
{
"contents": [
{
"uri": "test://resource/42",
"mimeType": "text/plain",
"text": "This is test resource #42. It contains plaintext content for testing."
}
]
}

Binary Resource (Odd ID):

1
2
3
4
5
6
7
8
9
10
// Request: resources/read test://resource/43
{
"contents": [
{
"uri": "test://resource/43",
"mimeType": "application/octet-stream",
"blob": "VGhpcyBpcyBhIGJpbmFyeSBibG9iIGZvciB0ZXN0aW5nLg==" // Base64
}
]
}

中文:

纯文本资源(偶数 ID):

1
2
3
4
5
6
7
8
9
10
// 请求:resources/read test://resource/42
{
"contents": [
{
"uri": "test://resource/42",
"mimeType": "text/plain",
"text": "这是测试资源 #42。它包含用于测试的纯文本内容。"
}
]
}

二进制资源(奇数 ID):

1
2
3
4
5
6
7
8
9
10
// 请求:resources/read test://resource/43
{
"contents": [
{
"uri": "test://resource/43",
"mimeType": "application/octet-stream",
"blob": "VGhpcyBpcyBhIGJpbmFyeSBibG9iIGZvciB0ZXN0aW5nLg==" // Base64
}
]
}

Pagination | 分页

English:

Resources are paginated with 10 items per page using cursor-based navigation.

Listing Resources:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// First page (resources 0-9)
{
"method": "resources/list",
"params": {}
}

// Response
{
"resources": [
{ "uri": "test://resource/0", "name": "Resource 0", "mimeType": "text/plain" },
{ "uri": "test://resource/1", "name": "Resource 1", "mimeType": "application/octet-stream" },
// ... 8 more resources
],
"nextCursor": "cursor_page_2"
}

// Next page (resources 10-19)
{
"method": "resources/list",
"params": {
"cursor": "cursor_page_2"
}
}

// Continue until nextCursor is null

Pagination Testing:

  1. Fetch first page without cursor
  2. Use nextCursor to fetch subsequent pages
  3. Verify correct resources on each page
  4. Confirm nextCursor is null on last page
  5. Test edge cases (empty results, single page)

中文:

资源使用基于游标的导航进行分页,每页 10 个项目。

列出资源:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 第一页(资源 0-9)
{
"method": "resources/list",
"params": {}
}

// 响应
{
"resources": [
{ "uri": "test://resource/0", "name": "资源 0", "mimeType": "text/plain" },
{ "uri": "test://resource/1", "name": "资源 1", "mimeType": "application/octet-stream" },
// ... 8 个更多资源
],
"nextCursor": "cursor_page_2"
}

// 下一页(资源 10-19)
{
"method": "resources/list",
"params": {
"cursor": "cursor_page_2"
}
}

// 继续直到 nextCursor 为 null

分页测试:

  1. 不使用游标获取第一页
  2. 使用 nextCursor 获取后续页面
  3. 验证每页上的正确资源
  4. 确认最后一页上 nextCursor 为 null
  5. 测试边缘情况(空结果、单页)

Update Notifications | 更新通知

English:

Resources automatically update every 5 seconds to test client notification handling.

Subscription Flow:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 1. Subscribe to resource updates
{
"method": "resources/subscribe",
"params": {
"uri": "test://resource/42"
}
}

// 2. Server acknowledges subscription
{
"result": {
"subscribed": true
}
}

// 3. Server sends update notification every 5 seconds
{
"method": "notifications/resources/updated",
"params": {
"uri": "test://resource/42"
}
}

// 4. Client re-fetches resource to get latest content
{
"method": "resources/read",
"params": {
"uri": "test://resource/42"
}
}

// 5. Unsubscribe when done
{
"method": "resources/unsubscribe",
"params": {
"uri": "test://resource/42"
}
}

Testing Scenarios:

  1. Single Resource: Subscribe to one resource, verify updates
  2. Multiple Resources: Subscribe to several, confirm each updates
  3. Unsubscribe: Verify updates stop after unsubscribe
  4. Re-subscribe: Subscribe, unsubscribe, subscribe again
  5. Connection Issues: What happens if connection drops during subscription?

Client Implementation Checklist:

  • Implement notifications/resources/updated handler
  • Re-fetch resource content on notification
  • Update UI to reflect changes
  • Handle subscription lifecycle (subscribe/unsubscribe)
  • Manage multiple concurrent subscriptions
  • Cleanup subscriptions on disconnect

中文:

资源每 5 秒自动更新以测试客户端通知处理。

订阅流程:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 1. 订阅资源更新
{
"method": "resources/subscribe",
"params": {
"uri": "test://resource/42"
}
}

// 2. 服务器确认订阅
{
"result": {
"subscribed": true
}
}

// 3. 服务器每 5 秒发送更新通知
{
"method": "notifications/resources/updated",
"params": {
"uri": "test://resource/42"
}
}

// 4. 客户端重新获取资源以获取最新内容
{
"method": "resources/read",
"params": {
"uri": "test://resource/42"
}
}

// 5. 完成后取消订阅
{
"method": "resources/unsubscribe",
"params": {
"uri": "test://resource/42"
}
}

测试场景:

  1. 单个资源:订阅一个资源,验证更新
  2. 多个资源:订阅多个,确认每个都更新
  3. 取消订阅:验证取消订阅后更新停止
  4. 重新订阅:订阅、取消订阅、再次订阅
  5. 连接问题:订阅期间连接断开会发生什么?

客户端实现清单:

  • 实现 notifications/resources/updated 处理程序
  • 收到通知时重新获取资源内容
  • 更新 UI 以反映更改
  • 处理订阅生命周期(订阅/取消订阅)
  • 管理多个并发订阅
  • 断开连接时清理订阅

Resource Templates | 资源模板

English:

Server supports resource templates for dynamic resource generation.

Template Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// List available templates
{
"method": "resources/templates/list"
}

// Response
{
"resourceTemplates": [
{
"uriTemplate": "test://resource/{id}",
"name": "Test Resource Template",
"description": "Template for generating test resources",
"mimeType": "text/plain"
}
]
}

// Use template to generate resource
// Client can construct URIs like test://resource/42, test://resource/99

Testing Scenarios:

  1. List available templates
  2. Construct URIs from templates
  3. Verify template parameter substitution
  4. Test invalid template parameters
  5. Multiple templates with different patterns

中文:

服务器支持用于动态资源生成的资源模板。

模板使用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 列出可用模板
{
"method": "resources/templates/list"
}

// 响应
{
"resourceTemplates": [
{
"uriTemplate": "test://resource/{id}",
"name": "测试资源模板",
"description": "用于生成测试资源的模板",
"mimeType": "text/plain"
}
]
}

// 使用模板生成资源
// 客户端可以构建像 test://resource/42、test://resource/99 这样的 URI

测试场景:

  1. 列出可用模板
  2. 从模板构建 URI
  3. 验证模板参数替换
  4. 测试无效的模板参数
  5. 具有不同模式的多个模板

Prompt Templates | 提示模板

Overview | 概览

English:

MCP Server Everything provides three prompt templates demonstrating different conversation patterns.

中文:

MCP Server Everything 提供三个提示模板,演示不同的对话模式。


1. simple_prompt - Basic Prompt Template | 基本提示模板

English:

A basic prompt template with no parameters.

Usage:

1
2
3
4
5
6
{
"method": "prompts/get",
"params": {
"name": "simple_prompt"
}
}

Response:

1
2
3
4
5
6
7
8
9
10
11
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "This is a simple prompt for testing basic prompt functionality."
}
}
]
}

Testing:

  • Verify prompt retrieval
  • Test prompt rendering
  • Validate message structure

中文:

不带参数的基本提示模板。

使用:

1
2
3
4
5
6
{
"method": "prompts/get",
"params": {
"name": "simple_prompt"
}
}

响应:

1
2
3
4
5
6
7
8
9
10
11
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "这是一个用于测试基本提示功能的简单提示。"
}
}
]
}

测试:

  • 验证提示检索
  • 测试提示渲染
  • 验证消息结构

2. complex_prompt - Parameterized Prompt Template | 参数化提示模板

English:

An advanced prompt template supporting parameters and multi-turn conversations.

Usage:

1
2
3
4
5
6
7
8
9
10
{
"method": "prompts/get",
"params": {
"name": "complex_prompt",
"arguments": {
"topic": "artificial intelligence",
"depth": "intermediate"
}
}
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "Let's discuss artificial intelligence at an intermediate level."
}
},
{
"role": "assistant",
"content": {
"type": "text",
"text": "I'd be happy to discuss AI. What specific aspect interests you?"
}
},
{
"role": "user",
"content": {
"type": "text",
"text": "Tell me about machine learning algorithms."
}
}
]
}

Parameters:

  • topic (string): Discussion topic
  • depth (string): Level of detail (basic, intermediate, advanced)

Testing:

  • Parameter substitution
  • Multi-turn message handling
  • Dynamic content generation
  • Invalid parameter handling

中文:

支持参数和多轮对话的高级提示模板。

使用:

1
2
3
4
5
6
7
8
9
10
{
"method": "prompts/get",
"params": {
"name": "complex_prompt",
"arguments": {
"topic": "人工智能",
"depth": "中级"
}
}
}

响应:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "让我们以中级水平讨论人工智能。"
}
},
{
"role": "assistant",
"content": {
"type": "text",
"text": "我很乐意讨论 AI。您对哪个具体方面感兴趣?"
}
},
{
"role": "user",
"content": {
"type": "text",
"text": "告诉我机器学习算法。"
}
}
]
}

参数:

  • topic(字符串):讨论主题
  • depth(字符串):详细程度(基本、中级、高级)

测试:

  • 参数替换
  • 多轮消息处理
  • 动态内容生成
  • 无效参数处理

3. resource_prompt - Resource-Embedded Prompt | 嵌入资源的提示

English:

A prompt template that embeds resource references.

Usage:

1
2
3
4
5
6
7
8
9
{
"method": "prompts/get",
"params": {
"name": "resource_prompt",
"arguments": {
"resourceId": "42"
}
}
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "Please analyze the following resource:"
}
},
{
"role": "user",
"content": {
"type": "resource",
"resource": {
"uri": "test://resource/42",
"text": "Resource content here..."
}
}
}
]
}

Testing:

  • Resource embedding in prompts
  • Resource resolution
  • Multi-content-type messages
  • Resource availability handling

中文:

嵌入资源引用的提示模板。

使用:

1
2
3
4
5
6
7
8
9
{
"method": "prompts/get",
"params": {
"name": "resource_prompt",
"arguments": {
"resourceId": "42"
}
}
}

响应:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"messages": [
{
"role": "user",
"content": {
"type": "text",
"text": "请分析以下资源:"
}
},
{
"role": "user",
"content": {
"type": "resource",
"resource": {
"uri": "test://resource/42",
"text": "这里是资源内容..."
}
}
}
]
}

测试:

  • 在提示中嵌入资源
  • 资源解析
  • 多内容类型消息
  • 资源可用性处理

Transport Protocols | 传输协议

English:

Standard input/output transport is the primary and recommended method for MCP servers.

Configuration:

1
2
3
4
5
6
7
8
9
{
"mcpServers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"],
"transport": "stdio"
}
}
}

Characteristics:

  • Simple process-based communication
  • Low latency
  • Bidirectional streaming
  • Process lifecycle management
  • Standard error for logging

Client Implementation:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { spawn } from 'child_process';

const serverProcess = spawn('npx', ['-y', '@modelcontextprotocol/server-everything']);

// Read from stdout
serverProcess.stdout.on('data', (data) => {
const message = JSON.parse(data.toString());
handleMCPMessage(message);
});

// Write to stdin
serverProcess.stdin.write(JSON.stringify(request) + '\n');

// Monitor stderr for logs
serverProcess.stderr.on('data', (data) => {
console.log('Server log:', data.toString());
});

中文:

标准输入/输出传输是 MCP 服务器的主要和推荐方法。

配置:

1
2
3
4
5
6
7
8
9
{
"mcpServers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"],
"transport": "stdio"
}
}
}

特点:

  • 简单的基于进程的通信
  • 低延迟
  • 双向流式传输
  • 进程生命周期管理
  • 用于日志记录的标准错误

客户端实现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { spawn } from 'child_process';

const serverProcess = spawn('npx', ['-y', '@modelcontextprotocol/server-everything']);

// 从 stdout 读取
serverProcess.stdout.on('data', (data) => {
const message = JSON.parse(data.toString());
handleMCPMessage(message);
});

// 写入 stdin
serverProcess.stdin.write(JSON.stringify(request) + '\n');

// 监控 stderr 以获取日志
serverProcess.stderr.on('data', (data) => {
console.log('服务器日志:', data.toString());
});

HTTP + SSE (Deprecated) | HTTP + SSE(已弃用)

English:

HTTP with Server-Sent Events for server-to-client notifications. This transport is deprecated but still supported.

Not Recommended - Use stdio or streamable HTTP instead.

中文:

使用服务器发送事件进行服务器到客户端通知的 HTTP。此传输已弃用但仍受支持。

不推荐 - 请改用 stdio 或可流式传输的 HTTP。

Streamable HTTP (Modern) | 可流式传输的 HTTP(现代)

English:

Modern HTTP-based transport with streaming support.

Configuration:

1
2
3
4
5
6
7
8
{
"mcpServers": {
"everything": {
"url": "http://localhost:3000/mcp",
"transport": "http-stream"
}
}
}

Characteristics:

  • HTTP/2 streaming
  • Network-friendly (works through proxies, load balancers)
  • Authentication support (headers, tokens)
  • Cloud-native deployment
  • Cross-origin support (CORS)

Use Cases:

  • Remote MCP servers
  • Cloud-hosted services
  • Multi-user environments
  • API gateway integration

中文:

基于 HTTP 的现代传输,支持流式传输。

配置:

1
2
3
4
5
6
7
8
{
"mcpServers": {
"everything": {
"url": "http://localhost:3000/mcp",
"transport": "http-stream"
}
}
}

特点:

  • HTTP/2 流式传输
  • 网络友好(通过代理、负载均衡器工作)
  • 身份验证支持(标头、令牌)
  • 云原生部署
  • 跨域支持(CORS)

使用场景:

  • 远程 MCP 服务器
  • 云托管服务
  • 多用户环境
  • API 网关集成

Installation & Configuration | 安装与配置

English:

Run directly with NPX without installation:

1
npx -y @modelcontextprotocol/server-everything

Or install globally:

1
2
npm install -g @modelcontextprotocol/server-everything@latest
npx @modelcontextprotocol/server-everything

中文:

无需安装直接使用 NPX 运行:

1
npx -y @modelcontextprotocol/server-everything

或全局安装:

1
2
npm install -g @modelcontextprotocol/server-everything@latest
npx @modelcontextprotocol/server-everything

Method 2: From Source | 方法 2:从源代码

English:

1
2
3
4
5
6
7
8
9
10
11
12
# Clone the repository
git clone https://github.com/modelcontextprotocol/servers.git
cd servers/src/everything

# Install dependencies
npm install

# Build
npm run build

# Run
npm start

中文:

1
2
3
4
5
6
7
8
9
10
11
12
# 克隆仓库
git clone https://github.com/modelcontextprotocol/servers.git
cd servers/src/everything

# 安装依赖
npm install

# 构建
npm run build

# 运行
npm start

Method 3: Docker | 方法 3:Docker

English:

1
2
3
4
5
# Build Docker image
docker build -t mcp-everything .

# Run container
docker run -i mcp-everything

中文:

1
2
3
4
5
# 构建 Docker 镜像
docker build -t mcp-everything .

# 运行容器
docker run -i mcp-everything

Claude Desktop Configuration | Claude Desktop 配置

English:

Add to claude_desktop_config.json:

1
2
3
4
5
6
7
8
{
"mcpServers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}

Configuration File Locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

中文:

添加到 claude_desktop_config.json

1
2
3
4
5
6
7
8
{
"mcpServers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}

配置文件位置:

  • macOS:~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows:%APPDATA%\Claude\claude_desktop_config.json
  • Linux:~/.config/Claude/claude_desktop_config.json

VS Code Configuration | VS Code 配置

English:

Add to VS Code settings (.vscode/settings.json):

1
2
3
4
5
6
7
8
{
"mcp.servers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}

中文:

添加到 VS Code 设置(.vscode/settings.json):

1
2
3
4
5
6
7
8
{
"mcp.servers": {
"everything": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-everything"]
}
}
}

Testing Workflows | 测试工作流

Comprehensive Client Testing Checklist | 全面的客户端测试清单

English:

Use this checklist to thoroughly test your MCP client implementation against MCP Server Everything.

1. Connection & Initialization | 1. 连接和初始化

  • Establish connection via stdio transport
  • Send initialize request
  • Receive and parse initialize response
  • Verify server capabilities (tools, resources, prompts)
  • Send initialized notification
  • Handle connection errors gracefully

2. Tool Discovery & Invocation | 2. 工具发现和调用

  • List all available tools (should be 11)
  • Parse tool schemas and parameters
  • Display tools in UI
  • Call echo tool with various messages
  • Call add tool with different number types
  • Handle tool call errors (invalid parameters, etc.)

3. Progress Notifications | 3. 进度通知

  • Call longRunningOperation tool
  • Receive progress notifications
  • Display progress to user (progress bar/percentage)
  • Handle completion notification
  • Test cancellation (if supported)

4. LLM Sampling | 4. LLM 采样

  • Call sampleLLM tool
  • Handle sampling/createMessage request from server
  • Send prompt to LLM
  • Return LLM response to server
  • Handle streaming responses (optional)

5. Binary Data Handling | 5. 二进制数据处理

  • Call getTinyImage tool
  • Decode base64 image data
  • Render image in UI
  • Verify MIME type handling

6. Content Annotations | 6. 内容注释

  • Call annotatedMessage tool
  • Parse annotation metadata
  • Filter content by audience
  • Sort/prioritize by priority value
  • Display annotations appropriately

7. Structured Content | 7. 结构化内容

  • Call structuredContent tool
  • Parse nested JSON structures
  • Render structured data (tree view, table, etc.)
  • Handle complex data types

8. Resource Management | 8. 资源管理

  • List resources (should return 10 per page)
  • Navigate pagination with cursors
  • Read individual resources (even and odd IDs)
  • Handle plaintext vs. binary resources
  • Subscribe to resource updates
  • Receive update notifications
  • Unsubscribe from updates

9. Prompt Templates | 9. 提示模板

  • List available prompts (should be 3)
  • Get simple_prompt without parameters
  • Get complex_prompt with parameters
  • Get resource_prompt with embedded resource
  • Render multi-turn conversations

10. Roots Protocol | 10. Roots 协议

  • Call listRoots tool
  • Parse roots metadata
  • Display roots in UI (tree structure, etc.)

11. Logging | 11. 日志记录

  • Receive random log messages (every 15 seconds)
  • Parse log levels (info, debug, etc.)
  • Display logs in console/log viewer
  • Filter logs by level

12. Error Handling | 12. 错误处理

  • Call non-existent tool (should error)
  • Send invalid parameters (should error)
  • Read non-existent resource (should error)
  • Handle network timeouts
  • Reconnect after disconnect

13. Performance | 13. 性能

  • Measure tool call latency
  • Test concurrent tool calls
  • Test with large resources
  • Monitor memory usage
  • Check for memory leaks

中文:

使用此清单全面测试您的 MCP 客户端实现与 MCP Server Everything。

(清单项目同上,已翻译为中文)

Example Testing Script | 测试脚本示例

English:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Example MCP client testing script

import { MCPClient } from '@modelcontextprotocol/sdk';

async function testMCPClient() {
const client = new MCPClient({
transport: 'stdio',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-everything']
});

try {
// 1. Initialize
console.log('Connecting to server...');
await client.connect();

// 2. Test echo tool
console.log('Testing echo tool...');
const echoResult = await client.callTool({
name: 'echo',
arguments: { message: 'Hello, MCP!' }
});
console.log('Echo result:', echoResult);

// 3. Test add tool
console.log('Testing add tool...');
const addResult = await client.callTool({
name: 'add',
arguments: { a: 15, b: 27 }
});
console.log('Add result:', addResult);

// 4. Test long running operation
console.log('Testing long running operation...');
const progressPromise = client.callTool({
name: 'longRunningOperation'
});

// Listen for progress notifications
client.on('notification', (notification) => {
if (notification.method === 'notifications/progress') {
console.log(`Progress: ${notification.params.progress}/${notification.params.total}`);
}
});

await progressPromise;
console.log('Long running operation complete');

// 5. Test resource listing
console.log('Testing resource listing...');
const resources = await client.listResources();
console.log(`Found ${resources.resources.length} resources`);
console.log('Next cursor:', resources.nextCursor);

// 6. Test resource reading
console.log('Testing resource reading...');
const resource = await client.readResource('test://resource/42');
console.log('Resource content:', resource);

// 7. Test prompts
console.log('Testing prompts...');
const prompts = await client.listPrompts();
console.log(`Found ${prompts.prompts.length} prompts`);

console.log('All tests passed!');

} catch (error) {
console.error('Test failed:', error);
} finally {
await client.disconnect();
}
}

testMCPClient();

中文:

(代码示例相同,注释已翻译为中文)

Integration with MCP Inspector | 与 MCP Inspector 集成

English:

MCP Inspector is the official debugging tool for MCP servers. Use it with MCP Server Everything:

1
2
3
4
5
# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Inspect MCP Server Everything
mcp-inspector npx -y @modelcontextprotocol/server-everything

Inspector Features:

  • Interactive tool calling
  • Resource browsing
  • Prompt testing
  • Request/response inspection
  • Performance monitoring
  • WebUI for visual exploration

Browser Interface:
The inspector opens a web interface (usually at http://localhost:5173) where you can:

  1. See all available tools, resources, and prompts
  2. Call tools interactively with custom parameters
  3. View real-time logs and notifications
  4. Inspect request/response JSON
  5. Test different transport protocols

中文:

MCP Inspector 是 MCP 服务器的官方调试工具。与 MCP Server Everything 一起使用:

1
2
3
4
5
# 安装 MCP Inspector
npm install -g @modelcontextprotocol/inspector

# 检查 MCP Server Everything
mcp-inspector npx -y @modelcontextprotocol/server-everything

Inspector 功能:

  • 交互式工具调用
  • 资源浏览
  • 提示测试
  • 请求/响应检查
  • 性能监控
  • 用于可视化探索的 WebUI

浏览器界面:
检查器打开一个 Web 界面(通常在 http://localhost:5173),您可以在其中:

  1. 查看所有可用的工具、资源和提示
  2. 使用自定义参数交互式调用工具
  3. 查看实时日志和通知
  4. 检查请求/响应 JSON
  5. 测试不同的传输协议

Use Cases for Client Developers | 客户端开发者使用场景

1. Protocol Compliance Testing | 1. 协议合规性测试

English:

Verify your client correctly implements all MCP protocol features:

Test Coverage:

  • Tool calling (simple and complex)
  • Resource access (read, list, subscribe)
  • Prompt retrieval and rendering
  • Progress notifications
  • LLM sampling requests
  • Content annotations
  • Structured data handling
  • Error responses
  • Logging

Workflow:

  1. Connect to server
  2. Systematically call each tool
  3. Verify responses match expected format
  4. Check edge cases and error handling
  5. Generate compliance report

中文:

验证您的客户端正确实现了所有 MCP 协议功能:

测试覆盖范围:

  • 工具调用(简单和复杂)
  • 资源访问(读取、列表、订阅)
  • 提示检索和渲染
  • 进度通知
  • LLM 采样请求
  • 内容注释
  • 结构化数据处理
  • 错误响应
  • 日志记录

工作流:

  1. 连接到服务器
  2. 系统地调用每个工具
  3. 验证响应与预期格式匹配
  4. 检查边缘情况和错误处理
  5. 生成合规性报告

2. UI/UX Development | 2. UI/UX 开发

English:

Design and test user interfaces for MCP interactions:

UI Components to Test:

  • Tool selector and parameter input forms
  • Progress bars and loading indicators
  • Resource browsers with pagination
  • Prompt template selectors
  • Log viewers
  • Notification panels
  • Error message displays

Example:
Build a tool invocation UI where users select add tool, input parameters in form fields, and see the result displayed clearly.

中文:

设计和测试 MCP 交互的用户界面:

要测试的 UI 组件:

  • 工具选择器和参数输入表单
  • 进度条和加载指示器
  • 具有分页功能的资源浏览器
  • 提示模板选择器
  • 日志查看器
  • 通知面板
  • 错误消息显示

示例:
构建一个工具调用 UI,用户可以选择 add 工具,在表单字段中输入参数,并清楚地看到显示的结果。

3. Performance Benchmarking | 3. 性能基准测试

English:

Measure client performance metrics:

Metrics to Track:

  • Connection establishment time
  • Tool call latency (average, p95, p99)
  • Resource fetch time
  • Progress notification latency
  • Memory usage over time
  • Concurrent request handling

Benchmark Script:

1
2
3
4
5
6
7
// Measure 100 echo calls
const start = Date.now();
for (let i = 0; i < 100; i++) {
await client.callTool({ name: 'echo', arguments: { message: `Test ${i}` } });
}
const duration = Date.now() - start;
console.log(`Average latency: ${duration / 100}ms`);

中文:

测量客户端性能指标:

要跟踪的指标:

  • 连接建立时间
  • 工具调用延迟(平均、p95、p99)
  • 资源获取时间
  • 进度通知延迟
  • 随时间的内存使用
  • 并发请求处理

(基准脚本相同)

4. Error Recovery Testing | 4. 错误恢复测试

English:

Test client resilience and error handling:

Scenarios:

  • Server crashes mid-operation
  • Network interruptions
  • Invalid server responses
  • Timeout scenarios
  • Resource not found errors
  • Permission denied errors

中文:

测试客户端弹性和错误处理:

场景:

  • 操作中服务器崩溃
  • 网络中断
  • 无效的服务器响应
  • 超时场景
  • 找不到资源错误
  • 权限被拒绝错误

5. Integration Testing | 5. 集成测试

English:

Test client in realistic workflows combining multiple features:

Example Workflow:

  1. Connect to server
  2. List all tools
  3. Call echo to verify connectivity
  4. Subscribe to resource test://resource/42
  5. Call longRunningOperation and monitor progress
  6. Receive resource update notification
  7. Read updated resource
  8. Call sampleLLM to test AI integration
  9. Clean up and disconnect

中文:

在结合多个功能的现实工作流中测试客户端:

示例工作流:

  1. 连接到服务器
  2. 列出所有工具
  3. 调用 echo 验证连接
  4. 订阅资源 test://resource/42
  5. 调用 longRunningOperation 并监控进度
  6. 接收资源更新通知
  7. 读取更新的资源
  8. 调用 sampleLLM 测试 AI 集成
  9. 清理并断开连接

6. Educational and Training | 6. 教育和培训

English:

Learn MCP protocol by interacting with real examples:

Learning Path:

  1. Start with simple tools (echo, add)
  2. Progress to binary data (getTinyImage)
  3. Understand progress notifications (longRunningOperation)
  4. Explore advanced features (LLM sampling, annotations)
  5. Master resource management (pagination, subscriptions)
  6. Study the server’s source code for implementation patterns

Teaching Materials:

  • Workshop exercises using each tool
  • Code examples for every feature
  • Debugging exercises with MCP Inspector
  • Building a complete client from scratch

中文:

通过与实际示例交互学习 MCP 协议:

学习路径:

  1. 从简单工具开始(echo、add)
  2. 进展到二进制数据(getTinyImage)
  3. 理解进度通知(longRunningOperation)
  4. 探索高级功能(LLM 采样、注释)
  5. 掌握资源管理(分页、订阅)
  6. 研究服务器的源代码以了解实现模式

教学材料:

  • 使用每个工具的研讨会练习
  • 每个功能的代码示例
  • 使用 MCP Inspector 的调试练习
  • 从头开始构建完整的客户端

Best Practices | 最佳实践

For Client Developers | 对于客户端开发者

English:

  1. Start Simple: Begin with echo and add tools before tackling complex features
  2. Handle All Content Types: Test both text and binary resources (even vs. odd IDs)
  3. Implement Progress UI: Users need feedback for long operations
  4. Cache Resources: Avoid redundant fetches, especially for paginated resources
  5. Error Recovery: Always handle errors gracefully with retries and user messaging
  6. Logging Integration: Capture and display server logs for debugging
  7. Test Edge Cases: Empty responses, large data, concurrent operations
  8. Performance Monitoring: Track latency and memory usage
  9. Use MCP Inspector: Debug with the official tool before deploying
  10. Read the Spec: Consult the MCP protocol specification alongside testing

中文:

  1. 从简单开始:在处理复杂功能之前,先从 echoadd 工具开始
  2. 处理所有内容类型:测试文本和二进制资源(偶数 vs. 奇数 ID)
  3. 实现进度 UI:用户需要长时间操作的反馈
  4. 缓存资源:避免冗余获取,尤其是分页资源
  5. 错误恢复:始终通过重试和用户消息优雅地处理错误
  6. 日志集成:捕获并显示服务器日志以进行调试
  7. 测试边缘情况:空响应、大数据、并发操作
  8. 性能监控:跟踪延迟和内存使用
  9. 使用 MCP Inspector:在部署之前使用官方工具进行调试
  10. 阅读规范:在测试的同时查阅 MCP 协议规范

For Server Developers | 对于服务器开发者

English:

  1. Study This Implementation: MCP Server Everything is the reference - read its source code
  2. Follow Patterns: Match the response formats and behaviors demonstrated here
  3. Implement All Features: Tools, resources, prompts, and notifications
  4. Test with Multiple Clients: Use Claude Desktop, MCP Inspector, custom clients
  5. Document Thoroughly: Clear documentation helps client developers integrate
  6. Version Your API: Use semantic versioning for breaking changes
  7. Provide Examples: Include usage examples for every tool
  8. Log Appropriately: Use structured logging at appropriate levels
  9. Handle Errors Well: Return informative error messages
  10. Consider Performance: Optimize for latency and throughput

中文:

  1. 研究此实现:MCP Server Everything 是参考 - 阅读其源代码
  2. 遵循模式:匹配此处演示的响应格式和行为
  3. 实现所有功能:工具、资源、提示和通知
  4. 使用多个客户端测试:使用 Claude Desktop、MCP Inspector、自定义客户端
  5. 彻底记录:清晰的文档有助于客户端开发者集成
  6. 版本化您的 API:对重大更改使用语义版本控制
  7. 提供示例:为每个工具包含使用示例
  8. 适当记录日志:在适当的级别使用结构化日志记录
  9. 良好处理错误:返回信息丰富的错误消息
  10. 考虑性能:优化延迟和吞吐量

FAQ | 常见问题

General Questions | 一般问题

Q: Is this server meant for production use?
A: No. MCP Server Everything is explicitly designed as a testing and reference server for client developers. It’s not optimized for production workloads.

Q: Why are there exactly 100 test resources?
A: This provides sufficient resources to test pagination (10 resources per page = 10 pages) while remaining manageable for testing purposes.

Q: Why do even/odd IDs have different formats?
A: To ensure clients can handle both plaintext and binary resource types, which is essential for real-world MCP servers.

Q: How often do resources update?
A: Resources automatically update every 5 seconds to test notification handling.

Q: How often are log messages sent?
A: Random log messages are sent every 15 seconds to test log handling capabilities.


问:此服务器是否适用于生产使用?
答: 不。MCP Server Everything 明确设计为客户端开发者的测试和参考服务器。它未针对生产工作负载进行优化。

问:为什么恰好有 100 个测试资源?
答: 这提供了足够的资源来测试分页(每页 10 个资源 = 10 页),同时保持可管理以用于测试目的。

问:为什么偶数/奇数 ID 有不同的格式?
答: 为了确保客户端可以处理纯文本和二进制资源类型,这对于现实世界的 MCP 服务器至关重要。

问:资源多久更新一次?
答: 资源每 5 秒自动更新一次以测试通知处理。

问:日志消息多久发送一次?
答: 每 15 秒发送一次随机日志消息以测试日志处理能力。

Technical Questions | 技术问题

Q: Which transport protocol should I use?
A: Use stdio for local processes. Use streamable HTTP for remote servers or cloud deployments. Avoid deprecated HTTP+SSE.

Q: How do I test LLM sampling if I don’t have an LLM?
A: You can mock the LLM response in your client for testing purposes, or use a free API like OpenAI’s GPT-3.5-turbo with minimal costs.

Q: Can I modify the server to add my own tools?
A: Yes! The server is open source under MIT license. Fork it and add your own tools for custom testing scenarios.

Q: How do I debug connection issues?
A: Use MCP Inspector to see detailed request/response logs. Check stderr for server logs. Verify your transport configuration matches the server’s expected format.

Q: Does the server support authentication?
A: No, this is a test server. For production servers requiring authentication, implement token-based auth in headers (for HTTP transport) or environment variables (for stdio).


问:我应该使用哪种传输协议?
答: 对于本地进程使用 stdio。对于远程服务器或云部署使用可流式传输的 HTTP。避免使用已弃用的 HTTP+SSE。

问:如果我没有 LLM,如何测试 LLM 采样?
答: 您可以在客户端中模拟 LLM 响应以进行测试,或者使用像 OpenAI 的 GPT-3.5-turbo 这样的免费 API,成本很低。

问:我可以修改服务器以添加我自己的工具吗?
答: 可以!该服务器在 MIT 许可下是开源的。分叉它并为自定义测试场景添加您自己的工具。

问:如何调试连接问题?
答: 使用 MCP Inspector 查看详细的请求/响应日志。检查 stderr 以获取服务器日志。验证您的传输配置与服务器的预期格式匹配。

问:服务器是否支持身份验证?
答: 不支持,这是一个测试服务器。对于需要身份验证的生产服务器,在标头中实现基于令牌的身份验证(对于 HTTP 传输)或环境变量(对于 stdio)。

Troubleshooting | 故障排除

Q: Server fails to start with “command not found”
A: Ensure Node.js 16+ is installed and npx is available in your PATH.

Q: I’m not receiving progress notifications
A: Verify your client has registered a handler for notifications/progress. Check that notifications aren’t being filtered or dropped.

Q: Resource pagination isn’t working
A: Make sure you’re correctly passing the nextCursor value from the previous response to the next resources/list call.

Q: Images aren’t displaying
A: Verify base64 decoding is working correctly. Check that MIME type is properly recognized. Ensure blob URLs are created correctly in the browser.

Q: Random logs aren’t appearing
A: Logs are sent to stderr, not stdout. Ensure your client is monitoring the server process’s stderr stream.


问:服务器启动失败,出现”找不到命令”错误
答: 确保安装了 Node.js 16+ 并且 npx 在您的 PATH 中可用。

问:我没有收到进度通知
答: 验证您的客户端已为 notifications/progress 注册了处理程序。检查通知是否未被过滤或丢弃。

问:资源分页不起作用
答: 确保您正确地将上一个响应中的 nextCursor 值传递给下一个 resources/list 调用。

问:图像未显示
答: 验证 base64 解码是否正常工作。检查 MIME 类型是否正确识别。确保在浏览器中正确创建 blob URL。

问:随机日志未出现
答: 日志发送到 stderr,而不是 stdout。确保您的客户端正在监控服务器进程的 stderr 流。

Project Information | 项目信息

Repository Details | 仓库详情

  • Repository: modelcontextprotocol/servers
  • Subdirectory: src/everything
  • Stars: 70,200+ ⭐
  • Official: Yes (Anthropic)
  • License: MIT
  • Language: TypeScript
  • MCP SDK: @modelcontextprotocol/sdk (latest)
  • Node.js: >=16.0.0

Dependencies | 依赖项

1
2
3
4
{
"@modelcontextprotocol/sdk": "^1.0.0",
"typescript": "^5.0.0"
}

Contributing | 贡献

English:

Contributions are welcome! This is an official Anthropic project, so contributions should align with MCP protocol standards.

How to Contribute:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new features
  5. Submit a pull request
  6. Ensure CI passes

Areas for Contribution:

  • Additional test tools demonstrating edge cases
  • Enhanced documentation and examples
  • Performance optimizations
  • Bug fixes
  • Transport protocol improvements

中文:

欢迎贡献!这是一个官方的 Anthropic 项目,因此贡献应与 MCP 协议标准保持一致。

如何贡献:

  1. Fork 仓库
  2. 创建功能分支
  3. 进行更改
  4. 为新功能添加测试
  5. 提交 pull request
  6. 确保 CI 通过

贡献领域:

  • 演示边缘情况的额外测试工具
  • 增强的文档和示例
  • 性能优化
  • Bug 修复
  • 传输协议改进

Conclusion | 结论

English:

MCP Server Everything represents the gold standard for MCP protocol implementation. As the official reference server from Anthropic with over 70,000 stars, it provides:

Complete Protocol Coverage: All 11 tool types, 100 resources, 3 prompt templates
Production-Grade Code: TypeScript implementation with high code quality
Comprehensive Testing: Essential tool for validating MCP client implementations
Educational Value: Best resource for learning MCP protocol development
Active Maintenance: Regular updates aligned with protocol evolution

Whether you’re building a new MCP client, validating an existing implementation, or learning the protocol from scratch, MCP Server Everything is your essential companion. Its comprehensive feature set and clear implementation patterns make it the definitive reference for the MCP ecosystem.

Start testing your MCP client today with the reference implementation that defines the standard.

中文:

MCP Server Everything 代表了 MCP 协议实现的黄金标准。作为来自 Anthropic 的拥有超过 70,000 星标的官方参考服务器,它提供:

完整的协议覆盖:所有 11 种工具类型、100 个资源、3 个提示模板
生产级代码:高代码质量的 TypeScript 实现
全面测试:验证 MCP 客户端实现的必备工具
教育价值:学习 MCP 协议开发的最佳资源
积极维护:与协议演进同步的定期更新

无论您是构建新的 MCP 客户端、验证现有实现,还是从头开始学习协议,MCP Server Everything 都是您必不可少的伙伴。其全面的功能集和清晰的实现模式使其成为 MCP 生态系统的权威参考。

立即使用定义标准的参考实现开始测试您的 MCP 客户端。


Score: 4.7/5.0

Rating Breakdown:

  • Functionality: 5.0/5.0 - Complete MCP protocol implementation
  • Documentation: 4.5/5.0 - Good docs, this guide provides comprehensive coverage
  • Activity: 5.0/5.0 - Official Anthropic project, actively maintained
  • Popularity: 4.5/5.0 - 70,200+ stars, industry standard
  • Code Quality: 5.0/5.0 - Production-grade TypeScript

Official Anthropic MCP Reference Implementation 🌟

Essential for All MCP Client Developers 📚

GitHub: modelcontextprotocol/servers

© 2025 Generative AI Discovery All Rights Reserved.
Theme by hiero