Skip to main content
Glama
Timandes

MCP Gateway

by Timandes

MCPゲートウェイ

MCP(モデルコンテキストプロトコル)ゲートウェイは、MCPツールの呼び出しを従来のHTTP APIリクエストに変換します。既存のHTTP APIをMCP領域に取り込むための設定可能な方法を提供します。

はじめる

config.example.yamlから設定ファイルを作成します。

$ cp config.example.yaml config.yaml

config.yamlファイルを編集し、すべての API を MCP ツールにマップします。

次に、SSE トランスポートを使用して起動します。

$ uv run mcp-gateway
INFO:     Started server process [15400]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3001 (Press CTRL+C to quit)

デフォルトは 3001 です。

Related MCP server: Hello Service MCP Server

サーバー制御

ポートの変更

コマンドラインでパラメータ--port=<port_no>を指定すると、ポートが SSE トランスポートに変更されます。

ポート 3002 でゲートウェイを起動します。

$ uv run mcp-gateway --port=3002
INFO:     Started server process [15400]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3002 (Press CTRL+C to quit)

stdioトランスポート

コマンドラインでパラメータ--transport=stdio指定すると、トランスポートが stdio に変更されます。

例えば:

$ uv run mcp-gateway --transport=stdio

stdioトランスポートでゲートウェイを手動で起動するのは意味がありません。CursorまたはClineで以下のように設定できます。

{
    "mcpServers": {
        "mcp-gateway": {
          "command": "uv",
          "args": ["run", "mcp-gateway", "--transport=stdio"]
        }
      }
}

またはフォーム値を持つ MCP インスペクター:

アイテム

価値

輸送タイプ

標準入出力

指示

紫外線

議論

mcp-gateway --transport=stdio を実行する

設定ファイル

構成 YAML には、 serverとtoolsの 2 つの部分があります。 server 、ゲートウェイ サーバーの使用に関する基本情報を定義します。 tools単一の MCP ツールから HTTP API 要求へのマッピングを定義します。

server:
  name: rest-amap-server
  config:
    apiKey: foo
tools:
- name: maps-geo
  description: "将详细的结构化地址转换为经纬度坐标。支持对地标性名胜景区、建筑物名称解析为经纬度坐标"
  args:
  - name: address
    description: "待解析的结构化地址信息"
    required: true
  - name: city
    description: "指定查询的城市"
    required: false
  requestTemplate:
    url: "https://restapi.amap.com/v3/geocode/geo?key={{.config.apiKey}}&address={{.args.address}}&city={{.args.city}}&source=ts_mcp"
    method: GET
    headers:
    - key: x-api-key
      value: "{{.config.apiKey}}"
    - key: Content-Type
      value: application/json
  responseTemplate:
    body: |
      # 地理编码信息
      {{- range $index, $geo := .Geocodes }}
      ## 地点 {{add $index 1}}

      - **国家**: {{ $geo.Country }}
      - **省份**: {{ $geo.Province }}
      - **城市**: {{ $geo.City }}
      - **城市代码**: {{ $geo.Citycode }}
      - **区/县**: {{ $geo.District }}
      - **街道**: {{ $geo.Street }}
      - **门牌号**: {{ $geo.Number }}
      - **行政编码**: {{ $geo.Adcode }}
      - **坐标**: {{ $geo.Location }}
      - **级别**: {{ $geo.Level }}
      {{- end }}

サーバ

アイテム

説明

名前

サーバー名

設定

テンプレート内のvar {{.config.xxx}}で参照できるキー/値のペア

ツール

tools MCPツールマッピングのリストです。個々のツールプロパティは以下のように定義されます。

アイテム

説明

名前

LLM に提供されるツール名 (関数名)。

説明

LLM がツールの機能を理解するために役立つツールの説明。

引数

ツールの引数(関数の引数)。

リクエストテンプレート

ターゲット HTTP API へのマッピングを要求します。

レスポンステンプレート

ターゲット HTTP API のレスポンスのレスポンス マッピング。

単一引数のプロパティは次のように定義されます。

アイテム

タイプ

説明

名前

LLM に提供される引数名。

説明

LLM が理解し、どの値を入力すべきかを決定するための引数の説明。

必須

ブール値

必須の引数かどうか。

リクエスト テンプレートのプロパティは次のように定義されます。

アイテム

説明

方法

HTTPメソッド

URL

ターゲットHTTP API URLテンプレート

ヘッダー

HTTPヘッダー

HTTP ヘッダーは次のように定義されます。

アイテム

説明

鍵

ヘッダーキー

価値

ヘッダー値テンプレート

レスポンス テンプレートのプロパティは次のように定義されます。

アイテム

説明

体

レスポンス本文テンプレート

貢献

あらゆる種類の貢献を歓迎します。

Related MCP Connectors

  • The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.

  • Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server

  • MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows

  • The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.
    8
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to make HTTP requests (GET, POST, PUT, DELETE) to external APIs through standardized MCP tools.
    4
    2
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A standalone proxy that transforms any OpenAPI or Swagger-described REST API into an MCP server by mapping API operations to executable MCP tools. It enables AI clients to interact with existing web services through automated HTTP requests based on their official documentation.
    12 npm
    16
    MIT