Skip to main content
Glama
ayatec

AI Gateway MCP Server

by ayatec

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

-

最大出力トークン数(省略時はモデル任せ)

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

パラメータ

必須

デフォルト

説明

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

Related MCP server: Multi-Search MCP Server

サポートモデル

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

Available Tools

4 tools
askA

Ask a single AI model a question (no web search, cannot retrieve latest/real-time information). Default: openai/gpt-5.4 (flagship, $2.50/$15, 1.05M ctx). For multiple perspectives on a question, prefer research tool with mode:ask synthesize:false. For code: openai/gpt-5.3-codex. For mid-tier: openai/gpt-5.4-mini ($0.75/$4.50, strong reasoning). For cheaper: openai/gpt-5-mini ($0.25/$2) or google/gemini-3.1-flash-lite-preview ($0.25/$1.50). For cheap with coding: openai/gpt-5.4-nano ($0.20/$1.25). For cheapest: openai/gpt-5-nano ($0.05/$0.40).

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNoModel in provider/name format, e.g. 'openai/gpt-5.2-codex', 'anthropic/claude-sonnet-4.6'openai/gpt-5.4
contextNoAdditional context, e.g. code snippets, error messages, or background info
questionYesThe question to ask, e.g. 'Explain Rust lifetimes' or 'Compare REST vs GraphQL'
max_tokensNoMax output tokens. If set, output is hard-truncated at this limit (may cut off mid-response). Omit to let the model decide output length naturally. Only set when you need strict cost control. Reasoning models use tokens internally, so set 2x-3x higher than expected visible output

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries full burden. It discloses the no-web-search limitation, inability to retrieve latest/real-time info, and default model context. It also adds transparency about model pricing and trade-offs. Missing details like rate limits or output format, but the key limitations are covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, then uses compact, structured lists for model tiers. It is a bit long due to multiple pricing/use-case entries, but each item is actionable and the colon-separated format makes it scannable. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters and no output schema, the description covers purpose, limitations, and model selection thoroughly. It doesn't explain return values or error handling, but for an ask tool this is less critical. Auth/rate limits are not mentioned, but the context is sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with good descriptions of all parameters. The description goes beyond the schema by enriching the 'model' parameter with concrete model names, pricing, and suitability (e.g., gpt-5.3-codex for code, nano for cheapest). This adds substantial value for model selection.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Ask a single AI model a question' – a specific verb and resource. It explicitly states the scope (single model, no web search, no real-time info) and distinguishes from the research tool by directing multi-perspective questions elsewhere.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use vs alternatives: 'For multiple perspectives on a question, prefer research tool with mode:ask synthesize:false.' It also maps model choices to use cases (code, mid-tier, cheaper, cheapest), giving clear guidance on when to select each.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_modelsA

List available AI models with capabilities, pricing, and web search costs. Use this to choose the right model for your task.

ParametersJSON Schema
NameRequiredDescriptionDefault
providerNoFilter by provider
capabilityNoFilter by capability

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. 'List' clearly implies a read-only operation, and it discloses the specific information returned (capabilities, pricing, web search costs). It doesn't hide side effects because none are expected for a listing tool, and the description gives sufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the action and content, then a clear usage directive. Every word contributes value with zero redundancy. This is an exemplar of concise, structured writing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity tool with optional filters and no output schema, the description is complete. It names the output fields (capabilities, pricing, web search costs) and the usage context. It doesn't elaborate on filtering, but the schema covers that, and the description doesn't need to explain return structure beyond what it lists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions capabilities and pricing which aligns with the capability filter, but it doesn't explicitly explain the provider or capability parameters. Since the schema has 100% coverage with descriptive parameter descriptions, the baseline of 3 is appropriate; the description adds no additional parameter meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('List') and resource ('available AI models'), and specifies the content (capabilities, pricing, web search costs). It distinguishes itself from sibling tools like ask/search/research by being about model selection rather than executing tasks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance: 'Use this to choose the right model for your task.' This establishes when to use the tool, though it doesn't explicitly mention alternatives or when not to use it. The context is clear enough for an agent to know this is the model-discovery step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

researchA

