camille-vanhoffelen/pantrydb
If you are the rightful owner of pantrydb and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP server to keep track of what's in your pantry.
🥫 PantryDB
Remote MCP server to keep track of what's in your pantry.
Exposes a simple database to list, add, and remove pantry items.
The server is remote so that it can be accessed on the go (e.g on mobile). It supports a single user authenticated with GitHub OAuth.
PantryDB uses CloudFlare's MCP & OAuth libraries, and deployed on CloudFlare Workers.
📋 Table of Contents
🥫 Examples
Ask for advice when shopping.
Scan your receipts to add to the pantry.
Leave a voice memo to let Claude know that you ate some chips.
🚀 Getting Started
Prerequisites
- Node.js (v18 or higher) and npm - for running the project and managing dependencies
- OpenSSL - for generating cookie encryption keys (
openssl rand -hex 32
) - GitHub account - for OAuth authentication setup
- Cloudflare account - for Workers deployment and D1/KV services
Installation
Install dependencies:
npm install
Login to Wrangler:
npx wrangler login
🚢 Deployment
- local: run PantryDB locally and access it with MCP clients on the same machine.
- remote: deploy PantryDB remotely and access from any MCP client.
GitHub OAuth
Local
Create a new OAuth App for local development.
Navigate to github.com/settings/developers to create a new OAuth App with the following settings:
Application name: PantryDB (local)
Homepage URL: http://localhost:8788
Authorization callback URL: http://localhost:8788/callback
Note your Client ID and generate a Client secret. Add both to a .dev.vars
file in the root of your project, which will be used to set secrets in local development:
touch .dev.vars
echo 'GITHUB_CLIENT_ID="your-client-id"' >> .dev.vars
echo 'GITHUB_CLIENT_SECRET="your-client-secret"' >> .dev.vars
Then, add the username of the only GitHub account which will be allowed to use your PantryDB:
echo 'ALLOWED_GITHUB_USERNAME="your-username"' >> .dev.vars
Remote
Create a new OAuth App for the remote server:
Navigate to github.com/settings/developers to create a new OAuth App with the following settings:
Application name: PantryDB (prod)
Homepage URL: https://pantrydb.<your-subdomain>.workers.dev
Authorization callback URL: https://pantrydb.<your-subdomain>.workers.dev/callback
Note your Client ID and generate a Client secret. Set secrets via Wrangler:
npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRET
Then, set the username of the only GitHub account which will be allowed to use your PantryDB:
npx wrangler secret put ALLOWED_GITHUB_USERNAME
Cookie Encryption
Set a cookie encryption key. Use any random string (e.g openssl rand -hex 32
). Then, set the key as secret:
Local
echo 'COOKIE_ENCRYPTION_KEY="your-cookie-encryption-key"' >> .dev.vars
Remote
npx wrangler secret put COOKIE_ENCRYPTION_KEY
KV namespace
Create the server's OAuth KV namespace:
npx wrangler kv:namespace create "OAUTH_KV"
Then, update the Wrangler file (wrangler.jsonc
) with the KV ID.
D1 Database
Create the d1 database.
npx wrangler d1 create pantrydb
Then initialise it.
# local
npx wrangler d1 execute pantrydb --local --file=db/schema.sql
# or remote
npx wrangler d1 execute pantrydb --remote --file=db/schema.sql
Finally, update the Wrangler file (wrangler.jsonc
) with the D1 database ID.
Deploy
Local
Run the MCP server locally at http://localhost:8788/sse
:
npx wrangler dev
Remote
Deploy the MCP server to make it available on your workers.dev
domain:
npx wrangler deploy
🔌 Usage
Then connect to your local PantryDB at http://localhost:8788/sse
, or your remote PantryDB at https://pantrydb.<your-subdomain>.workers.dev/sse
with:
- Claude Desktop & Mobile with remote connectors
- any other MCP client
- MCP inspector, useful for both local & remote testing:
npx @modelcontextprotocol/inspector
😎 Credits
- Pantry photo by Annie Spratt on Unsplash
- Cloudflare "Build a Remote MCP Server" examples & template
- Cloudflare D1 examples
- Receipt image from CORD: A Consolidated Receipt Dataset for Post-OCR Parsing, by Park, Seunghyun; Shin, Seung; Lee, Bado; Lee, Junyeop; Surh, Jaeheung; Seo, Minjoon; Lee, Hwalsuk, under CC BY 4.0 license.
Special thanks to:
- Raphael Van Hoffelen, OAuth mentor