Skip to main content

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

Or use 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
That’s all you need. The MCP server is project-scoped and authenticates entirely via your API key — no account email or password required.

Step 3 — Configure your AI tool

Add to your project’s .mcp.json:
Or add to your global ~/.claude/mcp.json to use it in all projects.

Environment variables


Available Tools

Project

Collections & Documents

App Users

Cloud Functions

Cron Jobs

Storage

Email

Analytics

Migrations


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:
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

Key db methods

Async version (asyncdb)

In async def main(), replace db. with await asyncdb.:

Next Steps