mcpField
M
Mcp Api Tester

Mcp Api Tester

Local
github.com/xingonliuDeveloper Tools3Updated 55w ago

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

  1. 01Test HTTP methods and APIs
  2. 02Configure headers and request bodies
  3. 03Preview response status and data
  4. 04Generate TypeScript interfaces

Use cases

  1. 01Check an API response during development
  2. 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.

mcp.json · Universal config
{
"mcpServers": {
"api-tester": {
"command": "npx",
"args": [
"-y",
"mcp-api-tester"
]
}
}
}
Run commandnpx -y mcp-api-tester

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp-api-tester

Tools

1

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
urlstringYesAPI request URL; must be a valid URL
bodyanyNoRequest body; can be JSON, a string, or an object, and is handled automatically based on method
methodenumNoHTTP request method; defaults to GETGET | POST | PUT | DELETE | PATCH | HEAD | OPTIONS
headersobjectNoRequest headers as key-value pairs, e.g. {"Authorization": "Bearer ..."}
expectStatusintegerNoExpected HTTP status code; defaults to 200

Details

From the project README

MCP 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

Markdown supported

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.