Token导航 LogoToken导航TokenDH.com
MCP E2e logo
开发工具未说明官方级别未说明来源级核验

MCP E2e

MCP Server

一个针对模型上下文协议(MCP)服务器运行端到端测试的命令行工具,支持YAML配置、多服务器测试和多种输出格式。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
测试自动化Go命令行工具

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

yokonao

提供方

yokonao

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP E2E测试工具

用于对模型上下文协议(MCP)服务器运行端到端测试的命令行工具。

特性

  • 基于YAML的配置:在简单的YAML文件中定义服务器和测试用例
  • 多服务器支持:同时测试多个MCP服务器
  • 多个配置文件:支持加载具有自动命名空间的多个配置文件
  • 灵活的测试过滤:使用名称筛选器运行特定测试
  • 多种输出格式:支持人类可读文本和JSON输出
  • 超时控制:服务器启动和测试执行的可配置超时
  • 平滑关闭:正确清理服务器进程

安装

go build -o mcp-e2e .

用法

基本用法

# Run all tests using default configuration (sample.yaml)
./mcp-e2e

# Use a custom configuration file
./mcp-e2e example.yaml

# Use multiple configuration files (automatic namespacing)
./mcp-e2e config1.yaml config2.yaml

# Run specific tests by name filter
./mcp-e2e --test echo

# Output results in JSON format
./mcp-e2e --output json

# Set custom timeout
./mcp-e2e --timeout 60s

多个配置文件

使用多个配置文件时,mcp-e2e会自动应用命名空间以防止服务器名称冲突:

# These files can have the same server names
./mcp-e2e file1.yaml file2.yaml

如果两者都有 file1.yamlfile2.yaml 定义一个名为的服务器 echo_server,它们将被自动命名为:

  • file1:echo_server
  • file2:echo_server

命名空间基于文件名(不带扩展名),并将特殊字符转换为下划线以确保安全。

例子:

  • my-config.yaml → 命名空间: my_config
  • test_server@v1.yaml → 命名空间: test_server_v1

配置文件格式

配置文件使用具有以下结构的YAML格式:

version: 1

servers:
  server_name:
    type: stdio           # Currently only 'stdio' is supported
    cmd: command_name     # Command to start the server
    args:                 # Command arguments
      - arg1
      - arg2

tests:
- name: test_name         # Unique test name
  server: server_name     # Reference to server defined above
  method: method_name     # MCP method to call
  params:                 # Parameters to pass to the method
    key: value

支持的MCP方法

  • tools/list:列出可用工具
  • tools/call:调用特定工具
  • resources/list:列出可用资源
  • prompts/list:列出可用提示

配置示例

sample.yamlexample.yaml 查看完整示例。

回声工具的示例测试

version: 1

servers:
  everything:
    type: stdio
    cmd: npx
    args:
      - -y
      - "@modelcontextprotocol/server-everything"

tests:
- name: echo_test
  server: everything  
  method: tools/call
  params:
    name: echo
    arguments:
      message: "Hello, MCP!"

命令行选项

  • [files...]:配置文件的路径(默认:“sample.yaml”)
  • -t, --test:按名称筛选测试(子字符串匹配)
  • -o, --output:输出格式:“text”或“json”(默认为“text”)
  • --timeout:服务器启动和测试执行超时(默认值:30秒)
  • -l, --log-level:日志级别:调试、信息、警告、错误(默认值:“信息”)
  • -r, --raw:输出原始MCP服务器响应
  • -h, --help:显示帮助消息

输出格式

文本输出(默认)

显示测试结果和详细信息的人类可读格式。

JSON输出

适合与其他工具集成的机器可读JSON格式:

{
  "results": [
    {
      "name": "test_name",
      "server": "server_name", 
      "method": "method_name",
      "success": true,
      "duration": 1234567,
      "response": { ... }
    }
  ],
  "summary": {
    "total": 1,
    "passed": 1,
    "failed": 0
  }
}

退出代码

  • 0:所有测试均通过
  • 1:一个或多个测试失败或发生错误

需求

  • 转到1.24.2或更高版本
  • Node.js和npm(用于MCP服务器示例)

目录标签

目录标签

测试自动化Go命令行工具端到端测试本地部署YAML配置多服务器测试

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP