# AI Integration (MCP)

> Let AI agents like Claude read, lint, and edit your ERDs with sqemo-mcp — a local MCP server that runs via npx.

[sqemo-mcp](https://www.npmjs.com/package/sqemo-mcp) is a local MCP
(Model Context Protocol) server that lets AI agents work with your ERDs:
read and edit entities, attributes, and relationships; import and export
SQL and DBML; generate and check physical names against your team
standard; lint, auto-layout, and diff; and, on Pro, read a live database
to import it or check it for drift. It runs via `npx` — no separate
install.

## Requirements

Node.js 22 or later.

## Client setup

**Claude Code** — add to `.mcp.json` at your project root:

```json
{
  "mcpServers": {
    "sqemo": { "command": "npx", "args": ["-y", "sqemo-mcp"] }
  }
}
```

**Claude Desktop** — add the same `mcpServers` entry to the config file:

- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`

**Codex CLI** — register with one command:

```bash
codex mcp add sqemo -- npx -y sqemo-mcp
```

Or add the equivalent TOML to `~/.codex/config.toml`:

```toml
[mcp_servers.sqemo]
command = "npx"
args = ["-y", "sqemo-mcp"]
```

Most other MCP clients (Cursor, etc.) use the same `mcpServers` JSON.

> Using an AI agent already? Just paste this page's URL into Claude Code,
> Codex, or Cursor and ask it to connect the sqemo MCP server — the steps
> above are everything it needs.

## Sign in for server ERDs

No login is needed for local `.erd.json` files — every file tool works
offline. To read or edit ERDs saved on the Sqemo server, sign in once
from a terminal:

```bash
npx sqemo-mcp login    # pick Google, GitHub, or email + password
npx sqemo-mcp logout   # remove stored credentials
```

`login` asks how you want to sign in. Google and GitHub open a browser tab and
hand the result back to the terminal; the third option takes an email and
password without leaving it. Whichever you pick, only a refresh token is
stored, in `~/.erdmaker/credentials.json` — never your password.

No browser on that machine? Use `npx sqemo-mcp login --password`, or set
`SQEMO_EMAIL` / `SQEMO_PASSWORD` for unattended runs.

## CI without an agent

The package doubles as an offline CLI for pipelines:

```bash
# fail the build on naming-standard violations (exit code 1)
npx sqemo-mcp lint schema.erd.json

# export to SQL or DBML on stdout
npx sqemo-mcp export schema.erd.json --format sql --dialect postgres > schema.sql
```

GitHub Actions:

```yaml
- run: npx sqemo-mcp lint schema.erd.json
```

## CI drift check (Pro)

On Pro, `lint` can also compare your ERD against a real database and fail
CI when they've drifted apart. For a full step-by-step walkthrough — including
setting a password if you signed up with Google/GitHub, and trying it with
Docker if you don't have a database handy — see
[Connect to a Live Database](/docs/live-database/).

```yaml
# .github/workflows/schema-drift.yml
- run: npx sqemo-mcp lint erd/app.erd.json --db "$DATABASE_URL" --ignore "flyway_*"
  env:
    DATABASE_URL: ${{ secrets.DATABASE_URL }}   # read-only account recommended
    SQEMO_EMAIL: ${{ secrets.SQEMO_EMAIL }}     # Sqemo Pro account (password sign-in;
    SQEMO_PASSWORD: ${{ secrets.SQEMO_PASSWORD }} # OAuth-only accounts: set a password first)
```

`SQEMO_EMAIL`/`SQEMO_PASSWORD` sign in for the duration of the CI job —
no `login` step or stored token needed. Interactive sign-in can use your
browser, but a CI job has no browser, so it needs a password. If your Sqemo
account was created via Google/GitHub OAuth it has none yet —
[set one once](/docs/live-database/#signed-up-with-google-or-github-set-one-password-for-ci),
then use it here. Introspection itself runs inside your CI job and only
queries `information_schema` — no database credentials are ever sent to Sqemo.

Prefer zero database credentials in CI? Compare against a schema dump
instead, with no login required either:

```bash
npx sqemo-mcp lint erd/app.erd.json --schema schema.sql --dialect postgres
```

## What agents can do

39 tools in total. A few of them: `get_erd_overview`, `upsert_entity`,
`upsert_attribute`, `upsert_relationship`, `upsert_attributes`,
`upsert_dictionary_words` and `upsert_domains` (bulk edits in one save), `import_sql`, `import_dbml`,
`export_sql`, `export_dbml`, `generate_physical_name`, `check_naming`,
`lint_erd`, `auto_layout`, `diff_erds`, proposal tools for suggesting
new words to your team standard (a person still approves or rejects them —
that side is a [two-minute video](https://youtu.be/wHsoFbak6GY)), and two Pro tools
for working against a real database: `introspect_db` (import a live
PostgreSQL/MySQL schema into an ERD, read-only) and `check_db_drift`
(check whether a live database or schema dump has drifted from the ERD).

---
Source: https://sqemo.com/docs/mcp/ · Updated 2026-08-28
