Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cocobase.buzz/llms.txt

Use this file to discover all available pages before exploring further.

MCP Server & Claude Skill

CocoBase ships an official MCP (Model Context Protocol) server that lets any AI assistant — Claude Code, Claude Desktop, Cursor, Windsurf, Continue, or any MCP-compatible tool — manage your project directly. Package: cocobase-mcp  ·  npm: npmjs.com/package/cocobase-mcp

What is the MCP Server?

The CocoBase MCP server exposes your entire project as AI-callable tools. Instead of switching to the dashboard or writing scripts, you can tell your AI assistant:
“Create a collection called orders, add these three documents to it, and set up a cron job that runs the send-daily-digest function every morning at 9 AM.”
The AI handles it — no manual steps, no copy-pasting IDs.

Setup

Step 1 — Install globally

npm install -g cocobase-mcp
Or use npx (no install needed):
npx cocobase-mcp

Step 2 — Get your credentials

From your CocoBase dashboard:
  • API Key — project settings → API Key
  • Project ID — project settings → Project ID
  • Email + Password — your CocoBase account credentials (needed for cloud function and cron job management)

Step 3 — Configure your AI tool

Add to your project’s .mcp.json:
{
  "mcpServers": {
    "cocobase": {
      "command": "npx",
      "args": ["-y", "cocobase-mcp"],
      "env": {
        "COCOBASE_API_KEY": "your-api-key",
        "COCOBASE_PROJECT_ID": "your-project-id",
        "COCOBASE_EMAIL": "you@example.com",
        "COCOBASE_PASSWORD": "your-password"
      }
    }
  }
}
Or to your global ~/.claude/mcp.json to use it in all projects.

Environment variables

VariableRequiredPurpose
COCOBASE_API_KEYAlwaysAuthenticates all project data operations
COCOBASE_PROJECT_IDAlwaysScopes operations to your project
COCOBASE_EMAILFor cloud functions & cronDashboard login for cloud function / cron management
COCOBASE_PASSWORDFor cloud functions & cronDashboard login for cloud function / cron management
COCOBASE_EMAIL and COCOBASE_PASSWORD are only needed for cloud function creation/editing and cron job management. Collection, document, user, email, storage, and analytics tools work with just the API key.

Available Tools

Project

ToolDescription
get_project_configGet CORS origins, callback URL, feature flags
update_project_configUpdate project name, allowed origins, callback URL
update_feature_configToggle features: email_verification, two_factor_auth, phone_auth, etc.

Collections & Documents

ToolDescription
list_collectionsList all collections
create_collectionCreate a new collection
delete_collectionDelete a collection and all its documents
get_collection_schemaInfer field types from existing documents
query_documentsQuery with filters, sort, pagination, full-text search
get_documentGet one document by ID
create_documentInsert a new document
update_documentUpdate fields on an existing document
delete_documentDelete one document
bulk_create_documentsInsert multiple documents at once
aggregate_documentsRun sum/avg/min/max/count on a numeric field
count_documentsCount documents, optionally filtered
export_collectionExport all documents as JSON or CSV

App Users

ToolDescription
list_app_usersList users with search and pagination
get_app_userGet one user by ID
create_app_userCreate a new app user
update_app_userUpdate email, password, or custom data
delete_app_userDelete a user
add_user_rolesSet roles on a user
bulk_delete_usersDelete multiple users
reset_user_passwordTrigger password reset for a user

Cloud Functions

ToolDescription
list_cloud_functionsList all functions
get_cloud_functionGet code + details of a function by name or ID
create_cloud_functionCreate a new function
update_cloud_functionEdit code or description
delete_cloud_functionDelete a function
test_cloud_functionExecute code with a test payload (no save needed)
generate_function_with_aiGenerate Python code from plain-English prompt
create_function_from_aiGenerate code with AI and immediately create the function

Cron Jobs

ToolDescription
list_cron_jobsList all scheduled jobs
create_cron_jobCreate a job with a cron expression and payload
update_cron_jobUpdate schedule, payload, or active state
delete_cron_jobRemove a cron job
toggle_cron_jobEnable or disable a job
trigger_cron_job_nowRun a job immediately (one-time)

Storage

ToolDescription
list_filesList stored files, filter by directory
get_storage_infoStorage usage vs plan limit
delete_fileDelete a file by URL or path

Email

