Hey Cursor community!

I’m currently integrating Supabase as the Main Cloud Provider (MCP) in my Cursor AI project built with React Native (Expo) + Yarn.
I’ve set up Supabase correctly, using the @supabase/supabase-js
v2 client, and I’m importing it through a singleton file (supabaseClient.ts
). However, I keep getting this error in Cursor:
javascript
CopyEdit
MCP Error: Supabase client closed
Here’s what I’ve done so far:
- Created a singleton Supabase client using
createClient
. - Imported it only once in
lib/supabaseClient.ts
. - Hooked it into an
AuthContext
to track user state and auth. - Using Expo + Yarn (React Native) in Cursor.
What I need help with:
- Why is Cursor MCP showing the “client closed” error?
- Is there something specific about Cursor’s MCP architecture that closes or resets the Supabase client?
- How can I permanently persist the client and avoid reinitializing?
- Should I manage Supabase outside of MCP, or is there a Cursor-specific pattern to follow?
Would appreciate any help, tips, or working examples!