MCP服务器目录API实战:真实端点与测试模式
介绍 MCP Workbench 的公共目录 API,包含真实请求/响应示例和无需凭证即可模拟 MCP 连接的测试模式。
完整中文译文
Model Context Protocol(MCP)正在迅速成为 AI Agent 连接外部工具的标准。但随着生态系统的不断壮大,开发者需要一个发现、测试和验证 MCP Server 的途径,以便在生产环境使用前做好准备。这就是我们在 MCP Workbench 中构建 MCP Server Directory API 的原因。
在这篇文章中,我将向你展示目录 API 的完整工作原理——包含真实的端点、真实的响应,以及无需凭证即可模拟 MCP 连接的测试模式功能。
MCP Server Directory API
该目录是一个公开的 REST API,读取操作无需认证。以下是基础 URL:
Local: http://localhost:3460
Prod: https://mcp-workbench.uk
GET /api/mcp-servers
curl "http://localhost:3460/api/mcp-servers?limit=3"
{
"servers": [
{
"id": 18,
"name": "Grafana",
"slug": "grafana",
"description": "Query and visualize metrics from Grafana datasources",
"category": "observability",
"verified": false,
"test_mode_enabled": false,
"rating": 0.0,
"install_count": 0,
"github_url": "https://github.com/grafana/grafana-mcp"
},
{
"id": 17,
"name": "OWASP ZAP",
"slug": "owasp-zap",
"description": "Web application security scanner and penetration testing",
"category": "security",
"verified": false,
"test_mode_enabled": false,
"rating": 0.0,
"install_count": 0,
"github_url": "https://github.com/zaproxy/zaproxy-mcp"
}
],
"count": 3
}
按分类筛选
curl "http://localhost:3460/api/mcp-servers?category=security"
可用分类:ai-ml、browser-automation、database、development、filesystem、http、integration、observability、search、security
获取 Server 详情
GET /api/mcp-servers/{slug}
curl "http://localhost:3460/api/mcp-servers/playwright-mcp"
{
"id": 1,
"name": "Playwright MCP",
"slug": "playwright-mcp",
"description": "Official Microsoft MCP server for browser automation",
"github_url": "https://github.com/microsoft/playwright-mcp",
"npm_package": "@playwright/mcp",
"category": "browser-automation",
"verified": true,
"ccs_verification_id": "mw-ccs-a1b2c3d4e5f6",
"ccs_score": 0.92,
"test_mode_enabled": true,
"rating": 4.8,
"install_count": 1243,
"created_at": "2026-08-04T18:03:37Z",
"badge_url": "/api/integrations/ccs/badge/mw-ccs-a1b2c3d4e5f6",
"embed_code": "<img src='/api/integrations/ccs/badge/mw-ccs-a1b2c3d4e5f6' alt='CCS Protocol Compliant'/>"
}
Test Mode:无需凭证模拟连接
这是开发者询问最多的功能:如何在花时间配置凭证之前验证一个 MCP Server 能否正常工作?
/test-mode 端点模拟完整的 MCP 连接握手过程:
GET /api/mcp-servers/{slug}/test-mode
curl "http://localhost:3460/api/mcp-servers/playwright-mcp/test-mode"
{
"server_id": "playwright-mcp",
"test_mode": true,
"status": "connected",
"connection_time_ms": 245,
"tests": {
"startup": {
"passed": true,
"duration_ms": 45,
"details": "Server process launched successfully"
},
"initialization": {
"passed": true,
"duration_ms": 120,
"details": "JSON-RPC initialize handshake successful"
},
"tool_discovery": {
"passed": true,
"duration_ms": 80,
"details": "3 tools discovered"
},
"schema_validation": {
"passed": true,
"duration_ms": 0,
"details": "All tool schemas valid"
}
},
"verification_summary": {
"total_tests": 4,
"passed": 4,
"failed": 0,
"overall_status": "verified"
}
}
Test Mode 从四个关键维度进行验证:
Startup — Server 进程能否启动?
Initialization — JSON-RPC 握手是否成功?
Tool Discovery — 工具是否正确发布?
Schema Validation — 工具 Schema 格式是否正确?
向目录添加 Server
认证用户可以通过 POST /api/mcp-servers 添加 Server:
curl -X POST "http://localhost:3460/api/mcp-servers" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My Custom MCP Server",
"slug": "my-custom-mcp",
"description": "A custom MCP server for my use case",
"github_url": "https://github.com/user/my-mcp-server",
"npm_package": "@user/my-mcp",
"category": "development",
"test_mode_enabled": true
}'
CCS 验证徽章
通过 Correctover Conformity Check(CCS)的 Server 会获得一枚验证徽章:
<img src="/api/integrations/ccs/badge/mw-ccs-a1b2c3d4e5f6" alt="CCS Protocol Compliant"/>
徽章颜色编码规则:
- 绿色(≥90%)— 符合规范
- 黄色(≥70%)— 有条件通过
- 红色(<70%)— 需要审核
速率限制
- 公开访问:每个 IP 每 60 秒 100 次请求
- 认证用户:无限制
MCP Workbench 目录服务于不断增长的 MCP Server 生态系统。无论你是:
- 正在构建一个新的 MCP Server,想要获得早期反馈
- 正在维护一个现有的 Server,想要进行验证
- 在寻找某个特定分类的 Server
……目录 API 都能为你提供对该生态系统的程序化访问方式。
在线访问:https://mcp-workbench.uk API 文档:https://mcp-workbench.uk/api-docs GitHub:https://github.com/mcp-workbench/mcp-workbench