
MCP REST API Tester

2025.01.30
32
JavaScriptAPI 测试开发工具开发效率
MCP REST API Tester 是一个基于 TypeScript 的 MCP 服务器,用于通过 Cline 测试 REST API。该工具允许开发者直接从开发环境中测试和交互任何 REST API 端点,支持多种 HTTP 方法和认证方式,并提供详细的响应信息。
View on GitHub
Overview
基本能力
产品定位
MCP REST API Tester 是一个用于测试和交互 REST API 的开发工具,旨在帮助开发者快速验证和调试 API 端点。
核心功能
- 支持 GET、POST、PUT、DELETE 方法
- 处理多种认证方式(Basic、Bearer、API Key)
- 自动规范化端点
- 提供详细的响应信息
- 可配置的 SSL 验证和响应大小限制
- 自定义请求头
- 请求体处理(POST/PUT)
- 响应大小管理
适用场景
- 测试特定 API 端点
- 调试 API 响应
- 验证 API 功能
- 检查响应时间
- 验证请求/响应格式
- 测试本地开发服务器
- 测试 API 序列
- 验证错误处理
工具列表
test_request
:用于测试、调试和交互 REST API 端点,提供全面的请求/响应信息,并自动处理认证。
常见问题解答
- Windows 路径问题:由于 Windows 路径解析问题,必须使用完整路径而非
%APPDATA%
。 - 认证配置:只能配置一种认证方式(Basic Auth、Bearer Token 或 API Key)。
- SSL 验证:默认启用,可通过环境变量禁用。
使用教程
使用依赖
- 需要安装 Node.js 和 npm。
安装教程
通过 Smithery 安装
npx -y @smithery/cli install dkmaker-mcp-rest-api --client claude
手动安装
- 全局安装包:
npm install -g dkmaker-mcp-rest-api
- 配置 Cline 自定义指令: 将以下内容添加到 Cline 自定义指令中(设置 > 自定义指令):
# REST API Testing Instructions
The `test_request` tool enables testing, debugging, and interacting with REST API endpoints. The tool provides comprehensive request/response information and handles authentication automatically.
## When to Use
- Testing specific API endpoints
- Debugging API responses
- Verifying API functionality
- Checking response times
- Validating request/response formats
- Testing local development servers
- Testing API sequences
- Verifying error handling
## Key Features
- Supports GET, POST, PUT, DELETE methods
- Handles authentication (Basic, Bearer, API Key)
- Normalizes endpoints automatically
- Provides detailed response information
- Configurable SSL verification and response limits
## Resources
The following resources provide detailed documentation:
- examples: Usage examples and common patterns
- response-format: Response structure and fields
- config: Configuration options and setup guide
Access these resources to understand usage, response formats, and configuration options.
## Important Notes
- Review API implementation for expected behavior
- Handle sensitive data appropriately
- Consider rate limits and API constraints
- Restart server after configuration changes
- 将服务器添加到 MCP 配置中:
根据操作系统配置
cline_mcp_settings.json
文件。
调试方式
安装完成后,可以通过以下命令测试 API 端点:
// Test a GET endpoint
use_mcp_tool('rest-api', 'test_request', {
"method": "GET",
"endpoint": "/users"
});
// Test a POST endpoint with body
use_mcp_tool('rest-api', 'test_request', {
"method": "POST",
"endpoint": "/users",
"body": {
"name": "John Doe",
"email": "[email protected]"
}
});
// Test with custom headers
use_mcp_tool('rest-api', 'test_request', {
"method": "GET",
"endpoint": "/products",
"headers": {
"Accept-Language": "en-US",
"X-Custom-Header": "custom-value"
}
});