AI Gateway MCP Server

AI Gateway MCP Server

Provides unified access to multiple AI providers through Vercel AI Gateway, enabling question answering, web search, multi-model research, and model listing.

Category
Visit Server

README

AI Gateway MCP Server

npm version CI License: MIT

Vercel AI Gateway を通じて複数の AI プロバイダー・モデルに統一的にアクセスできる MCP サーバー。 Web 検索、マルチモデル調査・比較など、LLM を活用した 4 つのツールを提供します。

提供ツール

ask -- AI に質問

任意のモデルに質問を送り、回答を得ます。

パラメータ 必須 デフォルト 説明
question string Yes - 質問内容
model string No openai/gpt-5.4 モデル ID
context string No - 追加コンテキスト
max_tokens number No - 最大出力トークン数(省略時はモデル任せ)

search -- Web 検索

検索対応モデルを使って最新情報を取得します。

パラメータ 必須 デフォルト 説明
query string Yes - 検索クエリ
model string No google/gemini-3-flash 検索対応モデル ID
max_tokens number No - 最大出力トークン数(省略時はモデル任せ)

research -- マルチモデル調査・比較

複数モデルに並列クエリし、結果を統合または比較表示します。

パラメータ 必須 デフォルト 説明
query string Yes - 調査クエリ
mode string No search search(Web 検索)または ask(Q&A)
models string[] No mode に応じた 4 モデル 2~4 モデル ID の配列
synthesize boolean No true true: 統合回答、false: 各モデルの回答を並列表示
synthesis_model string No openai/gpt-5.4 統合に使うモデル(synthesize:true 時のみ)
max_tokens number No - 各モデルの最大出力トークン数(省略時はモデル任せ)
synthesis_max_tokens number No - 統合の最大出力トークン数(省略時はモデル任せ)

処理フロー:

  1. Query Stage: 指定(またはデフォルト)モデルに並列リクエスト
    • search デフォルト: perplexity/sonar, gemini-3-flash, gpt-5-mini
    • ask デフォルト: gpt-5.4, claude-opus-4.6, gemini-3.1-pro-preview, sonar-reasoning-pro
  2. Synthesis Stage (synthesize:true): openai/gpt-5.4 が全結果を精査・統合し、矛盾点を指摘、ソースを明記
  3. Comparison (synthesize:false): 各モデルの回答をコスト・レイテンシ付きで並列表示

list_models -- モデル一覧

利用可能なモデルの情報(価格・能力・検索コスト)を表示します。

