MCP Integration
The MealCP MCP server exposes the API as tools for AI clients - ask in plain
language, and your client queries live grocery prices for you. It’s the
standalone mealcp-mcp package
(PyPI). It runs as a subprocess of
your client over stdio and queries the API over HTTP - no separate
deployment, no secrets beyond your API key.
The Model Context Protocol is an open
standard that lets AI applications discover and call external tools. Instead
of writing HTTP clients yourself, you register the MealCP server once and the
client’s model decides when to call it - “how much is oat milk at Tesco in
Hungary?” becomes a tool call to search_products without any glue code.
How a tool call flows
Section titled “How a tool call flows”- Your client starts (or reuses) the
mealcp-mcpsubprocess over stdio. - The model picks a tool -
search_productsorget_price_history- based on the user’s question, and fills in the arguments. - The server forwards the call to the matching REST endpoint over HTTPS,
authenticated with your
MEALCP_API_KEY. - Structured JSON returns to the client, and the model composes the answer.
Tool calls map 1:1 to REST endpoints and cost the same 1 credit each (Credits & limits). Everything the tools expose is also available directly over the REST API.
| Tool | Maps to | Description |
|---|---|---|
search_products |
GET /v1/search |
Keyword search with filters |
get_price_history |
GET /v1/prices/{id} |
Aggregated price-history stats |
search_productsaccepts a free-text query plus the familiar search filters - country, retailer, brand, category, tag, price bounds, sorting, pagination - and returns product hits with latest prices, unit prices, and retailer links in the same JSON shape as the endpoint it wraps.get_price_historyaccepts a product id from a search hit and a date range, and returns first/last/min/max/average prices, the change over the window, and the observation count - enough for the model to answer “is this cheaper than last month?”
When to use MCP vs REST
Section titled “When to use MCP vs REST”- MCP fits interactive use: exploring the data, ad-hoc price checks, and agents that answer questions about grocery prices on demand. Setup is configuration only - no HTTP code to write or maintain.
- REST fits products: fixed query patterns, tight latency control, and
budgeted credit usage in a backend you own. Many teams prototype the tool
experience over MCP, then implement the same calls against
/v1/searchin production.
Python
Section titled “Python”No install step - uvx (ships with uv) runs the
server on demand:
uvx mealcp-mcpopencode (opencode.json)
Section titled “opencode (opencode.json)”{ "$schema": "https://opencode.ai/config.json", "mcp": { "mealcp": { "type": "local", "command": ["uvx", "mealcp-mcp"], "enabled": true, "environment": { "MEALCP_API_URL": "https://api.mealcp.com", "MEALCP_API_KEY": "mcp_live_..." } } }}Claude Desktop (claude_desktop_config.json)
Section titled “Claude Desktop (claude_desktop_config.json)”{ "mcpServers": { "mealcp": { "command": "uvx", "args": ["mealcp-mcp"], "env": { "MEALCP_API_URL": "https://api.mealcp.com", "MEALCP_API_KEY": "mcp_live_..." } } }}Restart the client after editing. It spawns the server, which forwards each
search_products / get_price_history call to the API and returns the
structured results.
Environment variables
Section titled “Environment variables”| Variable | Required | Description |
|---|---|---|
MEALCP_API_URL |
yes | API base URL - https://api.mealcp.com |
MEALCP_API_KEY |
yes | Your API key (Quickstart) |
If tools don’t appear
Section titled “If tools don’t appear”- Restart the client. Both opencode and Claude Desktop read their config at startup; edits take effect on relaunch.
- Check
uvxresolves. Runuvx mealcp-mcpin a terminal - if the command is missing, install uv first. - Verify the key. A rejected key surfaces as failed tool calls with a
401underneath. Check the key and its credit balance withGET /v1/me.
JavaScript
Section titled “JavaScript”npm package coming soon - the Python server works everywhere today.