MCP Integration
The Model Context Protocol (MCP) is an open standard that lets AI coding tools call out to external services with structured tools. AI-ERD exposes its workspace, document, ERD, diagram, and Markdown APIs as MCP tools (see the Tool Reference), so your AI assistant can work from live project data instead of guessing.
One MCP integration works across many AI clients. No per-tool plugin needed.
Why use MCP?
Without MCP, your AI coding assistant doesn't know what your real schema looks like. You either paste DDL into every chat, or accept that the assistant is guessing column names and types.
With MCP + AI-ERD, your assistant can:
- List ERD, diagram, Markdown, and OpenAPI documents in a workspace or project
- Read ERD tables, columns, indexes, relationships, enums, and groups
- Create new tables, columns, refs, enums, and groups
- Modify existing structure (add/rename/drop columns, change FKs, etc.)
- Generate or append Markdown documents
- Snapshot every document change for version history
Every write is tagged with a description, attributed to your account, and rolls into the same audit log as your manual edits.
Endpoint
POST https://ai-erd.com/mcp
- Protocol: JSON-RPC 2.0 over HTTP (Streamable HTTP transport)
- Auth: OAuth 2.0 with PKCE (your MCP client handles the flow)
- Session:
Mcp-Session-Idheader (auto-issued oninitialize) - Discovery:
GET https://ai-erd.com/.well-known/oauth-authorization-serverandGET https://ai-erd.com/.well-known/oauth-protected-resource/mcp
You don't usually call this directly — your MCP client (Claude Code, Cursor, etc.) speaks the protocol for you.
Authentication
AI-ERD acts as an OAuth 2.0 authorization server for MCP clients. The flow:
- Your MCP client redirects you to AI-ERD's authorization page
- You sign in (or are already signed in) and consent
- AI-ERD issues an access token to the client
- The client uses the token in the
Authorization: Bearer {token}header on every MCP call
The token represents your account - every action through MCP is attributed to you and respects your permissions on each project and document.
MCP works on every plan, Free included. What differs is the monthly AI credit allowance and the document/workspace limits — see Plans.
Supported clients
AI-ERD has been tested or designed to work with:
- Claude Code — Anthropic's terminal coding agent
- Codex — OpenAI's coding agent
- Copilot — GitHub Copilot
- Cursor — AI-first code editor
- Gemini — Google's coding assistants
- Windsurf — Codeium's AI editor
…and any other tool that speaks MCP. The protocol is the same across all of them; only the per-client config differs.
See the per-client setup pages for exact configuration snippets.
What you can do once connected
Quick examples to try in your AI client after connecting:
List all my AI-ERD ERD documents.
Show me the columns of the users table in ERD document <uuid>.
Add a soft_delete_at timestamp column to all tables in ERD document <uuid>.
Use a description "Add soft delete support".
Create a new table called notifications in ERD document <uuid>:
- id (bigint, PK, auto-increment)
- user_id (bigint, FK to users.id)
- message (text, not null)
- read_at (timestamp, nullable)
- created_at (timestamp, default now)
Then create a foreign key from notifications.user_id to users.id with on_delete=cascade.
The assistant translates these into tool calls such as
mcp__ai-erd__list_documents, mcp__ai-erd__erd_get_table, and
mcp__ai-erd__erd_apply_changes.
AI-ERD applies the changes and creates a version snapshot automatically.
Next steps
- Pick your client: Claude Code · Codex · Copilot · Cursor · Gemini · Windsurf
- Browse the tool reference to see what's available