modelsdev-mcp
by Ankur1911
README.md
# modelsdev-mcp
A [Model Context Protocol](https://modelcontextprotocol.io) server for [models.dev](https://models.dev), the open catalog of AI models: context windows, output limits, per-million-token prices, modalities, tool calling, reasoning, structured output, open weights, release dates and status, across 300+ providers. It needs no API key and is read-only.
The tools are shaped around the questions teams ask when choosing or budgeting a model, rather than one tool per field.
- `search_models` shortlists by capability, modality, context window, price ceiling and release date in one call, and returns compact rows instead of the 6 MB catalog.
- `get_model` merges a model's profile (limits, all price fields including cached input and long-context tiers, provider docs URL, API base URL, credential variable names, SDK package) with every other provider that offers the same model and what they charge.
- `estimate_cost` prices a workload (tokens per request, cached tokens, request count) on up to 12 candidates and ranks them. It applies the catalog's long-context price tiers and warns when a request would not fit the context window or output limit.
The catalog is downloaded once and cached in memory, so a session of many tool calls makes one request.
## Setup
Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).
```bash
git clone https://github.com/Ankur1911/modelsdev-mcp && cd modelsdev-mcp
uv sync
uv run modelsdev-mcp # stdio transport
```
Add it to any MCP client that launches stdio servers:
```json
{
"mcpServers": {
"modelsdev": {
"command": "uv",
"args": ["run", "--directory", "/path/to/modelsdev-mcp", "modelsdev-mcp"]
}
}
}
```
For HTTP instead of stdio: `MCP_TRANSPORT=streamable-http MCP_HOST=127.0.0.1 MCP_PORT=8000 uv run modelsdev-mcp`.
## Tools
All tools are read-only. Model references are `provider/model-id` (for example `acme/acme-small`); a bare model id also works, and when several providers list it the first-party provider is used and the response says so.
| Tool | What it returns |
|---|---|
| `search_models` | Free-text query plus filters: `provider`, `kind` (chat by default, or embedding, image, video, transcription, speech, reranking, realtime, any), `require` (tool_call, reasoning, structured_output, attachment, open_weights), `input_modality`, `output_modality`, `min_context`, `max_input_price`, `max_output_price`, `released_after`, `paid_only`, `include_deprecated`. Sort by relevance, input price, output price, context or newest. Rows carry ref, name, context, max output, USD per 1M input/output tokens and capability flags. |
| `get_model` | Full profile: provider docs, API base, credential environment variable names, SDK package, limits, modalities, capabilities, reasoning options, every price field, knowledge cutoff, release and update dates, status, and up to 15 other providers offering the same model with their prices. |
| `compare_models` | 2 to 8 models side by side, with the cheapest, largest-context and most recent named, and the list of fields that actually differ. |
| `estimate_cost` | USD per request and in total for 1 to 12 models, ranked cheapest first, with an input / cached input / output breakdown and warnings for context or output overflow. |
| `list_providers` | Provider ids, model counts, API base, credential variable names, SDK package and docs link. Use it to find the id for the `provider` filter. |
## Configuration
All optional environment variables:
| Variable | Default | Meaning |
|---|---|---|
| `MODELSDEV_API_URL` | `https://models.dev/api.json` | Catalog URL (for a mirror or a local file server) |
| `MODELSDEV_CACHE_TTL` | `3600` | Seconds to keep the downloaded catalog in memory (`0` re-downloads on every call) |
| `MODELSDEV_TIMEOUT` | `60` | Download timeout in seconds |
| `MODELSDEV_RETRIES` | `2` | Retries on HTTP 429, 502, 503, 504 and timeouts |
| `MODELSDEV_MAX_CHARS` | `20000` | Responses longer than this are cut with a notice |
| `MCP_TRANSPORT` | `stdio` | `stdio` or `streamable-http` |
If a refresh fails and an older copy is in memory, the older copy is served rather than an error.
## Limits
- The data is community-maintained and published as-is. Prices are list prices in USD per 1M tokens and can lag a provider's own price page; check the provider before committing to a budget. A missing price means the catalog has none (free tier, self-hosted or not listed), not that the model is free.
- Many providers are resellers or gateways that list the same model at different prices. Search results include each listing as its own row, so use `get_model` to see the alternatives for one model.
- `estimate_cost` uses list prices only. It does not model batch or volume discounts, taxes, per-search or per-image fees, or provider-specific cache write charges. Long-context tiers are applied by prompt size per request.
- Reasoning tokens are only counted if you include them in `output_tokens`.
- The first call downloads about 6 MB; later calls in the same process are served from memory.
- Capability flags come from the catalog and describe what the model supports, not what a particular provider's endpoint exposes.
- Response size is capped (see `MODELSDEV_MAX_CHARS`).
## Development
```bash
uv sync
uv run pytest
```
Tests mock all HTTP traffic with `respx` and use an invented catalog in the same shape as the real file; no network access is needed.
## Licence
MIT. Author: Ankur Kapuriya. Not affiliated with or endorsed by models.dev. Check the models.dev terms and licence for the data before redistributing it.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues