You have no idea how to program for Android. Java looks like Chinese to you, Kotlin isn't much better, and Android Studio weighs in at 15 GB and greets you with four error windows before you've written a single line. MCP-B4A is an MCP server that connects Claude Code directly to the B4A (Basic4Android) IDE: you tell it what you want, and it does it. From the first screen to the signed APK ready to install. The project is at github.com/unmateria/MCP-B4A.
01 — The problem: Android development has a brutal learning curve
You have an idea for an app. A dashboard showing your temperature sensors' data over MQTT. A clock-in app for work. A small game. A client for your homemade API. Nothing groundbreaking — functional, useful, yours.
And then you run into the official Android ecosystem. Java or Kotlin, Gradle, Jetpack Compose or XML, Fragments, Activities, Intents, the Activity lifecycle, runtime permissions, signing, ADB, Logcat… Everything you want to do requires understanding ten prerequisite concepts first. Android Studio needs a powerful machine just to start up. The official docs assume you already know half of what you're looking for. Gradle errors are incomprehensible. The APK you build on your laptop won't install on your phone because it isn't signed. The phone doesn't show up in ADB because developer options aren't enabled. And when you finally get something installed, the layout doesn't look the way you expected because you also need to learn about screen sizes and pixel densities.
All of that is real, and it's a wall. For a lot of people coming from microcontroller programming, Python scripting or visual tools, that wall is enough to make them give up. Which is a shame, because the idea was good.
02 — B4A: the bridge between the Arduino world and the Android world
B4A (Basic4Android) is a development environment that has spent more than fifteen years doing one thing: lowering the barrier to Android development until it's within reach of anyone who can code a little. Its language is a modern Basic — not the Basic of the 80s, but something closer to VB.NET without the weight of Visual Studio. A lightweight IDE, readable syntax, fast builds, clear documentation. It was born as a tool for makers and hardware people — the crowd coming from Arduino, Raspberry Pi, ESP8266 — who wanted to build the Android app that accompanies their gadget without losing their minds.
B4A generates real Java code underneath and produces APKs that install on any Android device. It's not a toy environment: there are production apps, industrial systems and production dashboards built with B4A. But the developer sees Basic, not Java. That changes the experience completely.
MCP-B4A takes it one step further: it doesn't just lower the barrier down to Basic, but down to natural language. You tell it what you want and it writes the Basic, designs the layout, builds and sends the result to your phone.
03 — What an MCP is and why it changes the rules
MCP (Model Context Protocol) is Anthropic's standard for letting AI assistants use real tools. Instead of asking Claude to write you code to copy and paste, MCP gives the model a direct channel to the program: Claude calls the tools and the server acts on the system. The result is that when you say "add a button that opens the second panel", Claude doesn't write the code for you — it drops it straight into the project's .bas file and builds it.
MCPs are tool-specific. There's one for GitHub, one for Access, one for Figma, one for PostgreSQL databases. MCP-B4A is the one that talks directly to the B4A IDE: it can open projects, read and write modules, handle the layout editor, build, sign APKs, install them on the connected phone and read the Logcat in real time to debug errors. The full loop, without leaving the chat.
04 — What MCP-B4A lets you do: 31 tools
The 31 tools are grouped into blocks that cover the whole Android development cycle:
- Configuration: read and write the B4A project configuration.
- Build and deployment: build the project, install the resulting APK on the connected device, retrieve the build log including errors, access the APK's signing information.
- Project management: read the project's metadata, list the files that make it up, access recent projects.
- Layouts: convert B4A's binary layout files to JSON and back. This one is key — B4A layouts are binary by default and Claude can't read them directly; the MCP does the translation so the model can design the interface without touching it by hand.
- Libraries: list the libraries available in the B4A installation, retrieve their documentation and search for specific references inside them.
- Code modules: read and edit
.basfiles with search and replace, without having to rewrite the whole module every time. - Manifest: read and update the AndroidManifest — permissions, activities, hardware configuration — without editing it by hand.
- Device interaction: capture the phone's screen, scan pixel values, send taps, swipes, text and keyboard input, launch apps. The full visual loop: Claude sends a tap, requests a screenshot, sees how it turned out and corrects it.
- Sprite tools: clean up PNG artifacts in sprites generated for games.
- ADB and debugging: read the Logcat in real time, list connected devices.
The detail that makes the real difference over simply asking Claude to write B4A code for you is that the server closes the loop: it builds, sees the error in the log, fixes it, rebuilds, installs on the phone, taps, captures the screen, adjusts the layout. All without leaving the chat, without copying and pasting, without switching windows.
05 — Step-by-step installation
The server is written in C# on .NET 8 and runs on Windows — B4A itself only runs on Windows, so that's no extra restriction. You need to have installed:
- B4A IDE with your license. If you don't have it, the paid version is at b4x.com; there's also a free version with some limitations.
- Android SDK with the platform-tools (ADB). B4A installs it on its own during initial setup, so if you already have B4A working, this is already covered.
- .NET 8 Runtime. If you don't have it, the Windows installer detects that and redirects you to download it.
- Claude Code or another MCP-compatible editor.
Clone the repository or download the ZIP:
git clone https://github.com/unmateria/MCP-B4A.git C:\herramientas\MCP-B4A
Build the server with .NET:
cd C:\herramientas\MCP-B4A dotnet build --configuration Release
The executable ends up in bin\Release\net8.0\. That's the path you'll use to register it in Claude Code.
06 — Connecting the MCP to Claude Code
With the server built, register it in Claude Code from PowerShell:
claude mcp add b4a -- C:\herramientas\MCP-B4A\bin\Release\net8.0\MCP-B4A.exe
Adjust the path to wherever you built it. If you'd rather have it active only in a specific project instead of in every session:
claude mcp add --scope project b4a -- C:\herramientas\MCP-B4A\bin\Release\net8.0\MCP-B4A.exe
To check it's connected properly, open Claude Code and ask it something like "list the B4A MCP's tools". If everything's fine you'll see the 31 tools starting with b4a_. If they don't show up, the usual culprit is that the executable isn't at the path given, or that the .NET 8 Runtime is missing.
Before you start working, tell Claude to read the project configuration with b4a_get_config so it knows where B4A and the SDK are installed. That initial read is what orients the server for the rest of the session.
07 — Building an app from scratch by talking to it
With the MCP active, the workflow changes completely. You don't open the IDE. You don't hunt for examples on Stack Overflow. You don't copy and paste code. You talk to it.
For example, an MQTT dashboard to view temperature data from several ESP8266 sensors:
Build me an Android app that connects to an MQTT broker at 192.168.1.100 port 1883 and subscribes to the topics sensores/salon, sensores/cocina and sensores/dormitorio. I want to see the three values on screen, updated in real time, with the sensor name and the temperature in large text. Dark background.
Claude creates the project, adds B4A's MQTT library, writes the connection module, designs the layout with the three panels and the temperature labels, and builds it. If something fails at build time, it reads the error log, identifies it and fixes it. Without you ever touching the IDE.
The same approach for a clock-in app:
Build me an app for clocking in and out at work. Clock-in button and clock-out button. It should save each entry to a CSV file in the phone's storage with the date and time. And a screen to see the month's clock-in history.
Or a simple video game:
Build me an obstacle-dodging game. A character that jumps with a tap, obstacles coming in from the right, a score counter. Landscape orientation.
For each of these cases, MCP-B4A takes care of picking the right libraries, writing the logic, putting together the layouts and building. You check the result, ask for adjustments in plain language, and the cycle repeats until it looks the way you want.
08 — Debugging and device interaction
What makes MCP-B4A especially powerful compared to just asking Claude to write B4A code is the debugging loop. When something doesn't work as expected, you don't have to read the Logcat yourself, interpret the error, find which line it's on, fix it and rebuild. Claude does it:
- Builds and installs the app on the connected phone.
- Launches the app with
b4a_launch_app. - Reads the Logcat with
b4a_get_logcatto check for errors or exceptions. - If there's a crash, it identifies the cause in the log, fixes the corresponding
.basmodule and rebuilds. - Captures a screenshot with
b4a_screenshotto see how it looks visually. - If the layout isn't what you expected, it adjusts the controls and captures again.
The interaction loop goes further. Claude can send taps to the phone to navigate through the app, enter text into fields, swipe to scroll lists. It can use b4a_pixel_scan to verify that a specific color or element appears in the right position. It's the equivalent of a manual tester, but automated and responding to plain-language instructions.
For layout work, the MCP converts B4A's binary files to JSON with b4a_read_layout, Claude edits them in JSON (adding controls, changing properties, adjusting positions) and writes them back as binary with b4a_write_layout. From the IDE's point of view, it's as if you'd edited them in the visual designer.
09 — Who this is for
MCP-B4A has two quite different user profiles:
- The maker coming from hardware — Arduino, ESP8266, ESP32, Raspberry Pi — who wants the Android app that closes the loop on their system. The one with a working temperature sensor but no screen to view it from their phone. The one with a relay controlled over MQTT but no Android button to trigger it. B4A has a huge community in exactly this profile, and MCP-B4A lowers the bar from "I need to learn B4A" to "I just tell it what I want".
- The one with an idea and zero desire to learn Android. The clock-in app for the company, the catalog app for customers, the dashboard to check the business's numbers from the phone. Useful, functional things that don't need to be published on the Play Store or pass a review. An APK that installs on the company phone and that's it.
What it's not: a solution for publishing Play Store apps that compete with professional teams. B4A has limitations — not every Android API is wrapped, performance in complex graphics isn't that of native code — and MCP-B4A inherits those limitations. For internal use, prototypes, automation, dashboards and in-house tools, it's more than enough. To compete with Instagram, no.
The project is active and extensively tested in real environments. It's not an academic demo — it grew out of building things that were actually needed. When something doesn't work, an issue gets opened and it gets fixed. github.com/unmateria/MCP-B4A.