mcpField
M
MCP REST API Tester

MCP REST API Tester

ローカル
github.com/dkmaker開発ツール10342 週間前に更新

MCP REST API Tester について

MCP REST API Tester は、TypeScript で実装された MCP サーバーで、Cline や Claude などのクライアントから REST API エンドポイントをテストおよびデバッグできます。開発環境から直接リクエストを送信したい開発者向けです。

主な機能

  1. 01GET、POST、PUT、DELETE、PATCH リクエストに対応
  2. 02ステータス、ヘッダー、ボディの詳細を返却
  3. 03HEADER_* 環境変数によるグローバルヘッダー設定
  4. 04Basic、Bearer Token、API Key 認証に対応
  5. 05レスポンスサイズの上限と切り詰め情報
  6. 06SSL 証明書検証の設定が可能

活用シーン

  1. 01開発中の特定の API エンドポイントのテスト
  2. 02ステータスコードとレスポンス内容のデバッグ
  3. 03Cline のカスタム指示と組み合わせた API 検証

MCP 対応

本プロジェクトは MCP サーバーであり、test_request ツールを通じて REST リクエスト機能を MCP クライアントに公開します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

mcp.json · 共通設定
{
"mcpServers": {
"rest-api": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
起動コマンドnpx -y @smithery/cli

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
npm@smithery/cli

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

MCP REST API Tester

License: MIT NPM Package

Claude、Cline、その他の MCP クライアントを通じて REST API をテストできる、TypeScript ベースの MCP サーバーです。このツールを使用すると、開発環境から REST API の任意のエンドポイントを直接テストし、操作できます。

README の画像

インストール

パッケージをグローバルにインストールします:

npm install -g dkmaker-mcp-rest-api

設定

Cline のカスタム指示

Cline がこのツールを効果的に使用できるように、Cline のカスタム指示(Settings > Custom Instructions)に以下を追加してください:

# 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, PATCH 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 実装で動作するはずです。お使いのオペレーティングシステムに合わせて設定してください:

Windows

⚠️ 重要:Windows のパス解決に関する既知の問題(issue #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つだけです:

  1. Basic 認証(ユーザー名/パスワード)
  2. Bearer Token(Basic 認証が設定されていない場合)
  3. API Key(Basic 認証も Bearer Token も設定されていない場合)

機能

  • さまざまな HTTP メソッドで REST API エンドポイントをテスト

  • GET、POST、PUT、DELETE、PATCH リクエストに対応

  • ステータス、ヘッダー、本文を含む詳細なレスポンス情報

  • カスタムヘッダー:

    • HEADER_* 環境変数によるグローバルヘッダー
    • 大文字と小文字を区別しないプレフィックス(HEADER_、header_、HeAdEr_)
    • ヘッダー名の大文字・小文字を保持
    • 優先順位に基づく適用(リクエストごと > 認証 > カスタム)
  • POST/PUT メソッドのリクエスト本文の処理

  • レスポンスサイズの管理:

    • レスポンスサイズを自動的に制限(デフォルト:10KB/10000バイト)
    • REST_RESPONSE_SIZE_LIMIT 環境変数でサイズ制限を設定可能
    • レスポンスが制限を超えた場合に、切り詰めたことを示すメタデータを表示
    • 本文の内容のみを切り詰め、レスポンス構造を保持
  • SSL 証明書の検証:

    • セキュアに動作するよう、デフォルトで有効
    • 自己署名証明書または開発環境では無効化可能
    • REST_ENABLE_SSL_VERIFY 環境変数で制御
  • 複数の認証方式:

    • Basic 認証(ユーザー名/パスワード)
    • Bearer Token 認証
    • API Key 認証(カスタムヘッダー)

使用例

インストールと設定が完了したら、Cline を通じて REST API Tester を使用し、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"
  }
});

開発

  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 ファイルをご覧ください。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。