Skip to main content
Glama
Milkbasket MCP Server

Milkbasket MCP Server

by Anujsup

@anujsup/milkbasket-mcp

npm version npm downloads License: MIT MCP Node.js

AI-powered grocery shopping for India — a Model Context Protocol (MCP) server for the Milkbasket API.

Connect your AI assistant (Cursor, Claude Desktop, Windsurf, or any MCP client) to your Milkbasket account and let it handle your daily groceries — log in with OTP, browse products, build your cart, check your wallet, and review your full order summary, all through natural language.

What you can do with this:

  • Ask your AI to find products — "Search for low-fat milk under ₹50"

  • Build and manage your cart — "Add 2 Amul butter, remove the lassi"

  • Check your order before delivery — "Show me my cart with the full bill"

  • Keep track of your wallet — "What's my Milkbasket balance?"

  • Fetch account details — "What city and hub am I assigned to?"

Prerequisites

  • Node.js 18 or higher

  • A Milkbasket account (Indian mobile number)

  • An MCP client (Cursor, Claude Desktop, etc.)

Related MCP server: Blinkit MCP

Installation

{
  "mcpServers": {
    "milkbasket": {
      "command": "npx",
      "args": ["-y", "@anujsup/milkbasket-mcp@latest"]
    }
  }
}

Option 2: Global install

npm install -g @anujsup/milkbasket-mcp
{
  "mcpServers": {
    "milkbasket": {
      "command": "milkbasket-mcp"
    }
  }
}

Option 3: Local install

npm install @anujsup/milkbasket-mcp
{
  "mcpServers": {
    "milkbasket": {
      "command": "node",
      "args": ["node_modules/@anujsup/milkbasket-mcp/dist/index.js"]
    }
  }
}

Cursor setup

Add the config to .cursor/mcp.json in your project root (project-level) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "milkbasket": {
      "command": "npx",
      "args": ["-y", "@anujsup/milkbasket-mcp@latest"]
    }
  }
}

Reload Cursor after saving.

Available Tools

Authentication

Tool

Description

auth_request_otp

Send OTP to your registered mobile number

auth_verify_otp

Verify OTP and log in

auth_status

Check if you are currently authenticated

auth_logout

Log out and clear stored tokens

User

Tool

Description

get_user_details

Fetch your name, email, city, hub, and membership info

get_wallet_balance

Fetch your current Milkbasket wallet balance and cashback

Products

Tool

Description

list_products

List featured/flash-deal products (paginated)

search_products

Search products by name or keyword (paginated)

get_hero_collections

Fetch hero banner collections shown on the home screen

Cart

Tool

Description

add_to_cart

Add a new product or increase quantity in the cart

remove_from_cart

Decrease quantity or remove a product from the cart

get_basket

Lightweight cart snapshot — item count, product IDs, basic totals

get_extended_basket

Full cart view — product names, images, discounts, delivery fee, GST, final payable amount

Authentication Flow

1. auth_request_otp  →  { phone: "9XXXXXXXXX" }
2. Receive OTP via SMS
3. auth_verify_otp   →  { phone: "9XXXXXXXXX", otp: "XXXX" }
4. You are now logged in

Security & Privacy

This server runs 100% locally on your machine. Your phone number, OTP, and tokens never leave your device — they are never sent to any third party, including the AI assistant. Here's exactly what happens:

  • Your phone number is sent directly from your machine to Milkbasket's servers to request an OTP

  • The OTP you share with the AI is passed directly from your machine to Milkbasket to verify login

  • The AI model only sees the response (success/failure) — it cannot intercept or store your credentials

  • Access tokens are stored in your OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service) using keytar — the same secure storage used by apps like VS Code and 1Password

  • If keytar is unavailable, an AES-256-GCM encrypted file is used as fallback

  • You can log out at any time using auth_logout, which clears all stored tokens immediately

Cart Flow

search_products  →  find productId and price
add_to_cart      →  { productId, price, quantity }
remove_from_cart →  { productId, price, quantity: 0 }  ← set 0 to delete
get_extended_basket  →  full checkout view

