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.

Quick Setup

Configure your MCP client to connect with your Fluxbase instance.

Service Key bypasses Row Level Security and has full database access. Use Client Key for user-level access that respects RLS policies.

Tip: Enter your API key above for one-click setup, or leave it empty to be prompted in your IDE.

View configuration JSON
 

Add this to your claude_desktop_config.json:

{
"mcpServers": {
"fluxbase": {
"type": "http",
"url": "http://localhost:8080/mcp",
"headers": {
"X-Service-Key": "your-service-key"
}
}
}
}

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add to your VS Code settings (settings.json) or use the “Add to VS Code” button above:

{
"claude.mcpServers": {
"fluxbase": {
"type": "http",
"url": "http://localhost:8080/mcp",
"headers": {
"X-Service-Key": "your-service-key"
}
}
}
}

Add to Cursor’s MCP settings (Settings → Features → MCP Servers):

{
"fluxbase": {
"type": "http",
"url": "http://localhost:8080/mcp",
"headers": {
"X-Service-Key": "your-service-key"
}
}
}
Terminal window
claude mcp add --transport http fluxbase http://localhost:8080/mcp \
--header "X-Service-Key: your-service-key"

Any MCP-compatible client can connect using:

  • URL: http://your-server:8080/mcp
  • Type: http
  • Auth Header: X-Service-Key: your-key or X-Client-Key: your-key
  • Protocol: JSON-RPC 2.0 over HTTP POST

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:

Service keys bypass Row Level Security (RLS) and have full database access. Recommended for:

  • Administrative automation
  • CI/CD pipelines
  • Development and testing
  • Backend service integration
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}'

Client keys respect Row Level Security - users only see data they’re authorized to access. Create a client key with specific 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}'

MCP clients like Claude Desktop can authenticate using OAuth 2.1 with Dynamic Client Registration (DCR). This provides user-scoped access that respects Row Level Security.

How it works:

  1. The client discovers endpoints via /.well-known/oauth-authorization-server
  2. It registers itself via POST /mcp/oauth/register (no pre-configured credentials needed)
  3. The user is prompted to log in to Fluxbase
  4. After authentication, the client receives tokens tied to that user

Configuration:

mcp:
enabled: true
oauth:
enabled: true # Enable OAuth for MCP
dcr_enabled: true # Enable Dynamic Client Registration
token_expiry: 1h # Access token lifetime
refresh_token_expiry: 168h # Refresh token lifetime (7 days)

Claude Desktop config (OAuth):

{
"mcpServers": {
"fluxbase": {
"url": "http://localhost:8080/mcp"
}
}
}

Claude will automatically handle OAuth discovery and authentication.

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
/.well-known/oauth-authorization-serverGETOAuth server metadata (discovery)
/.well-known/oauth-protected-resourceGETProtected resource metadata
/mcp/oauth/registerPOSTDynamic Client Registration
/mcp/oauth/authorizeGETOAuth authorization endpoint
/mcp/oauth/tokenPOSTToken exchange endpoint
/mcp/oauth/revokePOSTToken revocation

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 when using Client Keys or OAuth
  • 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

If your MCP client only supports stdio transport (older clients), use the mcp-remote proxy:

{
"mcpServers": {
"fluxbase": {
"command": "npx",
"args": [
"mcp-remote@latest",
"--http",
"http://localhost:8080/mcp",
"--header",
"X-Service-Key: your-service-key"
]
}
}
}