Try DrawSQL

Connect your agent (MCP)

.md

Connect your agent to DrawSQL and create your first editable database diagram. You can try it without an account. Add an API token when you want to work with your team's diagrams.

On this page

Connect your editor

Choose your client: Claude Code, Codex, Cursor, or VS Code. Follow its instructions, then try your first diagram.

You need an MCP client that supports streamable HTTP. DrawSQL hosts the server, so there is no local server to install.

Claude Code

Run this once to make DrawSQL available in every project:

claude mcp add --transport http --scope user drawsql https://drawsql.app/mcp

To limit DrawSQL to the current project, omit --scope user.

Codex

Run this once:

codex mcp add drawsql --url https://drawsql.app/mcp

Cursor

Add to .cursor/mcp.json in your project, or ~/.cursor/mcp.json for all projects:

{
  "mcpServers": {
    "drawsql": {
      "url": "https://drawsql.app/mcp"
    }
  }
}

Add to Cursor

VS Code

Add to .vscode/mcp.json in your workspace:

{
  "servers": {
    "drawsql": {
      "type": "http",
      "url": "https://drawsql.app/mcp"
    }
  }
}

Install in VS Code

For another MCP client, use https://drawsql.app/mcp as its HTTP server URL.

Try your first diagram

Open a conversation in your agent and paste this prompt:

Visualize this PostgreSQL schema as an editable DrawSQL diagram:

CREATE TABLE users (id BIGINT PRIMARY KEY, email VARCHAR(255));
CREATE TABLE orders (
  id BIGINT PRIMARY KEY,
  user_id BIGINT,
  FOREIGN KEY (user_id) REFERENCES users(id)
);

Your agent returns a DrawSQL link. Open it to see two tables with their foreign-key relationship. You can edit the diagram or export it without signing up.

You may also point your agent at a schema it can already read:

Diagram the tables and foreign keys in schema.sql using DrawSQL.

MySQL, PostgreSQL, and SQL Server are supported. MySQL is the default; name the database in your prompt if you use another dialect. The anonymous diagram opens with up to 20 tables. Save it to a DrawSQL account if you want to keep a permanent copy.

Working with your own diagrams

To let your agent read your team's diagrams, connect with a DrawSQL API token. API tokens require a paid plan.

  1. Open Account → API tokens and create a token.
  2. Choose the team whose diagrams your agent should use. A token belongs to one team and sees the diagrams its user can access.
  3. Copy the token when it is created. DrawSQL shows it only once.
  4. Follow your client's token setup below, replacing the anonymous configuration above. Keep Read only access to read existing diagrams.

Choose Read and write under Access if you also want your agent to create diagrams or propose changes. Proposing changes requires permission to edit the target diagram.

Choose your client: Claude Code, Codex, Cursor, or VS Code.

Claude Code with an API token

Run this with your token in place of <your-token>. If you already added drawsql, run claude mcp remove drawsql --scope user first.

claude mcp add --transport http --scope user drawsql https://drawsql.app/mcp \
  --header "Authorization: Bearer <your-token>"

Codex with an API token

Add to ~/.codex/config.toml, and set DRAWSQL_TOKEN to your token in your shell. If the file already has a drawsql entry, edit that entry.

[mcp_servers.drawsql]
url = "https://drawsql.app/mcp"
bearer_token_env_var = "DRAWSQL_TOKEN"

Cursor with an API token

Add to .cursor/mcp.json or ~/.cursor/mcp.json, and set DRAWSQL_TOKEN to your token in your environment:

{
  "mcpServers": {
    "drawsql": {
      "url": "https://drawsql.app/mcp",
      "headers": {
        "Authorization": "Bearer ${env:DRAWSQL_TOKEN}"
      }
    }
  }
}

VS Code with an API token

Add to .vscode/mcp.json in your workspace. VS Code asks for the token the first time the server starts:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "drawsql-token",
      "description": "DrawSQL API token",
      "password": true
    }
  ],
  "servers": {
    "drawsql": {
      "type": "http",
      "url": "https://drawsql.app/mcp",
      "headers": {
        "Authorization": "Bearer ${input:drawsql-token}"
      }
    }
  }
}

You may revoke a token at any time from Account → API tokens.

Check your team connection

Ask your agent:

List my DrawSQL diagrams, then show me the tables in the diagram I choose.

Your agent should list diagrams from the team you selected for the token. If it only offers to visualize SQL, check that it is using the authenticated configuration and reconnect it to refresh the tool list.

Once connected, you may ask your agent to read a diagram before it writes code:

Read the Orders service diagram in DrawSQL before you write this migration.

Create a private diagram

With a Read and write token, try:

Create a private DrawSQL diagram in my team from schema.sql. Name it Orders service and use PostgreSQL.

Your agent returns the diagram's link. For a longer SQL import, it checks the import status before reading the completed diagram.

SQL can be up to 200 KB and a schema patch up to 500 KB. Your plan's table limit per diagram and private diagram limit apply. If your agent sends the same request again within two minutes, it gets back the diagram it already made, not a copy.

Propose a change

For a diagram you can edit, try:

Propose a nullable notes column on the orders table in my Orders service diagram.

Your agent reads the diagram first, then sends the change with a title and a message, and returns a review link. Nothing changes until someone who can edit the diagram applies it.

Each request makes a new proposal. If your agent retries, you may see the same change twice; decline the extra one.

Reviewing a proposal

The review link opens your diagram with the proposal shown as a diff. If you can edit the diagram, you can apply or decline it there. Applying changes only the diagram; it never runs a migration against your database. If you decline with a reason, your agent sees the reason and can send a revised proposal.

Review proposed changes covers the full review: reading the diff, undoing an apply, and expired proposals.

FAQ

My agent cannot find the DrawSQL tools

Check that the server URL is https://drawsql.app/mcp and the client supports streamable HTTP. Reconnect the server or restart the client so it discovers the tools. The anonymous connection includes visualize_schema, which creates an editable diagram from SQL or a schema patch.

My agent cannot see my team's diagrams

Check that you replaced the anonymous setup with the token setup for your client. The token must be current and belong to a team on a paid plan. It can only access diagrams visible to the user who created it in that team.

My agent can read diagrams but cannot create or propose changes

Check that the token has Read and write access, then reconnect your client to refresh its tool list. To propose a change, the token's user must also be able to edit the diagram.

What happens to a schema I visualize without an account?

DrawSQL stores the submitted schema so the returned link can load it. Anyone with the link can open the diagram. An unopened link expires after 30 days. Opening it extends the expiry for one year, and each later view renews that period. Save the diagram to an account to keep a permanent copy.

Advanced

Still have a question? We'd love to help!