models-mcp
Models MCP
Durchsuche, vergleiche und prüfe KI-Modelle nach Preis, Kontextfenster und Fähigkeiten. Ein MCP-Server über den models.dev-Katalog (models.dev/api.json), damit dein Agent immer aktuelle Modelldaten hat, ohne dass du eine Liste manuell pflegst.
models.dev selbst liefert keinen MCP-Server, nur eine JSON-API und ein TypeScript-SDK zum Lesen. Das hier schließt diese Lücke.
Läuft auf zwei Arten aus demselben Tool-Code:
stdio (
src/index.ts) für lokale MCP-ClientsCloudflare Worker (
src/worker.ts) als Remote-Streamable-HTTP-Endpunkt unter/mcp
Tools
Tool | Was es tut |
| Listet jeden Anbieter (anthropic, openai, google, ...) mit Modellanzahlen auf |
| Filtert Modelle nach Name, Anbieter, minimalem Kontextfenster, maximalen Eingabekosten oder Fähigkeits-Flags (reasoning, tool_call, attachment) |
| Vollständige Metadaten für ein Modell, anhand der |
| Nebeneinander-Vergleich von 2-6 Modellen bei Preis, Kontext und Fähigkeiten |
| Erzwingt einen erneuten Abruf und umgeht den 1-Stunden-Cache |
Related MCP server: TokenLab Model Explorer
Installation
npm install
npm run buildEigenständig über stdio ausführen (zum Testen)
npm startEs spricht MCP über stdio, du wirst also nicht viel direkt sehen; nutze den MCP Inspector, um daran herumzutesten:
npx @modelcontextprotocol/inspector node dist/index.jsAuf Cloudflare Workers hosten
Der Worker-Einstiegspunkt (src/worker.ts) stellt dieselben Tools über Streamable HTTP unter /mcp bereit, mit:
Katalog-Caching in der Workers Cache API (
caches.default) mit einer 1-Stunden-TTL, geteilt über Anfragen und Isolate hinweg.Pro-IP-Ratenbegrenzung über ein Workers-Rate-Limiting-Binding: 60 Anfragen/Minute pro IP, durchgesetzt pro Cloudflare-Standort. Überzählige Anfragen erhalten
429mitRetry-After: 60.
# local dev at http://localhost:8787/mcp
npm run dev:worker
# deploy
npm run deployNach dem Deployment ist dein Endpunkt https://models-mcp.<your-subdomain>.workers.dev/mcp.
Richte MCP-Clients darauf aus:
Claude Code:
claude mcp add --transport http models-mcp https://models-mcp.<your-subdomain>.workers.dev/mcpGenerische Client-Konfiguration (alles, was Streamable HTTP spricht):
{
"mcpServers": {
"models-mcp": {
"url": "https://models-mcp.<your-subdomain>.workers.dev/mcp"
}
}
}Für reine stdio-Clients (Claude Desktop) überbrücke mit mcp-remote:
{
"mcpServers": {
"models-mcp": {
"command": "npx",
"args": ["mcp-remote", "https://models-mcp.<your-subdomain>.workers.dev/mcp"]
}
}
}Keinerlei API-Schlüssel erforderlich. Alle Daten stammen vom öffentlichen models.dev/api.json-Endpunkt.
Tests
npm testAbgedeckt werden der Katalog-Client (Flattening, TTL-Caching, erzwungenes Aktualisieren, Fallback auf veraltete Daten bei Fehlern, ID-Auflösung) und alle fünf Tools Ende-zu-Ende über eine echte MCP-Client-Sitzung über einen In-Memory-Transport.
Anmerkungen zu den Daten
Der Katalog wird 1 Stunde lang gecacht: in der Workers Cache API, wenn gehostet, im Prozessspeicher über stdio. Rufe
refresh_catalogauf, um ein Update zu erzwingen. Wenn ein erneuter Abruf fehlschlägt, wird weiterhin der letzte gute Katalog ausgeliefert.models.dev veröffentlicht kein versioniertes Schema für Konsumenten, daher sind die Typen in
src/types.tsbewusst locker gehalten (Index-Signaturen erhalten alle Felder, die nicht explizit typisiert sind).Modell-IDs folgen der
provider/model-Konvention, die von AI SDK und OpenCode verwendet wird, z. B.anthropic/claude-sonnet-4-5.get_modelundcompare_modelsakzeptieren auch eine nackte Modell-ID, wenn sie über Anbieter hinweg eindeutig ist.
Mögliche Erweiterungen
Ein
list_facets-Tool (Modalitäten, Tokenizer), ähnlich dem, was andere Modellkatalog-MCPs bereitstellen.Ein
test_model-Tool, das einen Live-Aufruf über den von dir konfigurierten Anbieter-Schlüssel macht, für Latenz-/Kosten-Plausibilitätsprüfungen.OAuth oder Cloudflare Access vor dem Worker, falls du ihn privat halten möchtest.
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