model-gateway
MCP server for discovering and cataloging generative AI models, enabling agents to search by modality, view pricing/terms, and manage contracts with providers via Beckn-aligned APIs.
README
Model Gateway
Model discovery, cataloging, and agent→provider contracting harness. Beckn Protocol v2-aligned (catalog + contract layer) and MCP-native.
Scope (v1): catalog + discovery + contract lifecycle over your generative-model providers (OpenRouter, Google Vertex, Runway, …). Transaction-sandbox / live-network participation (DeDi broadcast, signed callbacks) is a deferred phase.
What it answers for an agent
- "What models can generate video (or image/audio/text)?" — modality search
- "What does model X cost, what are its terms?" — pricing + ToU
- "Block this model for my use, track my usage, and let me rate it / get support" — contract lifecycle
Quick start
npm install
npm run migrate
npm run seed # seeds OpenRouter, Google Vertex, Runway + representative models
npm start # REST on :8090 (PORT to override)
npm run mcp # MCP stdio server (tools for agents)
npm test # 25/25 E2E (catalog + contract lifecycle + MCP)
REST API (Beckn verb → endpoint)
| Beckn v2 | Endpoint | Purpose |
|---|---|---|
| search | GET /api/search?out=video&cap=video-generation |
search models by modality/capability/provider/price |
| — | GET /api/models?any=video&io=output |
models supporting modality(ies) |
| — | GET /api/models/:id |
model detail (Beckn Item: pricing, capabilities, ToU) |
| — | GET /api/providers / GET /api/providers/:id/catalog |
providers + Beckn catalog |
| select | POST /api/contracts/quote |
quote a contract |
| init | POST /api/contracts |
create contract (agent blocks a model) |
| — | POST /api/contracts/:id/block |
activate/block for use |
| status | GET /api/contracts/:id |
contract + Beckn order view |
| track | POST /api/contracts/:id/usage / GET .../usage |
record/aggregate usage |
| update | PATCH /api/contracts/:id |
update quota/terms/notes |
| cancel | POST /api/contracts/:id/cancel |
cancel |
| rating | POST /api/contracts/:id/rate |
rate the model |
| support | POST /api/contracts/:id/support |
request support |
MCP tools (stdio)
list_providers, list_models, models_by_modality, get_model, get_catalog, quote, create_contract, block_model, update_contract, cancel_contract, track_usage, contract_status, rate_model, request_support
Add to an MCP client:
{ "mcpServers": { "model-gateway": { "command": "node", "args": ["/path/to/src/mcp/server.js"], "env": { "DB_PATH": "/path/to/model-gateway.sqlite" } } } }
Beckn v2 mapping
See docs/ARCHITECTURE.md. Provider→BPP, Model→Item, Catalog→Beckn Catalog,
Contract→Order/Fulfillment, Rating/Support/Track→respective Beckn actions.
Payloads are Beckn-shaped so they validate against v2 catalog/contract semantics.
Contract state machine
draft → quoted → active → (paused) → completed | cancelled | failed (+ support overlay).
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.