Skip to main content
Glama
dkmaker

mcp-rest-api

MCP REST API 测试器

许可证:MIT NPM 包 铁匠徽章

基于 TypeScript 的 MCP 服务器,支持通过 Cline 测试 REST API。此工具允许您直接从开发环境测试并与任何 REST API 端点交互。

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 REST API Tester:

npx -y @smithery/cli install dkmaker-mcp-rest-api --client claude

手动安装

  1. 全局安装包:

npm install -g dkmaker-mcp-rest-api
  1. 配置 Cline 自定义说明:

为了确保 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
  1. 将服务器添加到您的 MCP 配置:

虽然这些说明适用于 Cline,但服务器应该适用于任何 MCP 实现。请根据您的操作系统进行配置:

视窗

⚠️重要提示:由于 Windows 路径解析存在已知问题(问题 #40 ),您必须使用完整路径而不是 %APPDATA%。

添加到C:\Users\<YourUsername>\AppData\Roaming\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

{
  "mcpServers": {
    "rest-api": {
      "command": "node",
      "args": [
        "C:/Users/<YourUsername>/AppData/Roaming/npm/node_modules/dkmaker-mcp-rest-api/build/index.js"
      ],
      "env": {
        "REST_BASE_URL": "https://api.example.com",
        // Basic Auth
        "AUTH_BASIC_USERNAME": "your-username",
        "AUTH_BASIC_PASSWORD": "your-password",
        // OR Bearer Token
        "AUTH_BEARER": "your-token",
        // OR API Key
        "AUTH_APIKEY_HEADER_NAME": "X-API-Key",
        "AUTH_APIKEY_VALUE": "your-api-key",
        // SSL Verification (enabled by default)
        "REST_ENABLE_SSL_VERIFY": "false", // Set to false to disable SSL verification for self-signed certificates
        // Response Size Limit (optional, defaults to 10000 bytes)
        "REST_RESPONSE_SIZE_LIMIT": "10000", // Maximum response size in bytes
        // Custom Headers (optional)
        "HEADER_X-API-Version": "2.0",
        "HEADER_Custom-Client": "my-client",
        "HEADER_Accept": "application/json"
      }
    }
  }
}

macOS

添加到~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

{
  "mcpServers": {
    "rest-api": {
      "command": "npx",
      "args": [
        "-y",
        "dkmaker-mcp-rest-api"
      ],
      "env": {
        "REST_BASE_URL": "https://api.example.com",
        // Basic Auth
        "AUTH_BASIC_USERNAME": "your-username",
        "AUTH_BASIC_PASSWORD": "your-password",
        // OR Bearer Token
        "AUTH_BEARER": "your-token",
        // OR API Key
        "AUTH_APIKEY_HEADER_NAME": "X-API-Key",
        "AUTH_APIKEY_VALUE": "your-api-key",
        // SSL Verification (enabled by default)
        "REST_ENABLE_SSL_VERIFY": "false", // Set to false to disable SSL verification for self-signed certificates
        // Custom Headers (optional)
        "HEADER_X-API-Version": "2.0",
        "HEADER_Custom-Client": "my-client",
        "HEADER_Accept": "application/json"
      }
    }
  }
}

注意:请将环境变量替换为您的实际值。一次只能配置一种身份验证方法:

  1. 基本身份验证(用户名/密码)

  2. 持有者令牌(如果未配置基本身份验证)

  3. API 密钥(如果未配置基本身份验证或承载令牌)

Related MCP server: Notion Knowledge Base MCP Server

特征

  • 使用不同的 HTTP 方法测试 REST API 端点

  • 支持 GET、POST、PUT 和 DELETE 请求

  • 详细的响应信息,包括状态、标题和正文

  • 自定义标题:

    • 通过 HEADER_* 环境变量的全局标头

    • 不区分大小写的前缀(HEADER_、header_、HeAdEr_)

    • 标题名称的大小写保存

    • 基于优先级的应用程序(每个请求 > 授权 > 自定义)

  • POST/PUT 方法的请求主体处理

  • 响应大小管理:

    • 自动响应大小限制(默认值:10KB/10000 字节)

    • 可通过 REST_RESPONSE_SIZE_LIMIT 环境变量配置大小限制

    • 当响应超出限制时清除截断元数据

    • 保留响应结构,同时仅截断正文内容

  • SSL 证书验证:

    • 默认启用以确保安全操作

    • 可以针对自签名证书或开发环境禁用

    • 通过 REST_ENABLE_SSL_VERIFY 环境变量控制

  • 多种身份验证方法:

    • 基本身份验证(用户名/密码)

    • Bearer Token 身份验证

    • API 密钥认证(自定义标头)

使用示例

安装和配置完成后,您可以通过 Cline 使用 REST API 测试器来测试您的 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": "john@example.com"
  }
});

// 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"
  }
});

发展

  1. 克隆存储库:

git clone https://github.com/zenturacp/mcp-rest-api.git
cd mcp-rest-api
  1. 安装依赖项:

npm install
  1. 构建项目:

npm run build

对于使用自动重建的开发:

npm run watch

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dkmaker/mcp-rest-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server