Let Claude Code, Cursor or any MCP client create, read, update and export your Archway diagrams, or do the same from your terminal. Both use an Archway API key and act as you, with the same plan limits and AI credits as the app.
Create a key under Settings → API keys. Give it read and write, and generate if the agent should create diagrams from prompts or repos. Then make it available to your tools:
export ARCHWAY_API_KEY=ak_…
Add Archway as an MCP server (one command, nothing to install):
claude mcp add --transport http archway https://www.archdiagram.dev/api/mcp \ --header "Authorization: Bearer $ARCHWAY_API_KEY"
Then ask, for example: “Draw this repo’s architecture in Archway” or “Add a Redis cache between the API and the database in my Shop diagram.”
For a diagram that costs no AI credit, point the agent at files it can read: “Turn prisma/schema.prisma into an ERD in Archway” or “Make an Archway diagram from the Terraform in infra/.” Those are parsed directly, so the diagram is back in a second.
Add this to .cursor/mcp.json in your project (or ~/.cursor/mcp.json for all projects):
{
"mcpServers": {
"archway": {
"url": "https://www.archdiagram.dev/api/mcp",
"headers": { "Authorization": "Bearer ${env:ARCHWAY_API_KEY}" }
}
}
}Other MCP clients connect the same way: Streamable HTTP at https://www.archdiagram.dev/api/mcp with the key as a Bearer token.
list_diagrams — Your diagrams, newest first; filter by type.get_diagram — A diagram’s title, type and DSL source.create_diagram — From a prompt, a GitHub repo (repoUrl) or DSL. Prompts and repos use one AI credit; DSL is free.create_diagram_from_files — From files the agent already has open, with no AI credit: a Prisma, Drizzle or SQL schema becomes an ERD; Terraform, Docker Compose, CloudFormation or Kubernetes files become a cloud architecture diagram.update_diagram — Replace its DSL or title, or regenerate it from a prompt (one credit). The previous version stays in history.get_job — The result of an AI create or update that took longer than ~25 seconds (those answer with a job id).export_diagram — As dsl, json, mermaid, plantuml, d2, drawio, terraform, svg or png.Every tool is a call to the REST API, so the key’s permissions, rate limits and plan limits apply as they do there.
The archway command (Node 20 or later) does the same from a terminal or CI:
archway login # paste your API key archway scan . # draw this repo (GitHub remote) — 1 credit archway create --title "Shop" --prompt "A web store on AWS with a queue" archway list archway get <id> > shop.archway # the DSL archway update <id> --file shop.archway archway export <id> --format mermaid archway mcp-config # print the MCP setup above
ARCHWAY_API_KEY overrides the saved login, for CI. Run archway help for every option.