Skip to main content
Glama

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 です。

サーバー制御

ポートの変更

コマンドラインでパラメータ--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 には、 servertoolsの 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 ヘッダーは次のように定義されます。

アイテム説明
ヘッダーキー
価値ヘッダー値テンプレート

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

アイテム説明
レスポンス本文テンプレート

貢献

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

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

モデル コンテキスト プロトコル (MCP) ツール呼び出しを従来の HTTP API 要求に変換するサーバー。これにより、構成可能なマッピングを通じて既存の HTTP API を MCP 領域に統合できるようになります。

  1. はじめる
    1. サーバー制御
      1. ポートの変更
      2. stdioトランスポート
    2. 設定ファイル
      1. サーバ
      2. ツール
    3. 貢献

      Related MCP Servers

      • -
        security
        A
        license
        -
        quality
        MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
        Last updated -
        4
        3
        TypeScript
        MIT License
      • -
        security
        A
        license
        -
        quality
        MCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.
        Last updated -
        13
        2
        TypeScript
        MIT License
      • -
        security
        A
        license
        -
        quality
        An MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.
        Last updated -
        2
        Python
        MIT License
      • -
        security
        A
        license
        -
        quality
        A Model Context Protocol (MCP) server that enables Claude or other LLMs to fetch content from URLs, supporting HTML, JSON, text, and images with configurable request parameters.
        Last updated -
        Python
        MIT License

      View all related MCP servers

      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/Timandes/mcp-gateway'

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