Spring Boot MCP server for controlling an mBot2 robot via MQTT

Spring Boot MCP server for controlling an mBot2 robot via MQTT

mbotmcp•bydeemkeen

A Spring Boot application that implements the Model Context Protocol, exposing robot control commands as AI-callable tools that relay instructions over MQTT to an mBot2 robot.

License: MIT License•Runtime: Awaiting documentation review•Category: ai agents-models

WHAT IT DOES

  • •Implements the Model Context Protocol in a Spring Boot application and exposes robot commands as tools using the @Tool annotation.
  • •Provides MCP tools for robot actions including explore, stop, beep, left, right, forward and backward.
  • •Relays commands to the robot over MQTT for execution.

BEST FOR

  • •Controlling an mBot2 robot with natural language requests from MCP-capable AI clients.
  • •Experimenting with LLM-driven physical robot behaviors such as exploring a room or making the robot beep.

ABOUT MBOTMCP

Spring Boot MCP server for controlling an mBot2 robot via MQTT is cataloged as an MCP server attributed to deemkeen. A Spring Boot application that implements the Model Context Protocol, exposing robot control commands as AI-callable tools that relay instructions over MQTT to an mBot2 robot. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Spring Boot MCP server for controlling an mBot2 robot via MQTT are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How do AI commands reach the robot?

When an AI invokes a tool through the MCP server, the command is sent via MQTT to the robot, which executes it based on the received message.

Upstream README

View this exact version on GitHub

README.md · fc91d7341ed9 · Fetched 2026-11-13 10:29:41 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

MBotMcp

https://github.com/user-attachments/assets/a11d68c5-dc52-4dab-9741-bc1cf47e2ec9

This project demonstrates how to control an mBot2 robot using Spring AI and Model Context Protocol (MCP). With this setup, AI models can control a physical robot through simple natural language commands like "explore" or "turn left".

Overview

The system consists of:

  1. A Spring Boot application that implements the Model Context Protocol
  2. An MQTT broker for message passing
  3. Python code running on the mBot2 robot
  4. AI client integration capabilities

The Spring application exposes robot control commands as AI-callable functions, allowing AI models to control the physical robot through natural language.

Prerequisites

  • Java 21
  • Maven
  • mBot2 robot and mBlock IDE
  • MQTT broker (can run in Docker)
  • Basic Java knowledge

Setup Instructions

1. MQTT Broker Setup (Optional, if you don't have one)

Run the included Docker Compose file to set up the MQTT broker:

cd mbotmcp/assets
docker-compose up -d

This creates a message queue that will relay commands between your app and robot.

2. Configure Spring Boot Application

Set the following environment variables:

MQTT_USERNAME=your_username # leave blank if not configured
MQTT_PASSWORD=your_password # leave blank if not configured
MQTT_SERVER_URI=tcp://your_server:1883

These tell your app how to connect to the MQTT broker.

3. mBot2 Setup

To upload the Python script to your mBot2:

  1. Connect your mBot2 to your computer via USB
  2. Open the mBlock IDE on your computer
  3. Click on the "File" menu and select "Open"
  4. Navigate to the /assets directory in the repository
  5. Open the mbot-mqtt.py file
  6. Modify the script to include your personal WiFi and MQTT configurations:
    ssid = "<your wifi ssid>"
    ssid_password = "<your wifi password>"
    mqtt_ip = "<ip of the mqtt broker>"
    mqtt_port = 1883
    mqtt_user = "<your mqtt username>"
    mqtt_password = "<your mqtt password>"
    
  7. Upload the script to your mBot2
  8. Power on your mBot2

4. Build the Spring Boot App

mvn clean package

Testing the Setup

  1. Ensure your MQTT broker is running
  2. Power on your mBot2 and ensure it's connected to WiFi
  3. Run the test client:
    mvn test -Dtest=ClientStdioTest
    
  4. Watch your robot perform the "beep" command with blue LED lights!

Available Robot Commands

The BotService class defines all the MCP tools, your robot can understand:

  • mbotExplore() - Execute the 'explore' routine
  • mbotStop() - Stop the robot
  • mbotBeep() - Make the robot beep
  • mbotLeft() - Turn the robot left
  • mbotRight() - Turn the robot right
  • mbotForward() - Move the robot forward
  • mbotBackward() - Move the robot backward

Integration with AI Models

Once everything is working, you can integrate with LLM clients that support MCP. Personally, I would recommend Goose for this purpose. Just point these clients to your server, and they can autonomously control your robot based on natural language requests.

Example natural language commands:

  • "Explore the room"
  • "Turn right and go forward"
  • "Make a beep sound"

How It Works

  1. The Spring application exposes robot commands as tools using the @Tool annotation
  2. The MCP server in Spring connects these tools to the outside world
  3. When an AI wants to control your robot, it calls these methods through the protocol
  4. Commands are sent via MQTT to the robot
  5. The robot executes the commands based on the received message

Disclaimer

If your robot starts planning world domination, the author accepts no responsibility. Just unplug it and run! 😂

License

MIT License

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Spring Boot MCP server for controlling an mBot2 robot via MQTT from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mbotmcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related ai agents-models MCP Servers

Alternative and complementary servers in the same category

View all in ai agents-models →
Knowledge Graph Memory
@modelcontextprotocol/server-memory•Model Context Protocol

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

create_entitiescreate_relationsadd_observations+6 more
92K
AI & Multi-Agent
Sequential Thinking
@modelcontextprotocol/server-sequential-thinking•Model Context Protocol

Organize problem solving into revisable, branching thought steps through an MCP tool.

sequential_thinking
92K
AI & Multi-Agent

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.

146
AI & Multi-Agent