GA

gomcpgo/api-wrapper-mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

20 stars 11 forks 品質 48 トレンド 0

任意の API で MCP サーバーを作成する

概要

これは、モデルコンテキストプロトコル(MCP)の汎用APIラッパーサーバーです。 REST API を Claude や他の MCP クライアントからアクセスできる MCP ツールとして簡単にラップできます。 - 複数の API エンドポイントの簡単な YAML 設定 - GET と POST の両方のリクエストのサポート - パラメーターの検証とデフォルト値 - 環境変数による認証 - API 呼び出しのカスタムタイムアウト 1. API エンドポイントを定義する YAML 設定ファイルを作成する (例-config.yaml 参照) 2。 必要な API トークンを環境変数 3 に設定します。 設定ファイルでサーバーを実行します。 設定ファイルは、以下の構造で YAML 形式を使用します。 Claude Desktop を使用するには、 claude desktop config.json に以下を追加します。 サンプル API 設定の example-config.yaml をチェックします。 - auth.token env varフィールドで指定された環境変数を使用してメイン認証トークンを設定します.

概要(AI 翻訳)

これは、モデルコンテキストプロトコル(MCP)の汎用APIラッパーサーバーです。 REST API を Claude や他の MCP クライアントからアクセスできる MCP ツールとして簡単にラップできます。

##特徴

  • 複数の API エンドポイントの容易な YAML 構成
  • GETとPOSTリクエストの両方のサポート
  • パラメータ検証とデフォルト値
  • 環境変数による認証
  • APIコールのカスタムタイムアウト

使用法

  1. API エンドポイントを定義する YAML 設定ファイルを作成する (example-config.yaml を参照)
  2. 必要な API トークンを環境変数として設定する
  3. 設定ファイルでサーバーを実行します。

設定形式

設定ファイルは、以下の構造で YAML 形式を使用します。

#Claudeデスクトップの統合

Claude Desktopを使用するには、以下をclaude_desktop_config.jsonに追加します。

例

サンプル API の設定で [example-config.yaml をチェックします。

環境変数

  • [[auth.token_env_var]フィールドで指定された環境変数を使用してメイン認証トークンを設定します。
  • [{{env:VARIABLE_NAME}} 構文を使用してテンプレート内の他の環境変数を参照することもできます.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

API Wrapper MCP Server

This is a generic API wrapper server for the Model Context Protocol (MCP). It allows you to easily wrap REST APIs as MCP tools that can be accessed by Claude and other MCP clients.

Features

  • Easy YAML configuration for multiple API endpoints
  • Support for both GET and POST requests
  • Parameter validation and default values
  • Authentication via environment variables
  • Custom timeouts for API calls

Usage

  1. Create a YAML configuration file defining your API endpoints (see example-config.yaml)
  2. Set any required API tokens as environment variables
  3. Run the server with your config file:
# Build the server
go build -o api_wrapper

# Run with your config
./api_wrapper my-apis.yaml

Configuration Format

The configuration file uses YAML format with the following structure:

# Server info
server:
  name: "API Gateway MCP"
  description: "Generic API gateway that wraps REST APIs as MCP tools"
  version: "1.0.0"
  
# Authentication
auth:
  token_env_var: "API_GATEWAY_TOKEN"  # Environment variable for the API token

# Tool definitions
tools:
  - name: "tool-name"
    description: "Tool description"
    endpoint: "https://api.example.com/endpoint"
    method: "POST"  # or "GET"
    timeout: 30  # in seconds
    template: |
      {
        "param1": "{{variable1}}",
        "param2": {{variable2}}
      }
    # For GET requests, use query_params
    query_params:
      param1: "{{variable1}}"
      param2: "{{variable2}}"
    parameters:
      variable1:
        type: "string"
        description: "Description of variable1"
        required: true
      variable2:
        type: "number"
        description: "Description of variable2"
        default: 10

Claude Desktop Integration

To use with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "api-wrapper": {
      "command": "path/to/api_wrapper",
      "args": ["path/to/your-config.yaml"],
      "env": {
        "API_GATEWAY_TOKEN": "your-api-token"
      }
    }
  }
}

Examples

Check out example-config.yaml for sample API configurations.

Environment Variables

  • Set the main authentication token using the environment variable specified in the auth.token_env_var field.
  • You can also reference other environment variables in your templates using {{env:VARIABLE_NAME}} syntax.
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "api-wrapper": { "command": "path/to/api_wrapper", "args": ["path/to/your-config.yaml"], "env": { "API_GATEWAY_TOKEN": "your-api-token" } } } }