パラメータ 必須 説明
provider string No プロバイダーでフィルタ(openai, anthropic, google, perplexity
capability string No 能力でフィルタ(search, reasoning, fast, cheap, code

サポートモデル

OpenAI

モデル ID 入力 出力 検索 特徴
openai/gpt-5.4 $2.50 $15.00 Yes OpenAI 最上位。推論・コード・エージェント性能が 5.2 から大幅向上、1.05M コンテキスト、キャッシュ割引 90%
openai/gpt-5.4-mini $0.75 $4.50 Yes GPT-5 Mini の上位版。推論・コーディング・ビジョンが大幅向上、400K コンテキスト
openai/gpt-5.4-nano $0.20 $1.25 Yes GPT-5 Nano の上位版。Web 検索対応で GPT-5 Mini より安い、コーディングも向上
openai/gpt-5.3-codex $1.75 $14.00 Yes エージェント型コード特化版。5.2-codex から 25% 高速化、mid-task steering 対応、Terminal-Bench 最高水準
openai/gpt-5-mini $0.25 $2.00 Yes 低コスト汎用モデル。コーディングに特に強く、推論・検索も対応する万能型
openai/gpt-5-nano $0.05 $0.40 No 最安モデル。シンプルな生成・分類向けで推論・検索は非対応
openai/gpt-oss-120b $0.10 $0.50 No OpenAI 公開の OSS モデル。低コストで推論・コード対応、検索非対応

Anthropic

モデル ID 入力 出力 検索 特徴
anthropic/claude-opus-4.6 $5.00 $25.00 Yes Anthropic 最上位。SWE-bench 最強クラスでコーディング精度が突出、1M コンテキスト
anthropic/claude-sonnet-4.6 $3.00 $15.00 Yes Opus の約 1/2 コストで高品質。エージェント用途やコスパ重視の汎用タスク向け、1M コンテキスト
anthropic/claude-haiku-4.5 $1.00 $5.00 Yes Anthropic 軽量モデル。低レイテンシで検索・コード対応、高速処理向け

Google

モデル ID 入力 出力 検索 特徴
google/gemini-3-flash $0.50 $3.00 Yes Google Search grounding 対応で検索精度が高い。コーディングも強く、search デフォルト、1M コンテキスト
google/gemini-3.1-flash-lite-preview $0.25 $1.50 No 最速クラスのスループット。低コストで推論・知識に強いが検索非対応、preview 版
google/gemini-3.1-pro-preview $2.00 $12.00 Yes Google 最上位。科学推論・マルチモーダルに強く、Gemini 3 Pro の後継、1M コンテキスト

Perplexity

モデル ID 入力 出力 検索 特徴
perplexity/sonar $1.00 $1.00 Yes 検索特化で最安。単発の事実確認やニュース検索に最適、低レイテンシ
perplexity/sonar-pro $3.00 $15.00 Yes 高精度検索。最大 5 回の内部検索で深掘りでき、技術ドキュメントの詳細調査向け
perplexity/sonar-reasoning-pro $2.00 $8.00 Yes 推論+検索のハイブリッド。根拠付きの分析が必要な複雑な調査向け

価格は 1M トークンあたり(USD)

セットアップ

1. 環境変数

Vercel AI Gateway の API キーを取得し、設定します。

変数名 必須 説明
AI_GATEWAY_API_KEY Yes Vercel AI Gateway API キー
ZERO_DATA_RETENTION No true で Gateway レベルの ZDR を有効化

プライバシー・データ保持

各プロバイダーへのリクエストに、プライバシー保護のための設定を自動付与します。

プロバイダー 対応
OpenAI store: false を全リクエストに付与(データ保存無効)
Anthropic API 経由はデフォルトで学習不使用
Google 有料 API はデフォルトで学習不使用
Perplexity API はデフォルトで Zero Data Retention

ZERO_DATA_RETENTION=true を設定すると、Vercel AI Gateway レベルの ZDR が有効になり、ZDR 契約済みプロバイダーにのみリクエストがルーティングされます。Perplexity は自前で ZDR を保証しているため Gateway ZDR の適用対象外です。

2. MCP 設定

npx で使う場合(推奨)

Claude Code
claude mcp add ai-gateway npx @ayatec/ai-gateway-mcp-server -e AI_GATEWAY_API_KEY=your-key
Claude Desktop / その他の MCP クライアント
{
  "mcpServers": {
    "ai-gateway": {
      "command": "npx",
      "args": ["@ayatec/ai-gateway-mcp-server"],
      "env": {
        "AI_GATEWAY_API_KEY": "your-key"
      }
    }
  }
}

ローカルビルドで使う場合

開発中のバージョンを使いたい場合や、ソースを修正して使いたい場合はこちら。

git clone https://github.com/ayatec/ai-gateway-mcp-server.git
cd ai-gateway-mcp-server
cp .env.example .env
# .env を編集して API キーを設定
pnpm install
pnpm build
Claude Code
claude mcp add ai-gateway node /path/to/ai-gateway-mcp-server/dist/index.js -e AI_GATEWAY_API_KEY=your-key
Claude Desktop / その他の MCP クライアント
{
  "mcpServers": {
    "ai-gateway": {
      "command": "node",
      "args": ["/path/to/ai-gateway-mcp-server/dist/index.js"],
      "env": {
        "AI_GATEWAY_API_KEY": "your-key"
      }
    }
  }
}

開発

コマンド

pnpm install        # 依存パッケージインストール
pnpm build          # ビルド
pnpm dev            # ウォッチモードでビルド
pnpm start          # サーバー起動(ビルド後)
pnpm dev:tool       # ツールの手動テスト
pnpm test           # テスト実行
pnpm test:watch     # テスト(ウォッチモード)
pnpm type-check     # 型チェック
pnpm lint           # ESLint実行
pnpm lint:fix       # ESLint自動修正
pnpm format         # Prettier実行
pnpm format:check   # フォーマットチェック

ローカルテスト

pnpm dev:tool で各ツールを個別にテストできます。

# ask(デフォルト: gpt-5.4)
pnpm dev:tool ask --question "TypeScriptの利点は?"

# ask(モデル指定)
pnpm dev:tool ask --question "Rustとは?" --model "anthropic/claude-sonnet-4.6"

# search(デフォルト: google/gemini-3-flash)
pnpm dev:tool search --query "Vercel AI SDK 最新情報"

# research(4モデル並列検索→統合、デフォルト)
pnpm dev:tool research --query "WebAssemblyの現状と将来"

# research(askモード、比較表示)
pnpm dev:tool research --query "関数型プログラミングの利点" --mode ask --synthesize false

# research(モデル指定)
pnpm dev:tool research --query "latest TypeScript features" --models '["openai/gpt-5.4","perplexity/sonar"]'

# list_models
pnpm dev:tool list_models
pnpm dev:tool list_models --provider openai
pnpm dev:tool list_models --capability search

リリース

Changesets でバージョン管理しています。

  1. changeset ファイルを作成して main に push
  2. GitHub Actions が自動で CHANGELOG 更新・バージョンバンプ・npm publish

技術スタック

  • TypeScript (ESM, NodeNext, strict)
  • Vercel AI SDK -- gateway プロバイダーで全モデルに統一アクセス
  • MCP SDK -- Model Context Protocol サーバー実装
  • Zod -- スキーマバリデーション
  • Vitest -- テスト
  • Changesets -- バージョン管理・CHANGELOG 自動生成

ライセンス

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured