Skip to main content
Glama

Models MCP

AIモデルの価格、コンテキストウィンドウ、機能による検索・比較・調査を行います。models.dev カタログ(models.dev/api.json)を基盤とするMCPサーバーで、エージェントが手動でリストを管理することなく、常に最新のモデルデータを利用できます。

models.dev自体はMCPサーバーを提供しておらず、JSON APIと読み取り用のTypeScript SDKのみを提供しています。このツールがそのギャップを埋めます。

同じツールコードから2つの方法で動作します:

  • stdio(src/index.ts)— ローカルMCPクライアント用

  • Cloudflare Worker(src/worker.ts)— /mcp におけるリモートのStreamable HTTPエンドポイントとして

ツール

ツール

機能

list_providers

すべてのプロバイダー(anthropic、openai、google、...)をモデル数とともに一覧表示します

find_models

名前、プロバイダー、最小コンテキストウィンドウ、最大入力コスト、または機能フラグ(reasoning、tool_call、attachment)でモデルをフィルタリングします

get_model

provider/model IDによる1つのモデルの完全なメタデータを取得します

compare_models

2〜6個のモデルを価格、コンテキスト、機能について横並びで比較します

refresh_catalog

1時間のキャッシュをバイパスして再取得を強制します

Related MCP server: TokenLab Model Explorer

インストール

npm install
npm run build

stdioでスタンドアロン実行(テスト用)

npm start

stdio上でMCPを話すため、直接はあまり表示されません。MCP Inspector を使用して操作してください:

npx @modelcontextprotocol/inspector node dist/index.js

Cloudflare Workersでのホスティング

Workerエントリ(src/worker.ts)は、同じツールを /mcp のStreamable HTTPで提供し、以下の機能を備えています:

  • カタログキャッシュ — Workers Cache API(caches.default)に1時間のTTLで保存され、リクエストとアイソレート間で共有されます。

  • IPごとのレート制限 — Workersレート制限バインディングによるIPごとの制限:IPあたり毎分60リクエスト、Cloudflareのロケーションごとに適用されます。超過リクエストには Retry-After: 60 付きの 429 が返されます。

# local dev at http://localhost:8787/mcp
npm run dev:worker

# deploy
npm run deploy

デプロイ後、エンドポイントは https://models-mcp.<your-subdomain>.workers.dev/mcp になります。

MCPクライアントをそこに向けます:

Claude Code:

claude mcp add --transport http models-mcp https://models-mcp.<your-subdomain>.workers.dev/mcp

汎用クライアント設定(Streamable HTTPを話すもの):

{
  "mcpServers": {
    "models-mcp": {
      "url": "https://models-mcp.<your-subdomain>.workers.dev/mcp"
    }
  }
}

stdio専用クライアント(Claude Desktop)の場合は、mcp-remote でブリッジします:

{
  "mcpServers": {
    "models-mcp": {
      "command": "npx",
      "args": ["mcp-remote", "https://models-mcp.<your-subdomain>.workers.dev/mcp"]
    }
  }
}

どこでもAPIキーは不要です。すべてのデータは公開の models.dev/api.json エンドポイントから取得されます。

テスト

npm test

カタログクライアント(フラット化、TTLキャッシュ、強制リフレッシュ、失敗時の古いデータへのフォールバック、ID解決)と、5つのツールすべてを、インメモリトランスポート上の実際のMCPクライアントセッションを通じてエンドツーエンドでカバーします。

データに関する注意事項

  • カタログは1時間キャッシュされます:ホスト時はWorkers Cache API、stdioではプロセスメモリ内です。refresh_catalog を呼び出すと強制的に更新されます。再取得に失敗した場合、最後に正常に取得されたカタログが提供され続けます。

  • models.devはコンシューマー向けのバージョン管理されたスキーマを公開していないため、src/types.ts の型は意図的に緩めになっています(インデックスシグネチャが明示的に型付けされていないフィールドを保持します)。

  • モデルIDはAI SDKとOpenCodeで使用される provider/model の規則に従います。例:anthropic/claude-sonnet-4-5。get_model と compare_models は、プロバイダー間で曖昧でない場合、モデルIDのみの指定も受け付けます。

考えられる拡張機能

  • 他のモデルカタログMCPが公開しているような list_facets ツール(モダリティ、トークナイザー)。

  • 設定済みのプロバイダーキーを通じてライブ呼び出しを行い、レイテンシー/コストの健全性チェックを行う test_model ツール。

  • Workerの前面にOAuthまたはCloudflare Accessを配置して、プライベートにしたい場合。

Available Tools

8 tools
compare_modelsCompare modelsA

Diff 2-6 models side by side on pricing, context window, and capabilities. Accepts 'provider/model' ids, or bare model ids when unambiguous across providers. Ids resolving to the same model are compared once.

Inputs: ids (required).

estimate_costEstimate costA

Estimate the USD cost of a request to one model from its published per-million-token rates. Use get_model first if you need to pick an id.

Inputs: id (required), inputTokens, outputTokens, cacheReadTokens, +1 more.

find_modelsFind modelsA

Search and filter models across all providers by name, provider, capability, context window, or price. Returns a compact summary per model; use get_model for full details on one.

Inputs: limit, query, provider, minContext, +4 more.

get_modelGet modelA

Fetch full metadata for one model. Accepts 'provider/model' (preferred, e.g. 'anthropic/claude-sonnet-4-5') or a bare model id if unambiguous across providers.

Inputs: id (required).

get_providerGet providerA

Fetch metadata for one provider: display name, AI SDK package name, API base URL, docs link, and a compact list of its models. Accepts the provider id ('anthropic') or display name ('Anthropic'). Use get_model for full per-model detail.

Inputs: id (required).

list_providersList providersA

List every provider in the models.dev catalog (e.g. anthropic, openai, google) with its model count. Use this to see what's available before narrowing with find_models.

Inputs: no named parameters.

refresh_catalogRefresh catalogA

Force a fresh fetch of the models.dev catalog, bypassing the in-memory cache. Use if you suspect the data is stale. If the refetch fails, the last good catalog keeps being served and servedStale is reported as true.

Inputs: no named parameters.

top_modelsTop modelsA

Rank models by one criterion: cheapest input/output price per million tokens, largest context window, most context per input dollar, or newest release. Supports the same filters as find_models.

Inputs: sortBy (required), limit, query, provider, +5 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct operation: listing providers, searching models, fetching details, comparing, refreshing, estimating cost, ranking, and provider metadata. Even where two tools support similar filters, their purposes are clearly differentiated by descriptions.

    Naming Consistency4/5

    Tool names mostly follow a clear verb_noun pattern such as list_providers, find_models, get_model, and estimate_cost. The exception is top_models, which reads more like a noun phrase than an imperative verb action, a minor deviation from the otherwise consistent convention.

    Tool Count5/5

    Eight tools is a well-scoped size for a model catalog server. Each tool covers a meaningful workflow without redundancy or bloat, from discovery and search to comparison and cost estimation.

    Completeness5/5

    The surface covers the full read-only lifecycle of interacting with the models.dev catalog: list, search, detail, compare, rank, and cost estimation, plus provider-level metadata and cache refresh. No obvious dead ends or missing core operations are present.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to browse, inspect, and compare LLMs from OpenRouter's catalog with normalized per-million-token pricing, context windows, and modalities. Supports filtering by search, free-only status, minimum context, or modality.
      316 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables checking OpenAI, Claude, Gemini and other LLM model IDs against a live catalog to identify deprecated or unknown names and suggest newer replacements. Also lets users search current models by provider, price, context size or tool support, and scan files or folders for outdated IDs.
      72 npm
      MIT