MCP Server Integration
The Baasix MCP Server provides a Model Context Protocol (MCP) interface that enables AI assistants to interact directly with your Baasix backend. This allows AI tools like Claude, GitHub Copilot, and Cursor to manage schemas, perform CRUD operations, handle permissions, and more.
What is MCP?
The Model Context Protocol (MCP) is an open standard that allows AI assistants to connect with external tools and data sources. With the Baasix MCP Server, you can:
- Create and manage database schemas using natural language
- Perform CRUD operations on your data
- Manage permissions and roles for your application
- Query data with powerful filtering and aggregation
- Handle authentication and user management
- Upload and manage files
Features
| Category | Tools | Description |
|---|---|---|
| Schema Management | 12 tools | Create, update, delete collections and relationships |
| Item Management | 5 tools | Full CRUD with 50+ filter operators |
| Authentication | 10 tools | Login, register, magic links, invitations |
| Permissions | 9 tools | Role-based access control management |
| File Management | 3 tools | Upload, list, and manage files |
| Reports & Analytics | 2 tools | Generate reports with grouping |
| Notifications | 3 tools | User notification system |
| Settings & Utils | 4 tools | Application settings and utilities |
Quick Start
1. Install the MCP Server
npm install @tspvivek/baasix-mcp-server2. Create MCP Server Entry Point
Create a mcp-server.js file in your project:
import { startMCPServer } from "@tspvivek/baasix-mcp-server";
if (import.meta.url === `file://${process.argv[1]}`) {
startMCPServer().catch((error) => {
console.error('Failed to start MCP server:', error);
process.exit(1);
});
}3. Configure Your AI Tool
Choose the configuration for your preferred AI tool below.
IDE Configuration
Claude Code / Anthropic CLI
Create a .mcp.json file in your project root:
{
"mcpServers": {
"baasix": {
"command": "node",
"args": ["./mcp-server.js"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Or add via CLI:
claude mcp add baasix npm run startVS Code with GitHub Copilot
Create .vscode/mcp.json in your project:
{
"servers": {
"baasix": {
"type": "stdio",
"command": "node",
"args": ["./mcp-server.js"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
},
"inputs": []
}Claude Desktop
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"baasix": {
"command": "node",
"args": ["/path/to/your/project/mcp-server.js"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Cursor IDE
Add to your Cursor settings or project configuration:
{
"mcpServers": {
"baasix": {
"command": "node",
"args": ["./mcp-server.js"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Using npx (No Installation)
You can also run the MCP server directly with npx:
{
"mcpServers": {
"baasix": {
"command": "npx",
"args": ["@tspvivek/baasix-mcp-server"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
BAASIX_URL | Yes | http://localhost:8056 | Baasix server URL |
BAASIX_AUTH_TOKEN | No* | - | Pre-obtained JWT token |
BAASIX_EMAIL | No* | - | Email for auto-authentication |
BAASIX_PASSWORD | No* | - | Password for auto-authentication |
*Either BAASIX_AUTH_TOKEN OR both BAASIX_EMAIL and BAASIX_PASSWORD must be provided.
Available Tools
Schema Management
| Tool | Description |
|---|---|
baasix_list_schemas | List all collections with search/pagination |
baasix_get_schema | Get detailed schema for a collection |
baasix_create_schema | Create a new collection schema |
baasix_update_schema | Update existing schema |
baasix_delete_schema | Delete a collection schema |
baasix_add_index | Add index to collection |
baasix_remove_index | Remove index from collection |
baasix_create_relationship | Create M2O/O2M/M2M/M2A relationship |
baasix_update_relationship | Update existing relationship |
baasix_delete_relationship | Delete a relationship |
baasix_export_schemas | Export all schemas as JSON |
baasix_import_schemas | Import schemas from JSON |
Item Management
| Tool | Description |
|---|---|
baasix_list_items | Query items with filters, sort, pagination |
baasix_get_item | Get specific item by ID |
baasix_create_item | Create new item |
baasix_update_item | Update existing item |
baasix_delete_item | Delete item |
Authentication
| Tool | Description |
|---|---|
baasix_auth_status | Check authentication status |
baasix_refresh_auth | Refresh authentication token |
baasix_register_user | Register new user |
baasix_login | Login with email/password |
baasix_logout | Logout current user |
baasix_get_current_user | Get current user info |
baasix_send_invite | Send user invitation |
baasix_verify_invite | Verify invitation token |
baasix_send_magic_link | Send magic link/code |
baasix_get_user_tenants | Get user's available tenants |
baasix_switch_tenant | Switch tenant context |
Permissions
| Tool | Description |
|---|---|
baasix_list_roles | List all roles |
baasix_list_permissions | List all permissions |
baasix_get_permission | Get permission by ID |
baasix_get_permissions | Get permissions for a role |
baasix_create_permission | Create new permission |
baasix_update_permission | Update permission |
baasix_delete_permission | Delete permission |
baasix_update_permissions | Bulk update role permissions |
baasix_reload_permissions | Reload permission cache |
File Management
| Tool | Description |
|---|---|
baasix_list_files | List files with metadata |
baasix_get_file_info | Get file details |
baasix_delete_file | Delete file |
Reports & Analytics
| Tool | Description |
|---|---|
baasix_generate_report | Generate reports with grouping |
baasix_collection_stats | Get collection statistics |
Notifications
| Tool | Description |
|---|---|
baasix_list_notifications | List user notifications |
baasix_send_notification | Send notification to users |
baasix_mark_notification_seen | Mark notification as seen |
Settings & Utilities
| Tool | Description |
|---|---|
baasix_get_settings | Get application settings |
baasix_update_settings | Update settings |
baasix_server_info | Get server health/info |
baasix_sort_items | Reorder items in collection |
Filter Operators
When using baasix_list_items, the filter parameter supports 50+ operators:
Comparison Operators
{"field": {"eq": "value"}} // Equal
{"field": {"neq": "value"}} // Not equal
{"field": {"gt": 100}} // Greater than
{"field": {"gte": 100}} // Greater than or equal
{"field": {"lt": 100}} // Less than
{"field": {"lte": 100}} // Less than or equalString Operators
{"field": {"contains": "text"}} // Contains substring
{"field": {"icontains": "text"}} // Contains (case-insensitive)
{"field": {"startswith": "pre"}} // Starts with
{"field": {"like": "pat%tern"}} // SQL LIKE pattern
{"field": {"regex": "^\\d+$"}} // Regular expressionList Operators
{"field": {"in": ["a", "b", "c"]}} // In list
{"field": {"nin": ["x", "y"]}} // Not in list
{"field": {"between": [10, 100]}} // Between rangeArray Operators (PostgreSQL)
{"tags": {"arraycontains": ["a", "b"]}} // Contains all elements
{"tags": {"arraycontainsany": ["a", "b"]}} // Contains any element
{"tags": {"arraylength": 3}} // Array has exact lengthJSONB Operators (PostgreSQL)
{"meta": {"jsoncontains": {"key": "val"}}} // JSON contains
{"meta": {"jsonhaskey": "key"}} // Has key
{"meta": {"jsonpath": "$.store.book[0]"}} // JSONPath queryLogical Operators
{"AND": [{"status": {"eq": "active"}}, {"price": {"lt": 100}}]}
{"OR": [{"type": {"eq": "A"}}, {"type": {"eq": "B"}}]}
{"NOT": {"deleted": {"eq": true}}}Dynamic Variables
{"author_Id": {"eq": "$CURRENT_USER"}} // Current user's ID
{"createdAt": {"gte": "$NOW-DAYS_7"}} // 7 days ago
{"dueDate": {"lte": "$NOW+MONTHS_1"}} // 1 month from nowFor the complete list of 50+ operators, see the Complete Filter Reference.
Example Usage
Once configured, you can ask your AI assistant to:
- "Create a products collection with name, price, and description fields"
- "Add a category relationship to the products collection"
- "List all products where price is greater than 100"
- "Create a new user role with read-only access to products"
- "Show me the server health status"
The AI will use the appropriate MCP tools to execute these operations directly on your Baasix backend.
Sample Project
The Baasix Sample Project includes pre-configured MCP files:
.mcp.json— Claude Code / Anthropic CLI configuration.vscode/mcp.json— VS Code / GitHub Copilot configurationmcp-server.js— MCP server entry point
Resources
- GitHub Repository: github.com/tspvivek/baasix-mcp-server
- npm Package: @tspvivek/baasix-mcp-server
- Sample Project: github.com/tspvivek/baasix-sample