farmbot-agent
An MCP server and CLI for controlling FarmBot hardware, enabling AI agents to manage gardening tasks through tools like gantry movement and device status monitoring. It supports executing Lua scripts and core hardware commands like homing and emergency stops via the Model Context Protocol.
README
farmbot-agent
Agent-native CLI and MCP server for FarmBot hardware control.
Control your FarmBot from the terminal or let AI agents manage your garden through the Model Context Protocol.
Install
npm install -g farmbot-agent
Quick Start (CLI)
# Authenticate
farmbot login --email you@example.com --password yourpassword
# Check status
farmbot status
# Move the gantry
farmbot move --x 100 --y 200 --z 0
# Go home
farmbot home
# Emergency stop
farmbot e-stop
# Unlock after e-stop
farmbot unlock
# Execute Lua on device
farmbot lua 'toast("Hello from the CLI!")'
All commands support --json for structured output and --timeout <ms> (default: 30s).
Quick Start (MCP Server)
Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"farmbot": {
"command": "npx",
"args": ["-y", "farmbot-agent", "mcp"],
"env": {
"FARMBOT_TOKEN": "your-jwt-token-here"
}
}
}
}
Claude Code
claude mcp add farmbot -- npx -y farmbot-agent mcp
Environment Variable Auth
For MCP mode, set FARMBOT_TOKEN as an environment variable. Get your token:
curl -s -X POST https://my.farm.bot/api/tokens \
-H "Content-Type: application/json" \
-d '{"user":{"email":"you@example.com","password":"yourpassword"}}' \
| jq -r '.token.encoded'
MCP Tools
| Tool | Description |
|---|---|
farmbot_status |
Device status: position, state, firmware |
farmbot_get_position |
Current X, Y, Z position (lightweight) |
farmbot_get_device_info |
Device config and identification |
farmbot_move |
Move gantry to absolute or relative position |
farmbot_home |
Home one or all axes |
farmbot_emergency_stop |
Immediately halt all movement |
farmbot_unlock |
Unlock after emergency stop |
farmbot_lua |
Execute Lua code on the device |
MCP Resources
| URI | Description |
|---|---|
farmbot://device/status |
Current device state as JSON |
CLI Commands
| Command | Description |
|---|---|
farmbot login |
Authenticate and store token |
farmbot logout |
Remove stored token |
farmbot status |
Show device status |
farmbot move |
Move to position (--x, --y, --z, --speed, --relative) |
farmbot home |
Go home (--axis, --speed) |
farmbot e-stop |
Emergency stop |
farmbot unlock |
Unlock after e-stop |
farmbot lua <code> |
Execute Lua on device |
How It Works
farmbot-agent
├── CLI (Commander) → Human-friendly terminal commands
├── MCP Server (stdio) → AI agent tool interface
└── Shared Services → farmbot-js (MQTT) + FarmBot REST API
FarmBot communication uses MQTT over the farmbot npm package. Commands are sent as CeleryScript RPC requests and responses are matched by UUID. The JWT token contains MQTT broker credentials.
Safety
- Coordinate bounds validation on all movement commands
- Rate limiting: max 30 move commands per minute (prevents runaway agent loops)
- Emergency stop is always available with short timeout
- Structured errors with codes, retry hints, and recovery suggestions
Development
git clone https://github.com/kieranklaassen/farmbot-agent
cd farmbot-agent
npm install
npm run build
npm test
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.