Setting Up MCP Server
Connect ER Flow to your AI coding assistant (Cursor, Windsurf) so your schema updates automatically as you describe features.
In this guide
- 1Get your data model UUID
- 2Configure MCP in your IDE
- 3Test the connection
- 4Use AI to modify your schema
- 5Understand available tools
What is MCP?
The Model Context Protocol (MCP) is an open standard that lets AI coding assistants interact with external tools. ER Flow provides an MCP Server that exposes your data model to AI β allowing it to read your current schema, create tables, add columns, set up relationships, and more.
Step 1: Get your data model UUID
Every data model in ER Flow has a unique UUID. You'll need this to connect your IDE.
Open your data model in ER Flow, then go to Settings or look at the URL β the UUID is the long string in the path. You can also find it in the Share modal.
Copy this UUID β you'll use it as the authentication token for the MCP Server.
Step 2: Configure MCP in your IDE
The MCP Server endpoint is: https://app.erflow.io/api/mcp/{uuid}
Replace {uuid} with your data model UUID.
For Cursor: Open your Cursor settings (.cursor/mcp.json in your project root or global settings) and add:
{
"mcpServers": {
"erflow": {
"url": "https://app.erflow.io/api/mcp/YOUR_UUID_HERE"
}
}For Windsurf: Add the MCP server in your Windsurf configuration with the same URL.
The UUID in the URL acts as your authentication token β the server uses it to identify which data model to operate on.
Step 3: Test the connection
Once configured, your AI assistant should be able to discover the ER Flow tools. Try asking it:
"Show me the current database schema"
The AI will call the get-data-model-dbml tool, which returns your entire schema in DBML format. If this works, the connection is successful.
Step 4: Use AI to modify your schema
Now you can describe schema changes in natural language:
- "Add a
commentstable withid,post_id,user_id,body, andcreated_at" - "Add a unique index on the
emailcolumn of theuserstable" - "Create a foreign key from
comments.post_idtoposts.idwith cascade delete" - "Add a
statuscolumn to theorderstable with type enum and default 'pending'"
The AI translates your instructions into MCP tool calls, and the changes appear in your ER Flow diagram in real-time.
Step 5: Understand available tools
The ER Flow MCP Server provides 25+ tools organized by entity type:
Tables: create-table, update-table, rename-table, delete-table
Columns: create-column, update-column, rename-column, delete-column
Indexes: create-index, update-index, rename-index, delete-index
Foreign Keys: create-foreign-key, update-foreign-key, delete-foreign-key
Primary Keys: set-primary-key
Views: create-view, update-view, delete-view
Triggers: create-trigger, update-trigger, delete-trigger
Procedures: create-procedure, update-procedure, delete-procedure
Batch: batch-operations β execute multiple operations in a single call
Read: get-data-model-dbml β get the current schema in DBML format
The AI should always call get-data-model-dbml first to understand the current schema before making changes. The batch-operations tool is especially powerful β it lets the AI create an entire schema (tables, columns, FKs, indexes) in a single request.