What you can ask your AI

Once connected, just talk to your AI naturally:

What you say

What happens

"Log me in to Milkbasket"

Sends OTP → verifies → stores token

"Search for paneer"

Calls search_products and returns matches

"Add 2 Amul Gold milk to my cart"

Calls add_to_cart with the right product

"Remove the lassi from my cart"

Calls remove_from_cart with quantity 0

"Show me my cart with full bill"

Calls get_extended_basket with itemized bill

"What is my wallet balance?"

Calls get_wallet_balance

"What are my account details?"

Calls get_user_details — name, city, hub, membership

"What deals are on today?"

Calls list_products for flash deals

"Log me out"

Clears tokens from keychain

Example usage in Cursor

Search for Amul milk products
→ search_products({ query: "amul milk" })

Add 2 units to cart
→ add_to_cart({ productId: 1234, price: 28, quantity: 2 })

View full cart with bill breakdown (product names, discounts, delivery fee, GST, payable)
→ get_extended_basket()

Reduce quantity by 1
→ remove_from_cart({ productId: 1234, price: 28, quantity: 1 })

Remove product entirely
→ remove_from_cart({ productId: 1234, price: 28, quantity: 0 })

Check wallet balance
→ get_wallet_balance()

Get account info
→ get_user_details()

License

MIT © Anujsup

Available Tools

16 tools
add_flash_deal_to_cartA

Add a Mega Flash Deal product to the cart for free. Use this instead of add_to_cart for flash deal items (price is always 0). Requires the productId from get_flash_deals. flashDealId defaults to 11732. Try adding directly — if it fails with an eligibility error, then call get_flash_deal_status to diagnose (e.g. basket is empty, deal expired, or max quantity already reached) and guide the user accordingly. Do NOT call get_flash_deal_status before every add — only use it to explain a failure. Requires authentication.

Inputs: productId (required), date, flashDealId.

add_to_cartA

Add a NEW product to the basket or INCREASE the quantity of an existing product. Use this only when the quantity is going UP (e.g. adding a product for the first time, or bumping qty from 2 to 3). To DECREASE quantity or DELETE a product from the cart, use remove_from_cart instead. For flash deal products (free items from get_flash_deals), use add_flash_deal_to_cart instead. Requires authentication. Get productId and price from search_products or list_products.

Inputs: price (required), productId (required), date, quantity.

auth_logoutA

Clear the stored access and refresh tokens, effectively logging out.

Inputs: no named parameters.

auth_request_otpA

Request a one-time password (OTP) to be sent to the given phone number. Call this first to initiate login. IMPORTANT — reassure the user: this MCP server runs entirely on their local machine. Their phone number is sent directly from their device to Milkbasket's servers — it never passes through any AI model or third party.

Inputs: phone (required).

auth_statusA

Check whether the current session is authenticated and when it expires.

Inputs: no named parameters.

auth_verify_otpA

Verify the OTP received on the phone number to complete login. IMPORTANT — when asking the user for their OTP, always reassure them with this message: 'Your OTP is safe to share here. This MCP server runs entirely on your local machine — your OTP goes directly from your device to Milkbasket's servers and is never stored or seen by any AI model or third party.' After login, tokens are stored securely in the OS keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service).

Inputs: otp (required), phone (required).

get_basketA

Fetch a lightweight snapshot of the current cart — product IDs, quantities, unit prices, and a basic bill summary (subtotal, total, savings). Use this tool when you need a quick cart check: verifying if a product is in the cart, getting the item count, or getting the basic total without full product details. For the full checkout view with product names, images, discounts, delivery fee, GST, and final payable amount — use get_extended_basket instead. Requires authentication.

Inputs: no named parameters.

get_extended_basketA

Fetch the full basket (cart) with COMPLETE product details including product names, weights, images, MRP, selling price, discount percentage, and an EXTENDED bill breakdown that includes delivery fee, GST, membership charges, cashback used, and final payable amount. Use this tool when you need to: show the user a detailed view of their cart (checkout screen), display product names or discount info for items in the cart, or show the complete bill breakdown including delivery fee and final payable amount. Use get_basket instead when you only need a quick/lightweight cart check (e.g. verifying if a product is in the cart, getting item count, or getting the basic total). Requires authentication.

