npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@theyahia/ifood-mcp

v1.1.0

Published

MCP server for iFood — restaurant orders, menu management (Brazil)

Readme

ifood-mcp

MCP server for iFood merchant integration (Brazil) — manage orders, the store, and the catalog from any MCP client (Claude, etc.).

Talks to the iFood Merchant API (merchant-api.ifood.com.br) using OAuth2 client_credentials. One shared, auto-refreshed token is used across all tools.

Quick Start

{
  "mcpServers": {
    "ifood": {
      "command": "npx",
      "args": ["-y", "@theyahia/ifood-mcp"],
      "env": {
        "IFOOD_CLIENT_ID": "<YOUR_IFOOD_CLIENT_ID>",
        "IFOOD_CLIENT_SECRET": "<YOUR_IFOOD_CLIENT_SECRET>"
      }
    }
  }
}

Get credentials from the iFood Developer Portal (create an application; this server uses the client_credentials grant, which reaches the merchants your application directly owns).

Order workflow

iFood delivers orders as events you must poll and acknowledge:

  1. list_orders — poll for new events (~every 30s). Returns events like PLACED, CONFIRMED, CANCELLED.
  2. acknowledge_events — acknowledge the event IDs you received, or iFood redelivers them on every poll forever.
  3. get_order — fetch full detail for an order ID from a PLACED event.
  4. confirm_orderstart_preparation (optional) → dispatch_order (delivery) or ready_to_pickup (takeout/dine-in).
  5. To cancel: get_cancellation_reasons (get valid codes for that order) → cancel_order (with a code).

Tools (26)

Orders

| Tool | What it does | |---|---| | list_orders | Poll order events (PLACED/CONFIRMED/…). | | acknowledge_events | Acknowledge events so they stop being redelivered. | | get_order | Get full order detail by ID. | | confirm_order | Confirm/accept an order. | | start_preparation | Mark an order as in preparation (optional). | | ready_to_pickup | Mark an order ready for pickup (required for takeout/dine-in). | | dispatch_order | Mark a delivery order as dispatched. | | get_cancellation_reasons | Get valid cancellation codes for an order. | | cancel_order | Request cancellation using a code. |

Merchant

| Tool | What it does | |---|---| | list_merchants | List accessible merchants (paginated). | | get_merchant | Full merchant detail (name, address, operations). | | get_merchant_status | Availability per operation/sales channel. | | get_opening_hours | Read weekly opening hours. | | set_opening_hours | Replace the entire weekly schedule. | | list_interruptions | List active/future store pauses. | | create_interruption | Temporarily pause the store (the correct pause mechanism). | | delete_interruption | Resume the store. |

Catalog (v2.0)

| Tool | What it does | |---|---| | update_item_status | Set an item AVAILABLE/UNAVAILABLE. | | update_item_price | Update an item's price. | | update_option_status | Set a complement/option AVAILABLE/UNAVAILABLE. | | update_option_price | Update a complement/option price. | | list_catalogs | List the merchant's catalogs. | | list_categories | List categories (use include_items to get item IDs). | | list_items_by_category | List items/products/options in a category. | | list_products | List products (paginated). | | upsert_item | Create or fully replace an item with its dependencies. |

To discover an item_id for the write tools: list_merchantslist_catalogslist_categories (include_items: true).

Tools carry MCP annotations (readOnlyHint / destructiveHint / idempotentHint) so clients can warn before write/destructive actions.

Environment Variables

| Variable | Required | Default | Description | |---|---|---|---| | IFOOD_CLIENT_ID | Yes | — | OAuth client ID. | | IFOOD_CLIENT_SECRET | Yes | — | OAuth client secret. | | IFOOD_BASE_URL | No | https://merchant-api.ifood.com.br | Override the API base URL (staging/sandbox). | | IFOOD_TOKEN_URL | No | <base>/authentication/v1.0/oauth/token | Override the token endpoint. | | IFOOD_TIMEOUT_MS | No | 15000 | Per-request timeout in ms. | | IFOOD_MAX_ATTEMPTS | No | 3 | Total attempts (initial + retries) for transient failures. |

The client automatically: retries 429/5xx/network/timeout with exponential backoff (honoring Retry-After), refreshes the OAuth token once on a 401, and tolerates the empty 202/204 bodies iFood returns for state transitions.

Troubleshooting

  • 401 / auth errors — check IFOOD_CLIENT_ID/IFOOD_CLIENT_SECRET; the client re-auths once automatically on a mid-session 401.
  • Empty merchant listclient_credentials only reaches merchants your application directly owns. The iFood distribution model (per-merchant authorization_code tokens) is not implemented here.
  • 429 rate limitlist_orders polling is limited to ~one request per 30s per token; the client backs off automatically.
  • get_order 404 right after PLACED — order detail can lag the event; retry with backoff (up to ~10 min).

⚠️ Endpoints pending verification

iFood's developer portal blocks automated access, so two endpoints were implemented from best available (cross-source) evidence rather than a verbatim spec read. Verify against the live iFood docs / Postman collection before depending on them in production (see code comments in the relevant tool files):

  • acknowledge_events — uses POST /order/v1.0/events/acknowledgment. The events path segment is a best-guess (the alternative is /order/v1.0/acknowledgment).
  • cancel_order — sends { "reason": "<code>" }. The exact order-module body is uncertain (a two-field { reason, cancellationCode } shape may belong to the shipping module).

Development

npm ci
npm run build      # tsc → dist/
npm test           # vitest
npm run dev        # tsx src/index.ts

License

MIT