models-mcp
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エンドポイントとして
ツール
ツール | 機能 |
| すべてのプロバイダー(anthropic、openai、google、...)をモデル数とともに一覧表示します |
| 名前、プロバイダー、最小コンテキストウィンドウ、最大入力コスト、または機能フラグ(reasoning、tool_call、attachment)でモデルをフィルタリングします |
|
|
| 2〜6個のモデルを価格、コンテキスト、機能について横並びで比較します |
| 1時間のキャッシュをバイパスして再取得を強制します |
Related MCP server: TokenLab Model Explorer
インストール
npm install
npm run buildstdioでスタンドアロン実行(テスト用)
npm startstdio上でMCPを話すため、直接はあまり表示されません。MCP Inspector を使用して操作してください:
npx @modelcontextprotocol/inspector node dist/index.jsCloudflare 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 toolscompare_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
Scored across 8 tools
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.
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.
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.
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
Live registry of AI model specs, context windows, and per-token pricing.
Compare LLM API prices, search models and providers, and access reviewed benchmark results.
Look up, compare and track AI model API prices from an AI assistant. No sign-in needed.
Search curated open-weight AI model releases, licenses, architectures, and primary sources.
Related MCP Servers
- FlicenseAqualityDmaintenanceProvides up-to-date AI model names and pricing from models.dev, solving model hallucination by fetching recently released models.1-
- AlicenseNot gradedqualityCmaintenanceEnables browsing TokenLab models, comparing pricing, and generating cURL examples for various AI endpoints.MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables 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 npmMIT