models-mcp
Enables searching, comparing, and inspecting AI models by pricing, context window, and capabilities via the models.dev catalog.
README
Models MCP
Search, compare, and inspect AI models by pricing, context window, and capabilities. An MCP server over the models.dev catalog (models.dev/api.json), so your agent always has current model data without you hand-maintaining a list.
models.dev itself doesn't ship an MCP server, just a JSON API and a TypeScript SDK for reading it. This fills that gap.
Runs two ways from the same tool code:
- stdio (
src/index.ts) for local MCP clients - Cloudflare Worker (
src/worker.ts) as a remote Streamable HTTP endpoint at/models-mcp
Tools
| Tool | What it does |
|---|---|
list_providers |
Lists every provider (anthropic, openai, google, ...) with model counts |
find_models |
Filters models by name, provider, min context window, max input cost, or capability flags (reasoning, tool_call, attachment) |
get_model |
Full metadata for one model, by provider/model id |
compare_models |
Side-by-side diff of 2-6 models on pricing, context, and capabilities |
top_models |
Ranks models by cheapest input/output price, largest context, context-per-dollar, or newest release; supports the same filters as find_models |
estimate_cost |
Computes the USD cost of a request from a model's published per-million-token rates, including cache read/write components |
get_provider |
Provider metadata: display name, AI SDK package, API base URL, docs link, and a compact list of its models |
refresh_catalog |
Forces a re-fetch, bypassing the 1-hour cache |
All search-style tools (find_models, top_models) share one filter schema, so filter semantics are identical everywhere. Ranking and estimation exclude models that lack the relevant data (e.g. unpriced local models) rather than guessing.
Install
npm install
npm run build
Run standalone over stdio (for testing)
npm start
It speaks MCP over stdio, so you won't see much directly; use the MCP Inspector to poke at it:
npx @modelcontextprotocol/inspector node dist/index.js
Host on Cloudflare Workers
The Worker entry (src/worker.ts) serves the same tools over Streamable HTTP at /models-mcp, with:
- Catalog caching in the Workers Cache API (
caches.default) with a 1-hour TTL, shared across requests and isolates. - Per-IP rate limiting via a Workers rate limiting binding: 60 requests/minute per IP, enforced per Cloudflare location. Excess requests get
429withRetry-After: 60.
# local dev at http://localhost:8787/models-mcp
npm run dev:worker
# deploy
npm run deploy
After deploy, the canonical endpoint is https://mcp.dosa.dev/models-mcp. The generated https://models-mcp.<your-subdomain>.workers.dev/models-mcp URL stays live as a fallback.
Point MCP clients at it:
Claude Code:
claude mcp add --transport http models-mcp https://mcp.dosa.dev/models-mcp
Generic client config (anything that speaks Streamable HTTP):
{
"mcpServers": {
"models-mcp": {
"url": "https://mcp.dosa.dev/models-mcp"
}
}
}
For stdio-only clients (Claude Desktop), bridge with mcp-remote:
{
"mcpServers": {
"models-mcp": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.dosa.dev/models-mcp"]
}
}
}
No API keys required anywhere. All data comes from the public models.dev/api.json endpoint.
Try it out
With the dev server running (npm run dev:worker), the endpoint is http://localhost:8787/models-mcp.
Quick curl (MCP initialize):
curl -X POST http://localhost:8787/models-mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"manual","version":"1.0"}}}'
Expect an SSE response with serverInfo.name: "models-mcp".
MCP Inspector (best for poking at tools interactively):
npx @modelcontextprotocol/inspector
Set Transport Type to Streamable HTTP and URL to http://localhost:8787/models-mcp, then call tools from the UI.
Claude Code against the local server:
claude mcp add --transport http models-mcp-local http://localhost:8787/models-mcp
Then ask it something like "which anthropic models cost under $1 per million input tokens?" and watch it reach for find_models.
Rate limiting: fire 61 rapid requests at the endpoint and request 61 onwards returns 429 with Retry-After: 60.
Things worth trying in the Inspector:
find_modelswith combined filters, e.g.maxInputCost: 0.5together withminContext: 200000get_modelwith a bare id likegpt-5.2(resolves) and with a nonsense id (clean tool error)compare_modelswith one invalid id mixed in (it lands undernotFound)- The first call fetches the live catalog (~200ms); repeat calls are cache hits
Tests
npm test
Covers the catalog client (flattening, TTL caching, force refresh, stale-on-failure fallback, id resolution) and all eight tools end-to-end through a real MCP client session over an in-memory transport.
Notes on the data
- The catalog is cached for 1 hour: in the Workers Cache API when hosted, in process memory over stdio. Call
refresh_catalogto force an update. If a refetch fails, the last good catalog keeps being served andrefresh_catalogreportsservedStale: trueso you can tell. - A daily GitHub Actions workflow (
Catalog drift) fetches the liveapi.jsonand sanity-checks it against the flattening logic, since models.dev publishes no versioned schema. It opens acatalog-driftissue if upstream changes shape. Run it locally withnpm run build && npm run test:live. - models.dev doesn't publish a versioned schema for consumers, so the types in
src/types.tsare intentionally loose (index signatures preserve any fields not explicitly typed). - Model ids follow the
provider/modelconvention used by the AI SDK and OpenCode, e.g.anthropic/claude-sonnet-4-5.get_modelandcompare_modelsalso accept a bare model id when it names exactly one model across all providers; if the bare id is ambiguous (common with aggregator providers mirroring first-party models), the tool errors with the list of candidateprovider/modelids instead of silently picking one.get_provideremits fullprovider/modelids so its output round-trips throughget_modelunchanged.
Possible extensions
- A
list_facetstool (modalities, tokenizers) similar to what other model-catalog MCPs expose. - A
test_modeltool that makes a live call through whichever provider key you have configured, for latency/cost sanity checks. - OAuth or Cloudflare Access in front of the Worker, if you want it private.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。