I came across a project called Kaluma that makes it possible to use javascript (instead of arduino) to interface with RP2040 based boards.
It looks pretty cool, it includes a REPL interface for debugging too. In short you need nodejs and can use npm packages, bundle them up (using their CLI tool) and load it unto the device after which it instantly loads up the code. At first glance it looks like there is no mqtt yet, not sure if this can be done using an npm package.