MCP Setup Guide Claude Code

How to connect an MCP server so that Claude Code can create and edit diagrams in this YourERD service using plain language.

Overview

MCP (Model Context Protocol) is the standard that lets AI clients such as Claude Code call external tools. YourERD hosts a remote MCP endpoint (/mcp) directly on its server, so once connected you can say things like:

"Create a user entity with seq (user id) as an integer PK and name varchar(100)" → entities, columns and relationships are created and saved on the server automatically.

You do not need to clone the repository, install Node, hand-edit .mcp.json, or restart Claude Code. Just paste a single command containing the personal token you created on the web.

Claude Code ──HTTP (personal token)──▶ YourERD server /mcp  (no extra process or repo)

1Sign in & create a token

  • Sign in to YourERD (no account yet? use the avatar in the top right → Sign up). MCP only sees and edits diagrams belonging to your own account.
  • Open “Connect MCP” at the bottom of the left sidebar.
  • Press “Create token” to generate a personal access token (PAT). The connection command appears with the token already filled in.
⚠️ The raw token is shown only once, right after it is created. Copy the command there and then. If you lose it, just create a new one — and revoke tokens you no longer use from the list.

2Paste one command

Use the copy button in the modal and paste the command into your terminal. (The shape is shown below — in practice your real token is already filled in.)

claude mcp add --scope user --transport http \
  erd https://yourerd.com/mcp \
  --header "Authorization: Bearer <YOUR_TOKEN>"

--header must come last — it takes a variable number of values, so placing it earlier swallows the name and URL and the command fails.

You can also add it to .mcp.json yourself (expand “Or add it to .mcp.json directly” in the modal).

{
  "mcpServers": {
    "erd": {
      "type": "http",
      "url": "https://yourerd.com/mcp",
      "headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
    }
  }
}

3Verify the connection

A remote MCP server registers immediately, so no restart is needed. In Claude Code:

  • Type /mcp — if the erd server and its tools are listed, you are connected
  • Or ask "show me my ERD diagrams" — that runs list_diagrams
The token travels in the Authorization: Bearer header, so connect over https whenever possible.

How to use it

Once connected, just ask in plain language. For example:

  • "Create a new ERD for an order system"
  • "Add User and Order entities, then connect User→Order as a 1:M non-identifying relationship"
  • "Add an email varchar(255) column to User"
  • "Summarize the diagram you just made"

When you connect a relationship, the parent's PK is added to the child as an FK column automatically (for an identifying relationship the FK also becomes part of the child's PK).

Tool reference

Reference arguments (entity, column, source, target) accept either an id or a name.

ToolWhat it does
list_diagramsList my diagrams
create_diagramCreate an empty diagram and select it
select_diagramChoose the diagram to work on (by id or name)
get_diagramSummarize the current or a given diagram
rename_diagram / delete_diagramRename / delete
add_entityAdd an entity (with a default id PK)
update_entity / delete_entityUpdate / delete (cascades FK and relationship cleanup)
add_column / update_column / delete_columnColumn CRUD
add_relationshipAdd a relationship and copy the parent PK into the child as an FK
update_relationship_typeChange the relationship type (identifying ↔ non-identifying)
delete_relationshipDelete a relationship and remove the auto-generated FK

Advanced: local stdio mode

The older approach — cloning the repository and running the MCP server locally — is still supported (useful for development and debugging). It requires Node 18+ and a repo clone, and you put service-account credentials in .mcp.json.

cd erd-service/mcp && npm install

# .mcp.json at the project root
{
  "mcpServers": {
    "erd": {
      "command": "npx",
      "args": ["-y", "tsx", "erd-service/mcp/src/index.ts"],
      "env": {
        "ERD_BASE_URL": "https://yourerd.com",
        "ERD_USERNAME": "my-account-mcp",
        "ERD_PASSWORD": "my-password"
      }
    }
  }
}
⚠️ This mode puts your password in .mcp.json in plain text — never commit or share that file. For everyday use, prefer the remote token method above (recommended).

Troubleshooting

SymptomCause / fix
No tools show upCheck the status with /mcp. Make sure the server URL (ending in /mcp) and the Authorization header are exactly right
Connection refused (401)The token expired, was revoked, or is wrong — create a new one under “Connect MCP” on the web and register the command again
Diagrams look emptyA token only sees diagrams from the account that created it. Check which account you are signed in as
Edits do not appear on screenExpected by design — reopen the diagram or refresh the page (see below)

Things to know

  • Refresh required: MCP edits are saved to the database, but a browser tab that is already open does not update on its own. Reopen the diagram or refresh.
  • Last save wins: if the same diagram is saved from MCP and the browser at the same time, the later save overwrites the earlier one.
  • Account isolation: everyone sees and edits only the diagrams in their own MCP account. To collaborate, share one account.
  • Bulk creation and real-time sync are out of scope for now.
For developer-level documentation, see erd-service/mcp/README.md in the repository.