Getting Started with MCP Server
The MCP Server is an experimental, untested proof-of-concept. This feature is provided for research, prototyping, and exploration purposes only.
DO NOT use in production environments.
Key Warnings:
- No comprehensive testing has been performed
- APIs and interfaces may change without notice
- Security vulnerabilities may exist
- Performance and stability not guaranteed
- Limited error handling and recovery mechanisms
- Documentation may not reflect current implementation
By using this feature, you acknowledge these risks and agree to use it for experimental purposes only.
The Model Context Protocol (MCP) Server enables AI agents to control Brobot automations through a RESTful API. This guide will help you set up and start experimenting with the MCP server.
What is MCP Server?โ
The MCP Server acts as a bridge between AI systems and Brobot's automation capabilities:
AI Agent (GPT-4, Claude) โ MCP Server โ Brobot โ Your Application
This enables:
- ๐ค AI-Driven Control: AI agents can control automation through natural language
- ๐๏ธ Visual Feedback: Brobot provides screenshots for AI decision-making
- ๐ State-Based Automation: Leverage Brobot's reliable state management
- ๐ Request Handling: Process automation requests through REST API
This integration is a proof of concept demonstrating how AI agents could control GUI automation. It has not been tested in real-world production scenarios.
Repository Structureโ
The MCP server repository is well-organized with the following structure:
brobot-mcp-server/
โโโ mcp_server/ # FastAPI server implementation
โโโ brobot-cli/ # Java CLI bridge to Brobot
โโโ brobot_client/ # Python client library (sync + async)
โโโ examples/ # Working code examples
โ โโโ example_client.py
โโโ tests/ # Test suite with pytest
โโโ docs/ # Additional documentation
โโโ .env.example # Configuration template
โโโ docker-compose.yml # Docker deployment
โโโ Dockerfile # Container image
โโโ README.md # Project overview
Prerequisitesโ
Before starting, ensure you have:
- โ Python 3.8 or higher
- โ Java 11 or higher
- โ Brobot framework installed
- โ A GUI application to automate
- โ ๏ธ Willingness to experiment with untested software
Quick Startโ
The installation and usage instructions below are provided as-is. You may encounter issues not covered in this documentation.
1. Install MCP Serverโ
# Clone the repository
git clone https://github.com/jspinak/brobot-mcp-server.git
cd brobot-mcp-server
# Install Python dependencies
pip install -e .
You can also install the package directly from the command line after cloning:
pip install -e ".[dev]" # Include development dependencies
2. Build the CLI Bridgeโ
# Build the Java CLI that connects to Brobot
cd brobot-cli
gradle shadowJar
cd ..
3. Configure the Serverโ
Create a .env file (copy from .env.example):
# Server Configuration
MCP_HOST=0.0.0.0
MCP_PORT=8000
MCP_LOG_LEVEL=info
# Brobot CLI Configuration
BROBOT_CLI_JAR=brobot-cli/build/libs/brobot-cli.jar
JAVA_EXECUTABLE=java
CLI_TIMEOUT=30.0
# Use mock data (set to false for real Brobot integration)
USE_MOCK_DATA=false
The server includes a .env.example file with all available configuration options. Copy it to .env and adjust as needed:
cp .env.example .env
4. Start the Serverโ
Start the server using either method:
Method 1: Python module
python -m mcp_server.main
Method 2: Installed command (after pip install)
brobot-mcp-server
The server will start at http://localhost:8000.
Visit http://localhost:8000/docs for interactive API documentation (Swagger UI) or http://localhost:8000/redoc for alternative documentation.
5. Verify Installationโ
Check that the server is running correctly:
# Check health endpoint
curl http://localhost:8000/health
# Expected response:
# {"status": "ok", "brobot_connected": false, "version": "0.1.0"}
For containerized deployment, the repository includes Docker and Docker Compose configurations:
# Build and run with Docker Compose
docker-compose up
# Or build Docker image manually
docker build -t brobot-mcp-server .
docker run -p 8000:8000 brobot-mcp-server
Expect potential startup errors, missing dependencies, or configuration issues as this is experimental software.
Your First AI Automationโ
The MCP server repository includes working example code in the examples/ directory:
examples/example_client.py- Complete working example using direct API callsbrobot_client/examples/basic_usage.py- Client library basic usagebrobot_client/examples/async_example.py- Asynchronous client usage
See the examples directory for complete, tested code.
Using Python Clientโ
Install the client library from source:
# From the brobot-mcp-server repository
cd brobot_client
pip install -e .
The brobot-client package is included in the MCP server repository under the brobot_client/ directory. It provides both synchronous and asynchronous client interfaces.
Create a simple automation using the client library:
from brobot_client import BrobotClient
# Use context manager for automatic cleanup
with BrobotClient(base_url="http://localhost:8000") as client:
# Get current observation
observation = client.get_observation()
print(f"Active states: {[s.name for s in observation.active_states]}")
# Perform actions
result = client.click(image_pattern="login_button.png", confidence=0.9)
print(f"Click successful: {result.success}")
client.type_text("username@example.com")
client.click("submit_button.png")
# Wait for state transition
client.wait_for_state("dashboard", timeout=30.0)
For AI integration with the client:
from brobot_client import BrobotClient
from openai import OpenAI
# Initialize clients
with BrobotClient() as brobot:
client = OpenAI(api_key="your-api-key")
# Get current screen state
observation = brobot.get_observation()
# Ask AI what to do
response = client.chat.completions.create(
model="gpt-4",
messages=[{
"role": "user",
"content": f"I see these UI elements: {observation.active_states}. How do I log in?"
}]
)
# Execute AI-suggested actions
# (In production, parse AI response and execute appropriate actions)
brobot.click("login_button.png")
brobot.type_text("username@example.com")
brobot.click("submit_button.png")
Using Direct API Callsโ
import requests
# Get current observation
response = requests.get("http://localhost:8000/api/v1/observation")
observation = response.json()
# Execute an action
action = {
"action_type": "click",
"parameters": {
"image_pattern": "login_button.png"
}
}
response = requests.post("http://localhost:8000/api/v1/execute", json=action)
Operating Modesโ
The MCP server supports two operating modes:
Mock Mode (Default)โ
- Uses hardcoded mock data for testing
- No Brobot CLI required
- Perfect for development and testing the API
- Set
USE_MOCK_DATA=truein.env
CLI Mode (Real Brobot Integration)โ
- Connects to actual Brobot automation via Java CLI
- Requires Brobot CLI JAR to be built
- Provides real GUI automation capabilities
- Set
USE_MOCK_DATA=falsein.env
Start with Mock Mode to test the API and client library. Once comfortable, switch to CLI Mode for real automation.
Core Conceptsโ
States and Observationsโ
Brobot uses a state-based approach. The MCP server exposes:
- State Structure: The complete map of your application's states
- Observations: Current state with screenshot and confidence scores
Actionsโ
Available actions mirror Brobot's action capabilities:
click: Click on UI elementstype: Enter textdrag: Drag and dropfind: Locate UI elementsvanish: Wait for elements to disappear
Learn more about Brobot's state transitions and how actions connect states.
Integration Patternsโ
Common patterns for AI integration:
- Autonomous Agent: AI observes and acts independently
- Guided Automation: AI suggests actions for approval
- Hybrid Control: Mix manual and AI-driven steps
Next Stepsโ
All linked documentation is also experimental and may contain inaccuracies or outdated information.
- ๐ Read the API Reference for detailed endpoint documentation
- ๐ง Learn about Configuration Options
- ๐ก Explore AI Integration Examples
- ๐ Check Troubleshooting Guide if you encounter issues
Getting Helpโ
Support for this experimental feature is limited to community contributions. There are no guarantees of responses or fixes.
- GitHub Issues: Report bugs or request features
- Documentation: Full docs at brobot.dev
Feedback Welcomeโ
We need your feedback to improve this feature! If you experiment with the MCP server:
- Report any bugs or issues you encounter
- Share your use cases and integration patterns
- Suggest API improvements
- Contribute code, tests, or documentation
- Help us understand where this feature adds value
Your feedback will help determine whether this feature should be developed further, improved, or deprecated.