MBotMcp logo

MBotMcp

by deemkeen

This project demonstrates how to control an mBot2 robot using Spring AI and Model Context Protocol (MCP). AI models can control a physical robot through simple natural language commands.

View on GitHub

Last updated: N/A

What is MBotMcp?

MBotMcp is a system that allows AI models to control an mBot2 robot through natural language commands. It utilizes a Spring Boot application implementing the Model Context Protocol (MCP), an MQTT broker for message passing, and Python code running on the mBot2.

How to use MBotMcp?

To use MBotMcp, you need to set up an MQTT broker, configure the Spring Boot application with MQTT credentials, upload the provided Python script to your mBot2 (modifying it with your WiFi and MQTT configurations), build the Spring Boot application using Maven, and then run the test client to verify the setup. Finally, you can integrate with LLM clients that support MCP to control the robot with natural language.

Key features of MBotMcp

  • AI-driven robot control

  • Natural language command interface

  • Spring AI integration

  • Model Context Protocol (MCP) support

  • MQTT-based communication

  • mBot2 compatibility

Use cases of MBotMcp

  • Educational robotics projects

  • AI-powered automation

  • Remote robot control

  • Experimentation with AI and physical systems

  • Demonstrating AI capabilities with hardware

FAQ from MBotMcp

What is the Model Context Protocol (MCP)?

MCP is a protocol that allows AI models to interact with external systems, such as robots, by providing a standardized way to define and call functions.

What is MQTT and why is it used?

MQTT is a lightweight messaging protocol used for machine-to-machine (M2M) communication. It's used here to relay commands between the Spring Boot application and the mBot2 robot.

What are the prerequisites for running this project?

You need Java 21, Maven, an mBot2 robot and mBlock IDE, an MQTT broker, and basic Java knowledge.

How do I connect my mBot2 to WiFi?

You need to modify the Python script in the /assets directory with your WiFi SSID and password and then upload the script to your mBot2 using the mBlock IDE.

Can I use this with other robots?

While this project is specifically designed for the mBot2, the underlying principles and architecture could be adapted for use with other robots that support MQTT communication and can be controlled programmatically.