BetterMeals Blinkit MCP for VS Code
Order groceries from Blinkit using AI directly in VS Code! 🛒✨
This extension provides secure OAuth 2.0 authentication for the BetterMeals Blinkit MCP server, enabling you to use natural language with AI assistants to search, add to cart, and place orders.
BetterMeals is your AI-first companion for smarter grocery ordering and meal planning. We bridge the gap between your favorite AI tools and real-world services like Blinkit, making it easier than ever to manage your kitchen without leaving your workflow.
- Check out the web app: bettermeals.in
- Get personalized recommendations: AI that knows what you like.
- Save time: Zero-click workflows for your daily essentials.
✨ Features
- One-click installation - Extension handles all authentication automatically.
- Secure OAuth 2.0 + PKCE - Industry-standard authentication flow.
- Custom AuthenticationProvider - Seamlessly integrated with VS Code's authentication system.
- AI-powered ordering - Use natural language to manage your groceries while you code.
- Automatic token management - Tokens stored securely in OS keychain.
- Seamless MCP integration - Works with any MCP-compatible AI assistant in VS Code.
🚀 Getting Started
Installation
- Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X) in VS Code.
- Search for
BetterMeals Blinkit MCP.
- Click Install. The extension will activate automatically.
First-Time Authentication
When you first try to order something through AI, you'll be prompted to sign in:
- Click "Sign In" when prompted by VS Code
- Browser opens to BetterMeals authentication page
- Sign in with Google - Secure OAuth authentication
- Link your Blinkit account - Enter phone number and verify OTP
- Approve permissions - Grant access to MCP tools
- VS Code opens automatically - Authentication complete!
Note for macOS users: If VS Code doesn't open automatically after approval, the browser will show a copyable URL. Simply:
- Copy the URL shown
- Run
BetterMeals: Handle OAuth Callback (Manual) from Command Palette
- Paste the URL when prompted
Your session is stored securely and persists across VS Code restarts.
💬 Usage Examples
Talk to your AI assistant naturally:
- "Order 2L milk and bread from Blinkit"
- "Search for organic vegetables on Blinkit"
- "Add 500g paneer to my Blinkit cart"
- "Show my Blinkit cart"
- "Place my Blinkit order with UPI"
The AI will use the BetterMeals MCP tools to execute these commands on your behalf.
🛠 Commands
Access these via Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
BetterMeals: Sign In - Manually trigger OAuth sign-in flow
BetterMeals: Sign Out - Sign out and clear stored credentials
BetterMeals: Handle OAuth Callback (Manual) - Complete authentication manually (macOS workaround)
BetterMeals: Connect Blinkit MCP - Manually enable the MCP server
BetterMeals: Disconnect Blinkit MCP - Disable the MCP server
BetterMeals: Open Documentation - View detailed help
⚙️ Settings
Configure in VS Code Settings (Cmd+, / Ctrl+,):
bettermeals.mcp.enabled - Enable/disable the MCP server (default: true)
bettermeals.mcp.autoConnect - Automatically connect on startup (default: true)
🔒 Security & Privacy
Authentication Architecture
This extension implements VS Code's official AuthenticationProvider pattern:
- OAuth 2.0 + PKCE - Industry-standard authorization flow with Proof Key for Code Exchange
- No client secrets in code - Uses public client (
vscode-prod) with PKCE protection
- State parameter validation - Prevents CSRF attacks
- Secure token storage - Uses VS Code's
SecretStorage API (OS keychain)
Data Handling
- Local token storage - Access tokens stored in your OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service)
- No telemetry - Extension does not collect or transmit usage data
- HTTPS only - All communication with backend is encrypted
- Minimal permissions - Extension only requests
mcp.invoke scope
Privacy
- Your Blinkit account credentials are never seen by this extension
- OAuth flow handled by BetterMeals' secure backend
- Tokens are never logged or transmitted to third parties
- Open source - audit the code yourself!
🏗 Architecture
Components
┌─────────────────────────────────────────────┐
│ VS Code Extension │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ BetterMealsAuthenticationProvider │ │
│ │ - Implements VS Code auth interface │ │
│ │ - Manages OAuth flow (PKCE) │ │
│ │ - Stores tokens securely │ │
│ └──────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────┐ │
│ │ Extension Activation │ │
│ │ - Registers auth provider │ │
│ │ - Handles OAuth callbacks │ │
│ │ - Configures MCP server │ │
│ └──────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ VS Code MCP Client (Built-in) │
│ - Discovers auth provider │
│ - Attaches tokens to requests │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ MCP Server │
│ https://mcp.blinkit.bettermeals.in/mcp │
│ - Validates JWT tokens │
│ - Exposes grocery ordering tools │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ Athena OAuth Backend │
│ https://api.bettermeals.in/api/v1/mcp-auth │
│ - Authorization endpoint │
│ - Token endpoint │
│ - User management │
└─────────────────────────────────────────────┘
OAuth Flow
- User triggers AI command requiring MCP access
- VS Code requests session from our
AuthenticationProvider
- Extension generates PKCE parameters and opens browser to authorization URL
- User signs in with Google and links Blinkit account
- Backend redirects to
vscode://bettermeals-mcp/callback with auth code
- Extension catches callback and exchanges code for access token
- Token stored securely in OS keychain
- VS Code MCP client uses token for all subsequent requests
🐛 Troubleshooting
Extension not working?
- Run
BetterMeals: Connect Blinkit MCP from Command Palette
- Restart VS Code
- Check VS Code version (requires 1.80.0+)
OAuth failing?
- Ensure you're on latest VS Code version
- Check internet connection
- Try signing out and back in:
BetterMeals: Sign Out → BetterMeals: Sign In
- Check browser isn't blocking the redirect
Blinkit account linking failing?
- Verify you're using the phone number registered with Blinkit
- Ensure you can receive OTP SMS
- Check that your Blinkit account is active
Token expired?
- Extension automatically handles expired tokens
- If issues persist, sign out and sign back in
MCP server not connecting?
- Verify server is configured: Check Settings → Extensions → BetterMeals Blinkit MCP
- Try disconnecting and reconnecting:
BetterMeals: Disconnect Blinkit MCP → BetterMeals: Connect Blinkit MCP
Still have issues?
- Check extension logs: Help → Toggle Developer Tools → Console
- Contact us: support@bettermeals.in
- Report issues: GitHub Issues
🧪 Development
Prerequisites
- Node.js 16+
- VS Code 1.80.0+
- TypeScript 5.0+
Setup
cd vscode-blinkit-extension
npm install
npm run compile
Testing
Press F5 in VS Code to launch Extension Development Host.
Debugging
- Set breakpoints in TypeScript files
- Press
F5 to start debugging
- Extension Development Host will open
- Trigger authentication flow
- Breakpoints will hit in main VS Code window
📖 Technical Details
Files
src/extension.ts - Extension entry point, registers provider and handles commands
src/authProvider.ts - AuthenticationProvider implementation
src/oauth.ts - OAuth utilities (PKCE, token exchange)
src/types.ts - TypeScript interfaces
Configuration
- Client ID:
vscode-prod (hardcoded in extension)
- Redirect URI:
vscode://bettermeals-mcp/callback
- Authorization URL:
https://api.bettermeals.in/api/v1/mcp-auth/authorize
- Token URL:
https://api.bettermeals.in/api/v1/mcp-auth/token
- Scopes:
mcp.invoke
Token Storage
Tokens are stored using VS Code's context.secrets API, which uses:
- macOS: Keychain
- Windows: Credential Manager
- Linux: Secret Service API (libsecret)
🤝 Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
📄 License
License - see LICENSE file for details.
🙏 Acknowledgments
Built with:
📞 Support
Happy grocery shopping! 🛒✨