ToolDescription
send_emailSend an email via configured provider
list_email_templatesList saved templates
create_email_templateCreate a template with {{variable}} placeholders
update_email_templateEdit an existing template
delete_email_templateRemove a template
get_email_logsView sent email history and delivery status

Analytics

ToolDescription
get_analytics_overviewTotal collections, documents, users, storage, function executions
get_user_growthSignup trends over time (up to 365 days)
get_document_activityDocument create/update activity over time
get_function_statsCloud function calls, errors, avg execution time
get_plan_usageCurrent usage vs plan limits
get_subscription_statusCurrent plan, trial status, days remaining

Migrations

ToolDescription
list_migrationsList all schema migrations
create_migrationWrite a new migration
run_migrationExecute a pending migration

Example Conversations

Set up a project from scratch:
“Create a posts collection, a comments collection, and add these 5 sample posts to get me started.”
Debug and iterate on a cloud function:
“Show me the code for my send-weekly-report function. It’s not sending emails correctly — the template name is wrong. Fix it and test it with payload {'week': '2025-W21'}.”
Data operations:
“Give me all users who signed up in the last 7 days and export them as CSV.”
Schedule automation:
“Create a cron job that runs cleanup-expired-sessions every night at 2 AM UTC.”
Monitor your project:
“Show me analytics for the last 30 days — how many new users, what’s my storage usage, and how many function calls did I make?”

Claude Skill — Cloud Functions AI

The Claude Skill gives Claude full knowledge of the CocoBase cloud functions Python environment so it can write, review, and fix your function code accurately.
The MCP server is better than the Claude Skill for managing cloud functions (creating, updating, testing). The Claude Skill is best used for writing and understanding function code — it has deep knowledge of every available global, filter operator, and pattern.

How to use the Claude Skill

The CocoBase cloud functions system prompt is at:
/home/patrick/Documents/COCOBASE/cocobase-mcp/CLOUD_FUNCTIONS_SYSTEM_PROMPT.md
Paste it as a custom system prompt in Claude, ChatGPT, Cursor, or any AI tool that supports custom instructions.

What the Claude Skill knows

  • Every global variable available in functions (db, asyncdb, req, email, http, auth, render, queue, use)
  • Every db method with correct signatures: get_documents, find_one, create_document, update_document, update_document_fields, delete_document, count_documents, bulk_create_documents, bulk_delete_documents, query, get_or_create_document
  • All filter operators (__gt, __gte, __lt, __lte, __ne, __contains, __startswith, __endswith, __in, __notin, __isnull, [or], [or:group])
  • asyncdb — async proxy of all db methods, use with await in async def main()
  • Email methods and their exact signatures (send_email, send_welcome_email, send_password_reset_email, send_2fa_code_email, send_password_changed_email)
  • http.get/post/put/patch/delete/fetch_all — concurrent external requests
  • auth.generate_token / validate_token / refresh_token
  • queue.add / call_function / has_capacity
  • render.render_html / render_template / render_string
  • use(function_name, export_name) for cross-function imports
  • Pre-imported stdlib: json, datetime, timedelta, math, re, random, secrets, uuid, base64, hashlib, urllib, collections, itertools, decimal, html, etc.
  • Security restrictions: no import, no file system, no os/subprocess, SSRF-blocked HTTP

Cloud function structure

# Every function must define main() — sync or async
def main():
    return {"success": True}

async def main():
    user = await asyncdb.find_one("users", email=req.get("email"))
    return {"user": user}

Key db methods

# Query — returns {data, total, has_more}
result = db.get_documents("posts", filters={"status": "active"}, limit=20)
posts = result["data"]

# One document — returns dict or None
post = db.find_one("posts", id="abc123")

# Create
doc = db.create_document("posts", {"title": "Hello", "status": "draft"})

# Partial update (safe — preserves other fields)
doc = db.update_document("posts", document_id="abc123", updates={"status": "published"})

# Count
total = db.count_documents("posts", filters={"status": "active"})

# Bulk
result = db.bulk_create_documents("posts", [{"title": "A"}, {"title": "B"}])
result = db.bulk_delete_documents("posts", document_ids=["id1", "id2"])

Async version (asyncdb)

In async def main(), replace db. with await asyncdb.:
async def main():
    posts = await asyncdb.get_documents("posts", filters={"status": "published"})
    doc = await asyncdb.create_document("posts", {"title": req.get("title")})
    return {"created": doc["id"]}

Next Steps