Developer Tools: CLI, SDK, MCP Introduction
Learn about the five core tools provided by Rabetbase and how they work together to improve development efficiency by more than 10x.
Tool Suite Overview
Rabetbase provides a complete toolchain for developers:
| Tool | One-Line Description | Core Value |
|---|---|---|
| OpenAPI | Standard HTTP Interface | Cross-language calls, third-party system integration, no SDK dependency |
| CLI | Project Lifecycle Management | Create projects, generate config, sync menus, build and deploy |
| TypeScript SDK | Frontend Data Access | Type safety, unified error handling, efficient queries |
| Java SDK | Backend Data Access | Server-side complex business logic development |
| MCP Server | AI Business Intelligence Engine | Enable AI to understand your business data and generate accurate code |
Core Advantage: The five tools are deeply integrated, covering complete scenarios from API calls to AI-assisted development.
OpenAPI: Standard HTTP Interface
If you don't want to depend on any SDK, or need to call from Python, Go, PHP, etc., OpenAPI is the most direct choice.
curl -X POST https://runtime.lovrabet.com/openapi/data/get-list \
-H "Content-Type: application/json" \
-H "X-Time-Stamp: 1758903130713" \
-H "X-App-Code: your-app-code" \
-H "X-Dataset-Code: your-dataset-code" \
-H "X-Token: your-signed-token" \
-d '{"appCode": "your-app-code", "datasetCode": "your-dataset-code", "paramMap": {"pageSize": 10}}'
OpenAPI uses signature authentication (X-Header method), supports AccessKey and pre-generated Token modes. Any language that can send HTTP requests can use it. For detailed authentication instructions, refer to the OpenAPI Authentication Guide.
CLI: Project Lifecycle Management
# Install
npm install -g @lovrabet/cli
# Common commands
lovrabet auth # Login authentication
lovrabet create # Create project
lovrabet start # Start development server
lovrabet api pull # Pull dataset config, generate SDK code
lovrabet menu sync # Sync menus to workspace
lovrabet build # Build production version
What CLI does for you:
- One-click project structure creation, no need to configure from scratch
- Auto-generate SDK config, no need to manually write type definitions
- Sync menus to workspace, no need to manually add in the backend
- Built-in proxy in dev server, no need to handle CORS issues
TypeScript SDK: Frontend Data Access
import { lovrabetClient } from '@/api/client';
// List query (with filtering, pagination)
const result = await lovrabetClient.models.customers.filter({
where: { status: { $eq: 'active' } },
select: ['id', 'name', 'phone'],
orderBy: [{ createTime: 'desc' }],
pageSize: 20,
});
// Single record query
const customer = await lovrabetClient.models.customers.getOne(customerId);
// Create data
await lovrabetClient.models.customers.create({
name: 'Zhang San',
phone: '13800138000',
});
// Custom SQL (complex reporting scenarios)
const stats = await lovrabetClient.api.executeSql('sql-code-xxx', {
startDate: '2024-01-01',
endDate: '2024-12-31',
});
What TypeScript SDK does for you:
- Type safety with IDE intelligent autocomplete
- Unified error handling, no need to write try-catch everywhere
- Auto authentication, browser automatically uses Cookie
- Built-in pagination, filtering, sorting - no manual parameter concatenation
Java SDK: Backend Data Access
// Initialize client
LovrabetClient client = new LovrabetClient(accessKey, secretKey);
// List query
FilterResult<Customer> result = client.models("customers")
.filter(new FilterParams()
.where("status", "active")
.select("id", "name", "phone")
.orderBy("createTime", "desc")
.pageSize(20));
// Single record query
Customer customer = client.models("customers").getOne(customerId);
// Create data
client.models("customers").create(new Customer("Zhang San", "13800138000"));
What Java SDK does for you:
- Secure server-side calls, keys not exposed to frontend
- Complex business logic handling like batch operations, transaction management
- Seamless integration with existing Java ecosystem
- Suitable for scheduled tasks, backend services, etc.
MCP: AI's Business Intelligence Brain
Traditional AI can only "read documentation," knowing field names but not understanding business relationships.
MCP enables AI to "understand business," knowing relationships between tables, business meaning of fields, and data flow rules.
Configure MCP
Configure in Claude Desktop or Cursor:
{
"mcpServers": {
"lovrabet-dataset": {
"command": "npx",
"args": ["-y", "@lovrabet/dataset-mcp-server"],
"env": {
"LOVRABET_APP_CODE": "your-app-code"
}
}
}
}
What Can MCP Do?
After configuration, you can directly converse with AI:
You: List all datasets
AI: (calls MCP) Your application has 8 datasets...
You: View fields of customer table
AI: (calls MCP) The customer table has the following fields: id, name, phone...
You: Help me write a customer list page
AI: (calls MCP to understand data structure) Sure, I'll generate the code...
Efficiency Comparison
| Scenario | Traditional AI Development | Using MCP |
|---|---|---|
| Data Exploration | 20-30 min (check docs, test APIs) | < 5 sec |
| SQL Design | 30-60 min (repeated debugging) | < 2 min |
| Code Generation | 20-30 min (multiple iterations) | 5 min |
| Complete Page | 2-3 hours | 10-15 min |
Code Accuracy:
- Traditional AI: 60-70% (requires multiple iterations)
- Using MCP: 95%+ (basically one-pass success)
How the Five Tools Work Together
┌─────────────────────────────────────────────────────────────────┐
│ Before Development │
│ 1. lovrabet create → Create project │
│ 2. lovrabet api pull → Generate SDK config │
│ 3. Configure MCP → Enable AI to understand your data │
├─────────────────────────────────────────────────────────────────┤
│ During Development │
│ 4. AI + MCP → Explore data, generate code │
│ 5. SDK calls → Type-safe data operations │
│ 6. lovrabet start → Real-time preview debugging │
├─────────────────────────────────────────────────────────────────┤
│ After Development │
│ 7. lovrabet build → Build production version │
│ 8. lovrabet menu sync → Sync menus to workspace │
└─────────────────────────────────────────────────────────────────┘
Real-World Example: User List Page
Requirement: Display user list with basic info + membership tags + last login time (requires joining 3 tables)
Traditional Approach
- Check docs for field names → guessed wrong → check again
- Write SQL → wrong JOIN syntax → revise
- Write code → typo in field name → fix
- Repeat 4-5 rounds → Takes 2-3 hours
Using MCP
You: I need a user list page showing user basic info, membership tags, last login time
AI: (calls MCP to analyze)
- user_info table: basic information
- user_membership table: membership info
- user_login_log table: login records
I'll help you write a join query...
(Generates complete code, field names 100% accurate)
Time: 10 minutes
End-to-End Example: Order Management System
Below demonstrates how to combine all tools through a complete order management scenario.
Scenario Requirements
Develop an order management page that needs to:
- Display order list with status filtering
- Click order to view details
- Support Excel export
- Complex reporting: monthly sales statistics by customer
Development Process
Step 1: Environment Setup (CLI)
# 1. Install and login
npm install -g @lovrabet/cli
lovrabet auth
# 2. Create project
lovrabet create order-management
# 3. Generate SDK config
cd order-management
lovrabet api pull --appcode your-app-code
Step 2: Configure AI Assistance (MCP)
Configure MCP in Cursor:
{
"mcpServers": {
"lovrabet-dataset": {
"command": "npx",
"args": ["-y", "@lovrabet/dataset-mcp-server"],
"env": {
"LOVRABET_APP_CODE": "your-app-code"
}
}
}
}
Step 3: Collaborate with AI
Conversation Example:
You: Help me see what datasets are available?
AI: (calls list_datasets) Your application has the following datasets:
- orders (order table)
- customers (customer table)
- products (product table)
- order_items (order items table)
You: View the field structure of orders table
AI: (calls get_dataset_detail) The orders table has the following fields:
- id: Order ID (primary key)
- customer_id: Customer ID (linked to customer table)
- order_date: Order date
- status: Order status (enum: pending/paid/shipped/completed)
- total_amount: Order amount
...
You: Help me generate code for the order list page with status filtering
AI: (calls generate_sdk_code) Sure, I'll generate the code...
Step 4: Implement Complex Reports (SQL + SDK)
For complex reports like "monthly sales statistics by customer", use custom SQL:
// 1. First let AI help you design the SQL
// You: Help me write a SQL for monthly sales statistics by customer
// 2. After AI generates SQL, save to platform
// You: Save this SQL with name "Customer Monthly Sales Stats"
// 3. Call it in your code
const monthlyStats = await client.sql.execute({
sqlCode: 'customer-monthly-stats',
params: { year: 2024, month: 1 }
});
if (monthlyStats.execSuccess) {
console.log('Statistics data:', monthlyStats.execResult);
}
Step 5: Build and Deploy (CLI)
# Build
lovrabet build
# Deploy to CDN (example using Alibaba Cloud OSS)
ossutil cp -r dist/ oss://your-bucket/order-management/
# Sync menu to workspace
lovrabet menu sync
Tool Usage Summary
| Requirement | Tool Used | Description |
|---|---|---|
| Project Setup | CLI | lovrabet create + api pull |
| Understand Data Structure | MCP | Let AI automatically get table structure |
| Generate Code | MCP + SDK | AI generates SDK call code |
| Basic CRUD | SDK | filter() / getOne() / create() |
| Complex Queries | SQL + SDK | Custom SQL + sql.execute() |
| Export Feature | SDK | excelExport() method |
| Deploy to Production | CLI | build + menu sync |
Next Steps
- Step-by-Step Guide - Complete process from scratch
- OpenAPI Documentation - HTTP API details
- CLI Command Reference - All commands detailed
- TypeScript SDK Guide - Frontend data operations
- Java SDK Guide - Backend data operations
- MCP Configuration Guide - AI-assisted development setup