Connect to Momen Backend (Using Momen BaaS)
Momen provides a fully managed backend infrastructure built on PostgreSQL. Through its Headless Mode, Momen exposes its underlying database, authentication system, business logic engine (Actionflows), and AI Agent orchestration directly via standard, clean GraphQL APIs.
This allows you to utilize Momen as a pure Backend-as-a-Service (BaaS), integrating seamlessly with any frontend framework such as React, Vue, Next.js, or mobile apps. Developers can build complex full-stack applications without writing or maintaining any backend routes or server environments. Furthermore, combined with Momen’s dedicated MCP and Development Skills, this architecture delivers an unparalleled Vibe Coding experience for AI assistants like Cursor.
Why Choose Momen BaaS?
Momen is more than just a simple database alternative; it is a production-ready, fully managed backend (BaaS). Whether you are using traditional development methods or AI coding assistants, Momen offers significant advantages:
- Out-of-the-box High-Performance Backend: Built on PostgreSQL, Momen comes with a comprehensive authentication system (Auth), complex business logic engine (Actionflows), and enterprise-grade data permission control (RLS). You gain a highly available and scalable backend infrastructure without the need to set up or maintain servers from scratch.
- Minimalist Frontend Integration: All the data models, business logic, and AI Agents you visually build in the Momen editor are automatically transformed into standardized, clean GraphQL APIs. The frontend doesn’t need to import bloated SDKs; simple GraphQL calls are all it takes to deliver complex business features.
- Perfect Synergy with AI Coding Assistants (Vibe Coding): When using AI assistants like Cursor, traditional development often suffers from “API hallucinations.” Momen provides dedicated MCP and Development Skills that allow the AI to accurately read the actual backend structure in real-time through “API introspection.” This determinism fundamentally eliminates API hallucinations, vastly improving the success rate during initial frontend-backend integration.
Obtain API Endpoints and Credentials
The first step to connect to the Momen backend is to obtain your project’s API endpoints. Momen provides unified GraphQL endpoints for each project (replace {projectExId} with your actual Project ID):
HTTP Endpoint (for standard Queries and Mutations):
https://villa.momen.app/zero/{projectExId}/api/graphql-v2WebSocket Endpoint (for real-time Subscriptions):
wss://villa.momen.app/zero/{projectExId}/api/graphql-subscription💡 Tip: For local development, you will also need a high-privilege Admin Token. You can copy this token from the Connect Backend modal at the top right of the Momen editor. The modal also includes a built-in GraphiQL panel to write and test GraphQL queries directly.
⚠️ Warning: The Admin Token has the highest privileges and should only be used for local development or in trusted server environments (e.g., Node.js backend). Never expose or hardcode it in pure frontend client code accessible to users.
Vibe Coding: AI Assistant Integration
If you use AI coding assistants like Cursor, Windsurf, or Claude Code, Momen provides a dedicated MCP Server and Development Skill. These tools help the AI accurately fetch your Momen backend structure and automatically generate the corresponding frontend integration code based on natural language instructions.
Momen MCP
The Momen MCP (Model Context Protocol) server allows AI assistants to securely connect to your Momen account.
Core Capabilities
- GraphQL Schema Introspection: The core capability. The AI can invoke the
get_project_schematool to read your complete, real-time backend Schema (includingdataModel,actionFlows,apis, andzAiConfigs). This allows the AI to accurately fetch the backend structure, avoiding API hallucinations. - Project Context Management: The AI can use the
get_projectstool to search for projects in your account and automatically switch contexts usingset_current_project. - Intelligent Mock Data Generation: Includes the
create_and_save_mock_data_recursivelytool. When developing frontend lists or detail pages, you can ask the AI to generate mock data for specific tables. The tool automatically handles complex foreign key dependencies and type conversions, inserting the data directly into your Momen database to speed up UI debugging. - Automated Authentication: If the token expires, the AI can seamlessly trigger the OAuth re-authentication flow via the
reauthtool, keeping the development process uninterrupted.
How to Integrate
Method 1: JSON Configuration (for Cursor / Windsurf / Cline, etc.)
Add the following JSON configuration to your editor’s MCP settings file (e.g., when using the Cline extension, configure mcpServers directly):
{
"mcpServers": {
"momen": {
"command": "npx",
"args": ["-y", "momen-mcp"]
}
}
}Method 2: CLI Installation (for Claude Code / Codex, etc.) Run the following command in your terminal:
npx -y momen-mcpMethod 3: AI Prompt Mode Copy the following prompt and send it to your AI chat window:
Please help me install and configure an MCP server named momen. The npm URL is: https://www.npmjs.com/package/momen-mcpMomen Development Skill
The Skill is an official collection of AI development guidelines (momen-baas-skill).
Core Capabilities
Once installed, the AI assistant will follow Momen’s specific backend rules and underlying protocol details:
- Data Operation Protocols (GraphQL Rules):
- Strict Filtering Syntax: Standardizes the use of Momen’s unique “Operator-First” pattern to construct complex
wherequeries (e.g.,{"_eq": {"bigint_operand": {"left_operand": {"column": "id"}, "right_operand": {"literal": "1"}}}}). - Formulas & Functions: Defines how to utilize dozens of built-in Momen functions inside queries (e.g.,
CONCAT,EXTRACT_DATE,GEO_DISTANCE). - Aggregations & Sorting: Defines the usage of
[table]_aggregateand multi-level relational sorting logic.
- Strict Filtering Syntax: Standardizes the use of Momen’s unique “Operator-First” pattern to construct complex
- Actionflow Protocol:
- Synchronous Actionflows: Defines the invocation method to trigger mutations via
fz_invoke_action_flowand fetch results immediately. - Asynchronous Actionflows: Defines the workflow for long-running tasks, requiring a call to
fz_create_action_flow_taskto get ataskId, followed by subscribing tofz_listen_action_flow_resultvia WebSocket to monitor status transitions (CREATED->PROCESSING->COMPLETED).
- Synchronous Actionflows: Defines the invocation method to trigger mutations via
- AI Agent Protocol:
- Streaming & Reasoning: Defines the standard for creating a conversation via
fz_zai_create_conversationand subscribing tofz_zai_listen_conversation_resultto handle state transitions (IN_PROGRESS->STREAMING->COMPLETED), as well as extractingreasoningContent. - Structured Output: Defines the standard for handling non-streaming structured responses constrained by JSONSchema.
- Multi-turn Conversations: Defines the standard for continuing conversations using
fz_zai_send_ai_messageor halting generation viafz_zai_stop_responding.
- Streaming & Reasoning: Defines the standard for creating a conversation via
- Binary Asset Upload Workflow:
- Enforces the mandatory two-step upload process: First, calculate the file’s MD5 and call
imagePresignedUrlto obtain the direct upload URL and file ID. Second, execute an HTTPPUTto upload the binary stream to OSS, and finally save the file ID into the business table.
- Enforces the mandatory two-step upload process: First, calculate the file’s MD5 and call
- Third-Party API Integration:
- Standardizes how to properly invoke imported external APIs and safely parse the
field_200_jsonandresponseCode.
- Standardizes how to properly invoke imported external APIs and safely parse the
How to Integrate
Method 1: Prompt Installation (for Cursor / Windsurf / Cline, etc.) Copy the following prompt and send it to your AI chat window:
Please carefully read and install the development skill from the following repository:
https://github.com/momen-tech-org/momen-baas-skillMethod 2: CLI Installation (for Claude Code / Codex, etc.) Run the following command in your terminal to install globally:
npx skills add https://github.com/momen-tech-org/momen-baas-skill -gRecommended Workflow
Once connected, you can efficiently advance your project using this workflow:
- Visual Backend Setup: Visually configure your database tables, Actionflows, and AI Agents in the Momen web editor.
- Configure AI Assistant: Following the guide above, configure the Momen MCP and install the Momen Development Skill in your AI coding assistant (e.g., Cursor).
- AI Context Reading: In your AI coding assistant, provide your
projectExIdand ask the AI to read the latest backend GraphQL structure via MCP. - Natural Language Development: Issue frontend development instructions directly. For example: “I have configured an AI Agent named ‘Image Analyzer’ in the backend. Please help me write a page that streams the AI Agent’s analysis results after the user uploads an image.” The AI will automatically generate the corresponding frontend integration code based on the fetched API structure.
Handling Backend Modifications During Development
After modifying the backend configuration in the Momen editor and clicking Sync Changes, simply tell the AI: "I have updated the backend to include [Feature/Field]. Please re-read the backend schema and update the frontend logic accordingly." The AI will automatically fetch the latest structure and apply the modifications.