About Mcp Api Tester
Mcp Api Tester is an MCP server for testing HTTP APIs and turning JSON responses into TypeScript interfaces. It is aimed at developers who want to inspect requests and generate types from within an MCP client.
Key features
- 01Test HTTP methods and APIs
- 02Configure headers and request bodies
- 03Preview response status and data
- 04Generate TypeScript interfaces
Use cases
- 01Check an API response during development
- 02Generate types from returned JSON
MCP support
Provides an `apiTester` tool to MCP clients for sending HTTP requests and returning response data with generated TypeScript interfaces. It supports stdio and HTTP modes.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
1Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | API request URL; must be a valid URL |
| body | any | No | Request body; can be JSON, a string, or an object, and is handled automatically based on method |
| method | enum | No | HTTP request method; defaults to GETGET | POST | PUT | DELETE | PATCH | HEAD | OPTIONS |
| headers | object | No | Request headers as key-value pairs, e.g. {"Authorization": "Bearer ..."} |
| expectStatus | integer | No | Expected HTTP status code; defaults to 200 |
Details
From the project READMEMCP API Tester Server
这是一个基于 Model Context Protocol (MCP) 的 API 测试工具服务器。它可以测试任意 HTTP API 并自动生成 TypeScript 类型定义。
安装
全局安装
npm install -g mcp-api-tester
本地安装
npm install mcp-api-tester
从源码安装
git clone https://github.com/xingonliu/api-tester
cd mcp-api-tester
npm install
npm run build
使用方法
作为 npm 包使用
安装后,你可以通过以下方式运行:
# 全局安装后
mcp-api-tester
# 或者使用 npx
npx mcp-api-tester
# 本地安装后
npx mcp-api-tester
开发模式
1. HTTP模式
npm run dev
服务器将在 http://localhost:3000/mcp 运行
2. stdio模式(MCP标准方式)
npm run dev:stdio
3. 构建生产版本
npm run build
node dist/stdio-server.js
MCP客户端配置
要连接到这个服务器,在MCP客户端配置中添加:
全局安装后
{
"mcpServers": {
"api-tester": {
"command": "mcp-api-tester"
}
}
}
本地安装或直接使用
{
"mcpServers": {
"api-tester": {
"command": "node",
"args": ["path/to/dist/stdio-server.js"]
}
}
}
使用 npx
{
"mcpServers": {
"api-tester": {
"command": "npx",
"args": ["mcp-api-tester"]
}
}
}
工具功能
apiTester 工具
- 功能: 测试任意HTTP API并生成TypeScript类型定义
- 输入: URL、HTTP方法、请求头、请求体等
- 输出: API响应数据和自动生成的TypeScript接口
文件结构
├── src/
│ ├── index.ts # HTTP服务器版本
│ ├── stdio-server.ts # stdio服务器版本(MCP标准)
│ ├── tools/
│ │ └── apiTester.ts # API测试工具实现
│ └── utils/
│ └── quicktypeGen.ts # TypeScript类型生成工具
├── dist/ # 编译后的JavaScript文件
└── mcp-config.json # MCP客户端配置示例
现在你的MCP服务器应该可以正常工作了!🎉
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.