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:
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.
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 theerdserver and its tools are listed, you are connected - Or ask "show me my ERD diagrams" — that runs
list_diagrams
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.
| Tool | What it does |
|---|---|
list_diagrams | List my diagrams |
create_diagram | Create an empty diagram and select it |
select_diagram | Choose the diagram to work on (by id or name) |
get_diagram | Summarize the current or a given diagram |
rename_diagram / delete_diagram | Rename / delete |
add_entity | Add an entity (with a default id PK) |
update_entity / delete_entity | Update / delete (cascades FK and relationship cleanup) |
add_column / update_column / delete_column | Column CRUD |
add_relationship | Add a relationship and copy the parent PK into the child as an FK |
update_relationship_type | Change the relationship type (identifying ↔ non-identifying) |
delete_relationship | Delete 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"
}
}
}
}
.mcp.json in plain text — never commit or share that file. For everyday use, prefer the remote token method above (recommended).Troubleshooting
| Symptom | Cause / fix |
|---|---|
| No tools show up | Check 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 empty | A token only sees diagrams from the account that created it. Check which account you are signed in as |
| Edits do not appear on screen | Expected 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.
erd-service/mcp/README.md in the repository.