MyArchitectAI MCP server
A Model Context Protocol (MCP) server for theMyArchitectAI rendering API. It gives MCP-compatible assistants(Claude Code, Claude Desktop, Cursor, …) tools to generate photorealistic architectural renders,edit images, change textures and atmosphere, animate renders, generate prompts, transfer styles, create images from text, and upscale to 4K/8K — plus tools to preview, save, and track results.
Features
API tools (charged in USD, except balance):
| Tool | What it does | Required | Optional |
|---|---|---|---|
render_exterior |
Photorealistic exterior render from a sketch, drawing, 3D screenshot, or photo | image, outputFormat |
prompt |
render_interior |
Photorealistic interior render | image, outputFormat |
prompt |
style_transfer |
Apply a reference image's style to a source image | image, referenceImage, outputFormat |
prompt, negativePrompt, styleTransferStrength |
text_to_image |
Generate an architectural image from text | prompt, outputFormat, outputWidth, outputHeight |
negativePrompt |
auto_prompt |
Describe an image as a render prompt (plain text) | image |
— |
edit_by_prompt |
Apply an edit instruction | image, prompt |
referenceImage |
change_textures |
Retexture masked surfaces | image, mask, exactly one of prompt / referenceImage |
outputFormat |
set_atmosphere |
Change interior lighting or exterior atmosphere | image, sceneType; interior: lighting; exterior: at least one of timeOfDay / season / weather |
Additional exterior controls, outputFormat |
animate |
Animate a frame or transition between frames (video URL) | startFrameUrl, prompt |
endFrameUrl, speed |
upscale |
Upscale to 4K or 8K | image |
targetResolution, outputFormat |
upscale_4k |
Legacy 4K endpoint; prefer upscale |
image |
outputFormat |
balance |
Read the current account balance without a charge | — | — |
Stdio quality-of-life tools (no API charge):
| Tool | What it does |
|---|---|
preview_image |
Fetch a URL and return the image inline, so the assistant (and GUI clients) can see it |
save_image |
Download an image URL to disk |
validate_image_url |
Check an input URL is a reachable image before a paid generation |
usage_summary |
Session totals: requests, USD spent, last-known balance |
list_recent_generations |
Recent image/video/text results, cost, balance and request IDs |
Image inputs accept a public HTTPS URL reachable by MyArchitectAI or an inline data:image/<mime>;base64,<payload> URI. Output formats are endpoint-specific: upscale accepts jpg/webp/png, but PNG is unavailable at 8K and AVIF is unsupported. Text-to-image dimensions are 128–2048px. Requests have a 10 MB body limit; prefer URLs for large inputs.
The API responds synchronously, streaming while it works. Animation typically takes 60–90 seconds, or 20–30 seconds with speed: "fast"; configure your MCP host's tool timeout to accommodate it. Image utilities do not preview or download videos; open the returned animation URL in a video-capable client.
The stdio server exposes 17 tools, covering all 12 API operations in the published API reference. The hosted connector exposes those 12 API operations. API contract maintenance describes the snapshot and automated drift checks.
Install
Local stdio installations require Node.js 24 or newer. Use a current patch release of a supported LTS version; CI covers Node 24 and 26. Node 18, 20 and 22 are no longer supported. Hosted connector users do not need to install Node.js.
You need a MyArchitectAI API key — create one in the portal. Itis passed via the MYARCHITECTAI_API_KEY environment variable and sent as the x-api-key header.Requests also include x-myarchitectai-source: mcp for reported usage attribution; this marker grants no permissions.
Claude Code
claude mcp add myarchitectai \
--env MYARCHITECTAI_API_KEY=your-api-key \
-- npx -y @myarchitectai/mcp
Claude Desktop
Add to claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"myarchitectai": {
"command": "npx",
"args": ["-y", "@myarchitectai/mcp"],
"env": { "MYARCHITECTAI_API_KEY": "your-api-key" }
}
}
}
Cursor, Windsurf, VS Code, and other MCP hosts
Use the same stdio launch — command npx, args ["-y", "@myarchitectai/mcp"], withMYARCHITECTAI_API_KEY in env — in that host's MCP config. (Note: VS Code's config uses the keyservers, not mcpServers.)
Claude Code plugin
For one-command setup with a bundled image-compare skill and a /render workflow, install thecompanion plugin: myarchitectai-claude-plugin.
/plugin marketplace add MyArchitectAI/myarchitectai-claude-plugin
/plugin install myarchitectai@myarchitectai
Docker
A Dockerfile is included. Build and run the stdio server (keep stdin attached with -i; no portis exposed):
docker build -t myarchitectai-mcp .
docker run -i -e MYARCHITECTAI_API_KEY=your-api-key myarchitectai-mcp
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
MYARCHITECTAI_API_KEY |
yes | — | Your API key (sent as x-api-key). |
MYARCHITECTAI_BASE_URL |
no | https://api.myarchitectai.com/v1 |
Override the API base URL. |
MYARCHITECTAI_TIMEOUT_MS |
no | 120000 |
Total call timeout including retries, backoff and body in ms (1000–600000). |
MYARCHITECTAI_MAX_RETRIES |
no | 2 |
Safe retries inside the total timeout, 0 disables (0–10). |
MYARCHITECTAI_DOWNLOAD_DIR |
no | renders |
Directory save_image writes to. |
MYARCHITECTAI_MAX_PREVIEW_BYTES |
no | 5000000 |
Max bytes preview_image embeds inline before falling back to a URL. |
MYARCHITECTAI_STATE_FILE |
no | — | Optional path to persist generation history across restarts. |
Stdio requests have a 64 MiB buffer limit, enough for the base64 representation of the largest supported inline preview (50,000,000 image bytes). For larger source images, preview_image and save_image accept a local file path or HTTPS URL. Clients requesting large inline previews must also allow the corresponding response size; otherwise keep MYARCHITECTAI_MAX_PREVIEW_BYTES within the client's response limit. Tool arguments are limited to 10,000 object members and array elements before schema validation. Hosted requests retain their separate 1,000,000-byte default body limit.
Behavior
- Success → a text summary listing the generated image URL(s), cost, and balance, plus
structuredContentof the shape{ output: string[], balance: number, cost: number, requestId?: number }.auto_promptreturnsoutput: stringcontaining text;balancereturns only{ balance }. Amounts are USD. Request IDs are preserved for support. - API/validation errors (bad input, invalid key, rate limits, server errors) are returned as tool results with
isError: trueand a clear message. Public safety errors includestructuredContentwith{ error, code, balance?, cost?, requestId? }; absent fields remain absent. API output schemas declare separate strict success and public safety alternatives, so clients can validate errors after discovering tools. Other hosted errors keep upstream details masked. - Content safety:
CONTENT_POLICY_VIOLATIONreturnsRequest blocked by content policy; its positivecostremains charged even though there is no usable output.SAFETY_CHECK_UNAVAILABLEreturnsContent safety check unavailableand follows the automatic refund path;costbecomes0once the refund succeeds. If the refund fails,costmay remain positive; trust the returned finalcostandbalance. Both preserve the API'scode,balance,costandrequestIdwhen provided, including streamed HTTP 200 failures. Neither triggers an automatic retry or provider fallback, even at HTTP 429/502. An unavailable check may be retried later only by an explicit caller decision. - Session usage:
usage_summary.totalCostand per-tool costs include retained positive policy charges. Successful generation totals, per-tool counts andlist_recent_generationsstill include successful outputs only; rejected requests incrementfailedGenerations. WithMYARCHITECTAI_STATE_FILE, successful history, failure count, retained charges and the last-known balance are saved together. Existing history-only files remain readable. - Safe retries: direct paid operations retry ordinary HTTP 429 and 502 responses, which the API guarantees were not charged; safety codes always take precedence. Hosted paid operations are never retried automatically. Unknown outcomes (network errors, timeouts and other 5xx responses) are never automatically replayed. Read-only balance lookups can retry transient failures. Backoff, every attempt and response-body consumption share one
MYARCHITECTAI_TIMEOUT_MSbudget. Inspect the API request log before manually retrying an uncertain paid call.
API diagnostics are JSON lines on stderr; stdout remains the MCP protocol channel. Logs include endpoint, status, outcome, duration and request ID without prompts, media, keys or response bodies. No production analytics or error telemetry is sent.
Keeping the API current
npm run build
npm run api:check # registered tools against the reviewed snapshot
npm run api:check:live # also compare with the current published OpenAPI
npm run api:update # refresh snapshot; then align code and tests
CI checks the live contract on PRs, main pushes and manual dispatch. A spec change fails the check and requires review; runtime capabilities never change silently.
Authentication
The stdio server authenticates to the MyArchitectAI API with an API key (x-api-key) from your environment. It also sends x-myarchitectai-source: mcp as a client-reported analytics marker, separate from authentication. Credential handling is isolated in src/config.ts and the client's header injection. The executable is myarchitectai-mcp; the generic mcp alias has been removed. Existing npx -y @myarchitectai/mcp configurations still select the package's single executable.
The repository also prepares an OAuth-protected stateless Streamable HTTP connector for the company's Vercel account. It verifies an audience-bound OAuth token and delegates the 12 existing API operations to the API Portal backend with a separate signed internal request. The hosted runtime uses API Portal accounts and API balance. Portal retains customer keys, ownership checks and billing. Hosted MCP has no history store, Redis, or local media utilities; stdio retains its existing tools and local history. The connector is live at https://mcp.myarchitectai.com/mcp (OAuth 2.0 with dynamic client registration via portal.myarchitectai.com). See the integration contract, hosted runtime configuration, and production deployment setup. The deployment workflow is production-only; there are no preview deployments. Hosted paid calls through Portal are never automatically retried, because an intermediary error cannot prove that generation was uncharged.
Contributing
Contributions are welcome — please open an issue or PR. The published npm package is built from thisrepository.
Use the latest Node 24 LTS patch release and its bundled npm for development and release tooling. The .nvmrc file selects this major version for local development and workflow setup; run nvm install and nvm use after cloning if you use nvm. The container uses Node 24. Vercel currently selects Node 24 for the package's >=24 engine range, but can select a newer major when it becomes available on Vercel; this range does not pin the managed runtime. The npm package supports Node 24 or newer; CI builds and tests on Node 24 and 26.
git clone https://github.com/MyArchitectAI/myarchitectai-api-mcp.git
cd myarchitectai-api-mcp
npm install
npm run build # compile TypeScript to dist/
npm run typecheck # strict type-check of src + tests
npm test # unit + integration tests (node:test)
node scripts/smoke.mjs # spawn the built server and list its tools over stdio
npm run smoke:remote # built HTTP server, synthetic accounts only; no API charges
Run npm run build && npm run typecheck && npm test before submitting a PR.
To point an MCP host at your local build instead of the published package, use the commandnode with args ["/absolute/path/to/dist/index.js"].
Project layout
src/
index.ts entry point: load config, register tools, serve over stdio
config.ts env loading/validation + server identity
client.ts HTTP client: auth, timeout, retries, response/error mapping
errors.ts typed error hierarchy (retryable vs not)
schemas.ts Zod input/output schemas (mirror the API)
tools.ts tool registration + result/error formatting
media.ts image fetch/save/preview helpers (the QoL tools)
session.ts in-memory (optionally persisted) generation history
test/ node:test suites (config, client, media, session, end-to-end MCP)
docs/ DISTRIBUTION.md — per-host coverage & transport notes
Releasing (maintainers)
Published as @myarchitectai/mcp via npmTrusted Publishing (OIDC) — no token is stored. CI runsbuild/typecheck/tests on every push and PR; pushing a vX.Y.Z tag triggers.github/workflows/release.yml, which publishes with provenance.
npm version patch # or minor / major — bumps package.json and creates the tag
git push --follow-tags
One-time setup: publish once manually (npm publish --access public) so the package exists, thenattach the GitHub Actions trusted publisher under the npm package's Settings → Trusted Publisher(organization MyArchitectAI, repository myarchitectai-api-mcp, workflow release.yml).
License
MIT © MyArchitectAI