Inputs: no named parameters.

get_flash_dealsA

Fetch today's Mega Flash Deal products — items that are free or heavily discounted for the day. Returns paginated products with name, weight, MRP, selling price, discount %, and stock status. Requires authentication. Uses listId '157975' by default (the flash deals collection). IMPORTANT: To add any product from this list to the cart, always use add_flash_deal_to_cart — never use add_to_cart for flash deal items.

Inputs: page, limit, listId, showInStockOnly.

get_flash_deal_statusA

Get the status and eligibility details of a Mega Flash Deal. Returns deal terms, your current basket value vs the minimum required, how many free items you have claimed vs the maximum allowed, deal timing, and a human-readable status message explaining what you need to do to unlock the deal. Use this to check why a flash deal item could not be added to cart. Requires authentication. Default deal ID is 11732.

Inputs: id.

get_hero_collectionsA

Fetch the homepage hero collections. Each collection has a listId that can be passed to list_products to browse its products.

Inputs: no named parameters.

get_user_detailsA

Fetch the logged-in user's profile (name, email, address, delivery info) and wallet balance. Requires authentication.

Inputs: no named parameters.

get_wallet_balanceA

Fetch the logged-in user's wallet balance including main credits, food credits, and cashback credits. Requires authentication.

Inputs: no named parameters.

list_productsA

List products from a specific collection by its listId (obtained from get_hero_collections). Supports pagination and in-stock filtering. Requires authentication.

Inputs: listId (required), page, limit, showInStockOnly.

remove_from_cartA

DECREASE the quantity of a product in the basket or DELETE it entirely. Use this when the quantity is going DOWN (e.g. reducing from 3 to 2, or removing a product). Set quantity=0 to completely remove the product from the cart. To ADD a new product or INCREASE quantity, use add_to_cart instead. Requires authentication. Get productId and price from get_basket or get_extended_basket.

Inputs: price (required), productId (required), date, quantity.

search_productsA

Search for products by name or keyword across the Milkbasket catalog. Supports pagination. Requires authentication.

Inputs: searchText (required), page, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 16 tools

    Disambiguation4/5

    Tools are mostly distinct, with clear separation between auth, catalog, cart, and flash deal operations. The main potential confusion is between get_basket and get_extended_basket, and between add_to_cart and add_flash_deal_to_cart, but detailed descriptions explicitly differentiate them.

    Naming Consistency4/5

    Tool names follow a readable snake_case convention, but mix prefixes: 'get_' for retrievals, 'auth_' for authentication, and action verbs like list_, search_, add_, remove_. This is predictable within each functional area, though not a single uniform verb_noun pattern across all tools.

    Tool Count4/5

    16 tools is slightly above the typical 3-15 well-scoped range, but appropriate for the breadth of features: authentication, catalog browsing, cart management, wallet, and flash deals. Each tool serves a clear purpose without excessive redundancy.

    Completeness4/5

    The core shopping lifecycle is well covered: browse/search products, view cart (light and detailed), add/remove items, and handle flash deals. Authentication and wallet access are also included. Minor gaps exist, such as no explicit 'update quantity' tool and no checkout flow, but these are workable via existing tools or are out of scope.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to search the catalog, manage a cart and usual orders, find delivery slots, and handle favorites, shopping lists, past orders, and item remarks through the store's API, with login and payment left to the user on the website.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables assistants to search products, build and validate a Blinkit cart, manage delivery locations and addresses, and use saved staples or combos through Blinkit's JSON API while leaving payment to the user.
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to shop groceries across five European online delivery platforms by searching products, managing shopping carts, browsing discounts, and reviewing account, order history, and delivery slot information through natural language.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to shop groceries across Rohlik Group platforms by searching products, managing carts, analyzing purchase history for personalized suggestions, and accessing account, order, delivery, and discount information.
      -