MCP Server Integration
Baasix provides two ways to integrate with AI assistants via the Model Context Protocol (MCP):
| Type | Description | Best For |
|---|---|---|
| Remote MCP | Built-in HTTP endpoint at /mcp | Production deployments, remote servers, cloud environments |
| Local MCP | Standalone @baasix/mcp npm package | Local development, Claude Desktop, offline usage |
Both provide the same 52 MCP tools for comprehensive Baasix operations.
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 Baasix MCP, 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 | 13 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 |
| Realtime | 5 tools | WAL-based realtime management |
| Settings & Utils | 7 tools | Application settings, templates, and utilities |
Remote MCP (Recommended)
The Remote MCP is built directly into the Baasix core server. It uses HTTP transport and is available at the /mcp endpoint when enabled.
Enable Remote MCP
Set the environment variable in your Baasix server:
MCP_ENABLED=trueThe MCP endpoint will be available at http://your-server:port/mcp (configurable via MCP_PATH)
Authentication
Remote MCP supports multiple authentication methods (in priority order):
-
Email/Password Headers:
X-MCP-Email: Your Baasix user emailX-MCP-Password: Your Baasix user password
-
Query Parameters:
?email=your@email.com&password=yourpasswordappended to the MCP URL (not recommended for production)
-
POST Body:
{ "email": "your@email.com", "password": "yourpassword" }in the request body
-
JWT Token:
Authorization:Bearer <your-jwt-token>
IDE Configuration
Claude Code / Anthropic CLI
Create a .mcp.json file in your project root:
Using query parameters (simplest):
{
"mcpServers": {
"baasix": {
"type": "http",
"url": "http://localhost:8056/mcp?email=admin@baasix.com&password=admin@123"
}
}
}Or using headers:
{
"mcpServers": {
"baasix": {
"type": "http",
"url": "http://localhost:8056/mcp",
"headers": {
"X-MCP-Email": "admin@baasix.com",
"X-MCP-Password": "admin@123"
}
}
}
}VS Code with GitHub Copilot
Create .vscode/mcp.json in your project:
{
"servers": {
"baasix": {
"type": "http",
"url": "http://localhost:8056/mcp",
"headers": {
"Authorization": "Bearer ${input:mcpToken}",
"X-MCP-Email": "${input:mcpEmail}",
"X-MCP-Password": "${input:mcpPassword}"
}
}
},
"inputs": [
{
"id": "mcpToken",
"type": "promptString",
"description": "JWT Token (optional if using email/password)",
"password": true
},
{
"id": "mcpEmail",
"type": "promptString",
"description": "Baasix Email"
},
{
"id": "mcpPassword",
"type": "promptString",
"description": "Baasix Password",
"password": true
}
]
}Cursor IDE
Add to your Cursor settings:
{
"mcpServers": {
"baasix": {
"type": "http",
"url": "http://localhost:8056/mcp?email=admin@baasix.com&password=admin@123"
}
}
}Local MCP
The Local MCP package runs as a standalone process on your machine. It uses stdio transport and connects to your Baasix server via HTTP internally.
Install
npm install @baasix/mcpEnvironment 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.
IDE Configuration
Claude Code / Anthropic CLI
Create a .mcp.json file in your project root:
{
"mcpServers": {
"baasix": {
"command": "npx",
"args": ["@baasix/mcp"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}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": "npx",
"args": ["@baasix/mcp"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}VS Code with GitHub Copilot
Create .vscode/mcp.json in your project:
{
"servers": {
"baasix": {
"type": "stdio",
"command": "npx",
"args": ["@baasix/mcp"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Cursor IDE
{
"mcpServers": {
"baasix": {
"command": "npx",
"args": ["@baasix/mcp"],
"env": {
"BAASIX_URL": "http://localhost:8056",
"BAASIX_EMAIL": "admin@baasix.com",
"BAASIX_PASSWORD": "admin@123"
}
}
}
}Comparison: Remote vs Local MCP
| Feature | Remote MCP | Local MCP |
|---|---|---|
| Transport | HTTP (Streamable HTTP) | stdio |
| Setup | Enable MCP_ENABLED=true on server | Install @baasix/mcp package |
| Authentication | HTTP headers, query params, or body | Environment variables |
| Best For | Cloud/remote servers, production | Local development, Claude Desktop |
| Process | Runs on Baasix server | Runs locally on your machine |
| Latency | Direct (no proxy) | Additional HTTP hop |
| Offline | Requires server connection | Can connect to local server |
Available Tools
Schema Management (13 tools)
| 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 (5 tools)
| 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 |
baasix_sort_items | Reorder items in collection |
Authentication (10 tools)
| 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 (9 tools)
| 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 (3 tools)
| Tool | Description |
|---|---|
baasix_list_files | List files with metadata |
baasix_get_file_info | Get file details |
baasix_delete_file | Delete file |
Reports & Analytics (2 tools)
| Tool | Description |
|---|---|
baasix_generate_report | Generate reports with grouping |
baasix_collection_stats | Get collection statistics |
Notifications (3 tools)
| Tool | Description |
|---|---|
baasix_list_notifications | List user notifications |
baasix_send_notification | Send notification to users |
baasix_mark_notification_seen | Mark notification as seen |
Realtime (5 tools)
| Tool | Description |
|---|---|
baasix_realtime_status | Get realtime service status |
baasix_realtime_config | Check PostgreSQL WAL configuration |
baasix_realtime_collections | List realtime-enabled collections |
baasix_realtime_enable | Enable realtime for a collection |
baasix_realtime_disable | Disable realtime for a collection |
Settings & Templates (7 tools)
| Tool | Description |
|---|---|
baasix_get_settings | Get application settings |
baasix_update_settings | Update settings |
baasix_server_info | Get server health/info |
baasix_list_templates | List email templates |
baasix_get_template | Get email template by type |
baasix_update_template | Update email template |
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"
- "Enable realtime for the orders collection"
The AI will use the appropriate MCP tools to execute these operations directly on your Baasix backend.
Resources
- GitHub Repository: github.com/baasix/baasix
- Local MCP Package: @baasix/mcp
- Sample Project: github.com/baasix/baasix/samples/sample