Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cursor-api-testing-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Cursor API Testing MCP
简化版API测试MCP服务器 - 专为Cursor设计的轻量级API接口测试工具。
✨ 功能特性
- 🚀 单个API测试 - 支持GET/POST/PUT/DELETE/PATCH方法
- 📊 批量测试 - 并发测试多个端点
- 📋 完整响应 - 显示原始JSON数据和响应头
- ⚡ 高性能 - 支持并发请求和性能监控
- 🔍 智能错误分类 - 自动分析网络、认证、业务错误
- 🌐 跨平台 - 支持HTTP/HTTPS,本地和远程API
🔧 支持的工具
| 工具名 | 功能描述 | 参数 |
|---|---|---|
test_api |
测试单个API端点 | endpoint, method, test_data, auth_token |
batch_test |
批量测试多个端点 | module_name, endpoints[], concurrent_limit |
📦 安装方式
方式1: NPM全局安装
npm install -g cursor-api-testing-mcp方式2: 本地项目安装
npm install cursor-api-testing-mcp方式3: 从源码构建
git clone https://github.com/YuGe-Git/cursor-api-testing-mcp.git
cd cursor-api-testing-mcp
npm install
npm run build⚙️ Cursor配置
在Cursor的 settings.json 中添加MCP配置:
{
"mcp": {
"api-testing": {
"command": "api-testing-mcp",
"env": {
"NODE_ENV": "production"
}
}
}
}或者使用本地路径:
{
"mcp": {
"api-testing": {
"command": "node",
"args": ["/path/to/cursor-api-testing-mcp/dist/index.js"],
"env": {
"NODE_ENV": "production"
}
}
}
}🚀 使用示例
单个API测试
// 在Cursor中调用
mcp_api-testing_test_api({
endpoint: "https://httpbin.org/get",
method: "GET"
})
// POST请求示例
mcp_api-testing_test_api({
endpoint: "https://httpbin.org/post",
method: "POST",
test_data: {"name": "测试", "type": "API"},
auth_token: "Bearer your-token"
})批量测试
mcp_api-testing_batch_test({
module_name: "用户API测试",
endpoints: [
"GET https://api.example.com/users",
"POST https://api.example.com/users",
"PUT https://api.example.com/users/1"
],
concurrent_limit: 3
})📊 输出示例
✅ API 测试结果
端点信息:
- 方法: POST
- 路径: https://httpbin.org/post
- 状态: 成功
性能指标:
- HTTP状态码: 200
- 响应时间: 156ms
- 测试时间: 2025-01-20T10:30:45.123Z
响应数据:
```json
{
"args": {},
"data": "{\"name\": \"测试\"}",
"json": {
"name": "测试"
}
}响应头 (主要):
- content-type: application/json
- server: gunicorn/19.9.0
## 🛠 开发指南
### 本地开发
```bash
# 克隆项目
git clone https://github.com/YuGe-Git/cursor-api-testing-mcp.git
cd cursor-api-testing-mcp
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建项目
npm run build
# 启动服务
npm start构建命令
npm run build- TypeScript编译npm run dev- 开发模式npm run clean- 清理dist目录npm run package- 创建NPM包npm run release- 构建并发布
📝 更新日志
v2.0.0
- ✨ 简化工具数量,只保留核心功能
- 🔧 工具名称缩短 (test_api, batch_test)
- 📋 优化输出格式,去除Markdown加粗
- 🚀 提升性能和稳定性
v1.0.0
- 🎉 初始版本发布
- 🔧 8个完整测试工具
- 📊 完整的Swagger解析和报告生成
🤝 贡献指南
- Fork项目
- 创建功能分支:
git checkout -b feature-name - 提交更改:
git commit -am 'Add feature' - 推送分支:
git push origin feature-name - 提交Pull Request
📄 许可证
MIT License - 详见 LICENSE 文件
🔗 相关链接
Made with ❤️ for Cursor developers