Hey everyone!
Super excited to release a big new Buildprint feature today. I’m posting it here as this should be interesting to lots of people who’ve never used Buildprint before!
In case you haven’t tried it, Buildprint is the best way to build on Bubble with AI. In our testing, it is twice as fast as Bubble’s MCP, is half the cost for agents, and has significantly more powerful capabilities.
In addition, Buildprint supports:
- Connecting your Claude Code / Codex / Cursor subscription
- Triage, which automatically detects and fixes customer support requests
- Radar, which reviews your merges (like CodeRabbit or Greptile for Bubble)
How to build an MCP server for Bubble
Using Buildprint, just use /mcp in your project, and Buildprint will do it for you, end to end, in one prompt.
However, for those of you that want to do it manually (as I know this is a popular ask), I wanted to share how.
Deciding auth (Token vs OAuth)
First, you need to decide which authentication methods you want to support. If exposing a public API, then API tokens are useful as they’re easy for people to integrate with. However, it is less secure as these tokens can leak. In addition, if a user wants to connect their MCP, they’ll generally have to go into the advanced setup settings of Claude/ChatGPT etc.
Instead, we tend to recommend OAuth. This means that when adding https://mcp.yourapp.com/mcp to their Claude/ChatGPT account, it will say ‘Login with [your app]’ and redirect the user to log in. This is also useful because it means that the Bubble workflows that run from the MCP server will run as that user by default, meaning privacy rules are enforced and Current User can be referenced.
Exposing an MCP/API server
The reason creating a public MCP or API in Bubble is tricky is that Bubble only supports workflow execution through the workflow API (/api/1.1/wf/[your workflow]). This gives you limited flexibility, and it’s entirely impossible to support hosting an MCP server, which must expose endpoints in a specific way (though, I believe Bubble is working on making this possible).
For this, we need some custom code to sit in front of our Bubble backend. For this guide, I’ll use Cloudflare Workers as an example, but it could be any custom service.
Note that if you use Buildprint, /mcp handles all of this for you using Buildprint Extensions, which is included in your plan.
Our custom code service will be the one that exposes the MCP server and API endpoints. This is the URL that you’ll give customers connecting to your app. When they send a request, the custom code service will receive it, and forward it to the relevant endpoint in our Bubble backend workflow. It will then receive the response from Bubble, and forward it from the user. It sits in between the user and the Bubble app - a ‘proxy’.
I won’t go into the technical details of creating an MCP server service but any decent AI agent will help you with this. The main hassle is creating your Cloudflare/AWS/Railway/whatever account and linking domains etc (Buildprint handles this for you out of the box).
Maintainability
Now, what we want to avoid is introducing duplication in our app. i.e, if you already have a frontend workflow which, for example, deletes an invoice, then you need the MCP/API to use the same logic. You don’t want two copies of the same action, because then if you update one and forget to update the other, you’ll have bugs.
For this reason, we recommend using a backend custom event for each MCP-exposed functionality. For instance, the ‘delete invoice’ custom event would take an invoice ID, and delete the invoice (and any other associated data like line items, according to your app logic). Our public Bubble backend workflow called by our worker would trigger this custom event. Similarly, any frontend that does the same would trigger this custom event. They use the same logic in both places, because it is the same functionality.
Implementing API tokens securely
OAuth is actually the easiest way to set this all up with less footguns. But if you want users to be able to connect to your Bubble app with an API key, then there’s a blueprint we recommend to avoid accidentally creating an insecure implementation. If you’re using OAuth/not giving users API tokens then you can skip this.
I’m not gonna go through every step (I’m assuming a decent understanding of Bubble) but at a high level:
First decide which type you need:
- Personal keys act as the user who created them.
- Team keys act as a team/organisation/account, not a person. Use these for shared integrations that should keep working when someone leaves (B2B SaaS is common use case here)
For both
- Store only a hash of the key, not the entire key. We don’t want to store the text of a generated key and be like
Do a search for API Tokens where key = X. If someone saw your database (e.g due to a privacy rule or logic misconfiguration) they would be able to use the keys. Instead, we ‘hash’ them. This is basically a one way text conversion - we can go from key → hash but not hash → key. So, if someone gives us a key, we can hash it, and then search our database for the key with the matching hash, without ever needing to store the original key. - do this using
:formatted as→ HMAC SHA-256 inside one backend custom event (e.g.API key - hash). That way the HMAC secret never reaches the browser. - give keys a prefix e.g.
yourapp_followed by a long random string. Your MCP proxy will be able to use the prefix to tell keys from OAuth tokens (if you’re using both auth methods), and it makes leaked keys easy to spot + revoke - Create and revoke keys in backend custom events with the permission checks inside them.
Personal keys
Let’s suppose we want tools to run as the user, so privacy rules and Current User still work. The trick is magic login links:
- The proxy sends the key to an admin-only backend workflow,
mcp-login. mcp-loginhashes the key and finds a matching API Key that isn’t revoked or expired.- It runs Send magic login link for the key’s owner with ‘Just create the link’ ticked, and returns the link.
- The proxy opens the link and uses the session cookie that Bubble sets to call your tools.
mcp-login must be admin-only, and it must return nothing for a bad key. To avoid having to do the magic login link every call you can in theory cache it for a few minutes (but a revoked key would keep working until the cache runs out unless you hook up that cache revocation logic separately).
Team keys
The proxy calls each tool with your Bubble admin token and passes the key as an api_key parameter. Each tool first calls a custom event (e.g. Fetch Organisation and Verify Key). This checks the key and returns the organisation. If the key is invalid, then tool would just stop with an error.
This is the risky one. The admin token skips privacy rules and there is no Current User, so you have to do the privacy rules’ job yourself.
Alternatively you can go the route of creating a ‘dummy’ user for each API token that is basically a special kind of bot user inside each team. This also has other benefits like being able to attribute actions to a specific API key. You’d just exclude it from user tables etc.
TLDR
Just use /mcp in Buildprint and have fun
Happy to answer questions below or hear about other people’s approaches!

