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 calledThe AI handles it — no manual steps, no copy-pasting IDs.orders, add these three documents to it, and set up a cron job that runs thesend-daily-digestfunction every morning at 9 AM.”
Setup
Step 1 — Install globally
npx (no install needed):
Step 2 — Get your credentials
From your CocoBase dashboard:- API Key — project settings → API Key
- Project ID — project settings → Project ID
Step 3 — Configure your AI tool
- Claude Code
- Claude Desktop
- Cursor / Windsurf
Add to your project’s Or add to your global
.mcp.json:~/.claude/mcp.json to use it in all projects.Environment variables
Available Tools
Project
Collections & Documents
App Users
Cloud Functions
Cron Jobs
Storage
Analytics
Migrations
Example Conversations
Set up a project from scratch:“Create aDebug and iterate on a cloud function:postscollection, acommentscollection, and add these 5 sample posts to get me started.”
“Show me the code for myData operations:send-weekly-reportfunction. It’s not sending emails correctly — the template name is wrong. Fix it and test it with payload{'week': '2025-W21'}.”
“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:What the Claude Skill knows
- Every global variable available in functions (
db,asyncdb,req,email,http,auth,render,queue,use) - Every
dbmethod 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 alldbmethods, use withawaitinasync 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 requestsauth.generate_token / validate_token / refresh_tokenqueue.add / call_function / has_capacityrender.render_html / render_template / render_stringuse(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, noos/subprocess, SSRF-blocked HTTP
Cloud function structure
Key db methods
Async version (asyncdb)
In async def main(), replace db. with await asyncdb.:
