The Tenants API manages multi-tenant organization and the MCP (Model Context Protocol) endpoints enable AI agent integration with the Fataplus backend.
List Tenants
curl -X GET "https://bknd.fata.plus/api/tenants" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"
Retrieves all tenants (admin access required).
Endpoint : GET /api/tenants
Response
Array of tenant objects with isolation and access configuration
{
"data" : [
{
"id" : "tenant_main" ,
"name" : "Fataplus Main" ,
"subdomain" : "main" ,
"clients" : [ "client_xyz789" , "client_abc456" ],
"created_at" : "2026-01-01T00:00:00Z"
}
]
}
Create Tenant
curl -X POST "https://bknd.fata.plus/api/tenants" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Rice Cooperative Platform",
"subdomain": "rice-coop"
}'
Creates a new tenant organization with isolated data access.
Endpoint : POST /api/tenants
Request Body
Unique subdomain for tenant access (e.g., rice-coop.fata.plus)
Response
The created tenant object
MCP Protocol Endpoints
The Model Context Protocol (MCP) enables AI agents to interact with the Fataplus backend. These endpoints implement the MCP JSON-RPC 2.0 specification.
MCP Initialization
curl -X POST "https://bknd.fata.plus/api/system/mcp" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "client",
"version": "1.0.0"
}
}
}'
Initializes an MCP session with the backend.
Endpoint : POST /api/system/mcp
Request Body
Initialization parameters MCP protocol version: "2025-06-18"
Response
Initialization result Server protocol version: "2025-06-18"
Server capabilities including tools, resources, logging, completions
Server name ("bknd") and version ("0.19.0")
{
"jsonrpc" : "2.0" ,
"id" : 1 ,
"result" : {
"protocolVersion" : "2025-06-18" ,
"capabilities" : {
"tools" : {},
"resources" : {},
"logging" : {},
"completions" : {}
},
"serverInfo" : {
"name" : "bknd" ,
"version" : "0.19.0"
}
}
}
curl -X POST "https://bknd.fata.plus/api/system/mcp" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'
Retrieves available MCP tools for AI agent interaction.
Endpoint : POST /api/system/mcp
Request Body
Empty object or tool filters
Response
Tools list result Array of available tools Tool name (e.g., "system_info", "data_entity_read_many")
JSON Schema for tool input parameters
{
"jsonrpc" : "2.0" ,
"id" : 2 ,
"result" : {
"tools" : [
{
"name" : "system_info" ,
"description" : "Get system information" ,
"inputSchema" : {
"type" : "object"
}
},
{
"name" : "data_entity_read_many" ,
"description" : "Read multiple entities from database" ,
"inputSchema" : {
"type" : "object" ,
"properties" : {
"entity" : {
"type" : "string"
},
"filter" : {
"type" : "object"
}
},
"required" : [ "entity" ]
}
}
]
}
}
MCP Implementation Details
The MCP endpoints are implemented in /src/index.ts:28-121 with the following features:
Protocol Version : 2025-06-18
JSON-RPC 2.0 : Compliant with JSON-RPC specification
CORS Enabled : Cross-origin requests allowed for AI agent access
Available Tools :
system_info: Get backend system information
data_entity_read_many: Query database entities (projects, clients, etc.)
Multi-Tenant Data Isolation
Fataplus ensures strict data isolation:
Each tenant has isolated database access
Subdomain routing: [tenant].fata.plus
Client data is scoped to their tenant
Admin users can access cross-tenant for management
Session-based authentication with D1 database storage
Error Handling
MCP endpoints return JSON-RPC 2.0 error responses:
{
"jsonrpc" : "2.0" ,
"error" : {
"code" : -32700 ,
"message" : "Parse error"
}
}
Error Codes
-32700: Parse error (invalid JSON)
-32600: Invalid request
-32601: Method not found
-32602: Invalid params
-32603: Internal error