Skip to content

Overview

Fluxbase includes a built-in MCP (Model Context Protocol) server that enables AI assistants like Claude to interact with your database, storage, functions, and jobs.

The MCP server exposes Fluxbase functionality through a standardized JSON-RPC 2.0 protocol, allowing AI assistants to:

  • Query and modify database tables (with Row Level Security)
  • Upload, download, and manage storage files
  • Invoke edge functions and RPC procedures
  • Submit and monitor background jobs
  • Search vector embeddings for RAG applications

Enable the MCP server in your fluxbase.yaml:

mcp:
enabled: true
base_path: /mcp
session_timeout: 3600s
max_message_size: 10485760 # 10MB
rate_limit_per_min: 100
allowed_tools: [] # Empty = all tools enabled
allowed_resources: [] # Empty = all resources enabled
OptionDefaultDescription
enabledfalseEnable the MCP server endpoint
base_path/mcpURL path for MCP endpoints
session_timeout3600sSession timeout for connections
max_message_size10485760Maximum request size in bytes
rate_limit_per_min100Requests per minute per client
allowed_tools[]Whitelist of allowed tools
allowed_resources[]Whitelist of allowed resources

The MCP server requires authentication for all requests. Supported methods:

Create a client key with specific MCP scopes:

Terminal window
fluxbase clientkeys create --name "AI Assistant" \
--scopes "read:tables,write:tables,execute:functions"

Use the key in requests:

Terminal window
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "X-Client-Key: your-client-key" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

Service keys have full access and bypass Row Level Security:

Terminal window
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "X-Service-Key: your-service-key" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
ScopeDescription
read:tablesQuery database tables
write:tablesInsert, update, delete records
execute:functionsInvoke edge functions
execute:rpcExecute RPC procedures
read:storageList and download files
write:storageUpload and delete files
execute:jobsSubmit and monitor jobs
read:vectorsVector similarity search
read:schemaAccess database schema
EndpointMethodDescription
/mcp/healthGETHealth check (no auth required)
/mcpPOSTJSON-RPC requests

The MCP server implements JSON-RPC 2.0 with the following methods:

  • initialize - Protocol handshake
  • ping - Health check
  • tools/list - List available tools
  • tools/call - Execute a tool
  • resources/list - List available resources
  • resources/read - Read a resource
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "query_table",
"arguments": {
"table": "users",
"select": "id,email,created_at",
"filter": {"is_active": "eq.true"},
"limit": 10
}
},
"id": 1
}
{
"jsonrpc": "2.0",
"result": {
"content": [
{
"type": "text",
"text": "[{\"id\":\"...\",\"email\":\"user@example.com\",\"created_at\":\"...\"}]"
}
],
"isError": false
},
"id": 1
}
  • All database operations respect Row Level Security (RLS) policies
  • Service keys bypass RLS for administrative operations
  • Internal schemas (auth, storage, functions, jobs) are hidden from non-admins
  • SQL injection is prevented through parameterized queries and identifier validation
  • File downloads are limited to 10MB to prevent memory issues