Multi-model parallel research. Queries 2-4 AI models simultaneously, then optionally synthesizes results. Use instead of search when: (1) you need higher confidence via cross-validation across sources, (2) you want diverse perspectives on a topic. mode:search (default): web research with grounding across 3 models (sonar, gemini-3-flash, gpt-5.4-nano). mode:ask: multi-model Q&A without web search — for architecture decisions, trade-off analysis, diverse expert opinions (uses gpt-5.4, claude-opus-4.6, gemini-3.1-pro-preview, sonar-reasoning-pro). synthesize:true (default): merges all responses into one comprehensive answer. synthesize:false: shows each model side-by-side with latency and cost — useful for comparing perspectives or when you want raw answers. Query tip: prefer English for technical topics, one focused topic per query. NEVER include specific years in queries — use "latest"/"current"/"newest" instead. Same best practices as the search tool apply.

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNosearch: web research with grounding (default). ask: multi-model Q&A without web search, ideal for getting diverse perspectives on a questionsearch
queryYesResearch query with detailed context. Prefer English for technical topics (official docs are mostly English). Use Japanese when searching for Japan-specific services or local information. Include specific technical terms (version numbers, API names) for best accuracy. IMPORTANT: Never include specific years (e.g. "2024", "2025") in queries — use "latest", "current", or "newest" instead. Year numbers become outdated quickly and may miss newer results.
modelsNo2-4 models to query in parallel. Defaults depend on mode — search: [perplexity/sonar, gemini-3-flash, gpt-5.4-nano] (cost-effective, 3 providers). ask: [gpt-5.4, claude-opus-4.6, gemini-3.1-pro-preview, sonar-reasoning-pro] (high-capability reasoning models from 4 providers)
max_tokensNoMax output tokens per model in query phase. If set, output is hard-truncated at this limit (may cut off mid-response). Omit to let models decide output length naturally. Only set when you need strict cost control. Reasoning models use tokens internally, so set 2x-3x higher than expected visible output
synthesizeNotrue: synthesize into one comprehensive answer. false: show each model's response side by side with cost and latency
include_sourcesNoInclude source URLs in the response. When true, appends source links from search results. Only effective in search mode
synthesis_modelNoModel for synthesis (only when synthesize:true), e.g. 'anthropic/claude-opus-4.6'. Default: openai/gpt-5.4
synthesis_max_tokensNoMax output tokens for synthesis. Omit to let the model decide naturally. Only set when you need strict cost control

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full burden of behavioral disclosure. It reveals that the tool queries 2-4 models in parallel, that synthesize:false shows side-by-side responses with latency and cost, and that search mode includes grounding. It does not mention potential rate limits or failure modes, but for a research tool the disclosed traits are substantial and non-contradictory.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and then systematically covers usage guidance, modes, synthesize behavior, and query tips. While longer than the minimal two-sentence example, every sentence contributes meaningful information and the use of lists and colons keeps it scannable and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, no annotations, and no output schema, the description is comprehensive: it explains modes, parameter defaults, behavioral differences (synthesize), query best practices, and cross-references the sibling search tool. It does not detail the exact response structure, but it states that synthesize:true produces 'one comprehensive answer' and synthesize:false shows responses 'side-by-side with latency and cost,' providing sufficient context for a research tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing a baseline of 3. The description adds value by explaining the semantic difference between modes (e.g., 'mode:search (default): web research with grounding' vs 'mode:ask: multi-model Q&A without web search') and the effect of synthesize (true: merge into one comprehensive answer; false: side-by-side with cost/latency), which enriches the schema's enum and boolean descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Multi-model parallel research. Queries 2-4 AI models simultaneously, then optionally synthesizes results,' which clearly states the tool's specific action and scope. It also explicitly distinguishes itself from the sibling 'search' tool by stating 'Use instead of search when...' making the purpose and differentiation unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance on when to use this tool over alternatives: 'Use instead of search when: (1) you need higher confidence via cross-validation across sources, (2) you want diverse perspectives on a topic.' It further breaks down mode-specific use cases (e.g., 'mode:ask: multi-model Q&A without web search — for architecture decisions, trade-off analysis'), giving clear context and alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.10.1
    • First observedask
    • First observedlist_models
    • First observedresearch
    • First observedsearch

TDQS

A4.4/5.0

Scored across 4 tools

Disambiguation4/5

There is some overlap between search and research (mode:search) and between ask and research (mode:ask), but the descriptions clearly explain the differences (single vs. multi-model, with or without web search). The primary purposes are distinct enough that an agent can reliably select the right tool.

Naming Consistency5/5

All tool names are lowercase imperative verbs (list_models, ask, search, research), with 'list_models' being the only verb_noun combo. There are no mixed styles like camelCase or inconsistent verb forms, making the naming pattern predictable and clear.

Tool Count5/5

With only four tools, the set is tightly scoped for an AI gateway: listing models, single-query ask, single-query search, and multi-model research. Each tool earns its place and there is no bloat or unnecessary overlap for the stated purpose.

Completeness4/5

The main operations for an AI gateway are covered—listing models, asking without search, searching with web access, and multi-model research. Minor gaps like streaming responses or detailed model comparison are absent, but they are not essential for typical AI query workflows, so agents can work around them.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Provides access to 400+ AI models from OpenRouter, enabling users to chat with models like GPT-4, Claude, Gemini, and Llama, compare responses across multiple models, and retrieve model information with pricing details.
    4
    18 npm
    13
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    A local AI gateway that connects multiple AI providers (ChatGPT, Claude, Gemini, Perplexity) to your development environment via MCP tools, enabling coding, search, analysis, and more without API keys.
    17 npm
    1,171
    -