affinity-mcp
CLAUDE.md2 starsChanged 27 days agoMITView on GitHub
Guidance for Claude Code (and other agents) working on this repository. To use Affinity, read skills/affinity/SKILL.md; general agent instructions are in AGENTS.md. An agent skill plus plugins (Claude Code, Cursor, Codex) that let AI agents control Affinity by Canva from the inside: through the app's built-in MCP server (http://localhost:6767/sse) and its JavaScript SDK (execute_script). No UI automation, no OS permissions beyond Affinity's own MCP toggles. The SDK cannot reach some UI-only features: choosing the Canva AI model (Nano Banana, GPT…
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Verify recipes on a new scratch document (create, test, close() without saving).
- Very specific: line 25
Keep plugin versions in sync across .claude-plugin/plugin.json, .claude-plugin/marketplace.json, .cursor-plugin/plugin.json, …
- Distinctive: line 26
No personal data in anything committed (names in examples, home paths, private images, session UUIDs).
- Very specific: line 45
Write our own small module rather than copying theirs, so the code stays under this project's license.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for Claude Code (and other agents) working on this repository. To use Affinity, read skills/affinity/SKILL.md; general agent instructions are in AGENTS.md.
What this project is
An agent skill plus plugins (Claude Code, Cursor, Codex) that let AI agents control Affinity by Canva from the inside: through the app's built-in MCP server (http://localhost:6767/sse) and its JavaScript SDK (execute_script). No UI automation, no OS permissions beyond Affinity's own MCP toggles.
| Path | Purpose |
skills/affinity/SKILL.md | The skill: working loop, safety rules, router to references. Keep under 500 lines |
skills/affinity/references/ | API references (sdk-core, commands-index, vector, pixel, text-layout, export, ai, system, setup, safety, gotchas) |
skills/affinity/references/recipes/ | Task recipes; each states what was verified on a real Affinity build |
.claude-plugin/, .mcp.json | Claude Code plugin + marketplace (claude plugin validate . must pass) |
.cursor-plugin/, mcp.json | Cursor plugin |
.codex-plugin/, .agents/plugins/marketplace.json | Codex plugin + marketplace (stdio via the bridge) |
scripts/affinity-sse-bridge.mjs | Zero-dependency, loopback-only stdio <-> SSE relay |
evals/evals.json | Skill Creator test prompts |
research/ | Local research notes, git-ignored, never published |
Rules for changes
- Skill content is English, imperative and evidence-based. Never document an API that was not run or found in the official SDK docs; tag docs-only claims
(docs)and untested ones(unverified). - Verify recipes on a new scratch document (create, test,
close()without saving). Never touch the user's open documents. Ask before any Canva AI call that consumes credits. - Keep plugin versions in sync across
.claude-plugin/plugin.json,.claude-plugin/marketplace.json,.cursor-plugin/plugin.json,.codex-plugin/plugin.jsonandCHANGELOG.md. - No personal data in anything committed (names in examples, home paths, private images, session UUIDs).
- Talk to the maintainer in Arabic; keep code and repository files in English.
Status (v1.0.0)
- Recipes marked verified were run on Affinity 3.3.1 (macOS) during development.
cutout.mdis not yet verified end to end. - The full Skill Creator eval loop (with-skill vs baseline runs and the review viewer) has not been run yet. The prompts are ready in
evals/evals.json.
Future: optional UI-automation fallback (not planned for now)
The SDK cannot reach some UI-only features: choosing the Canva AI model (Nano Banana, GPT Image, Seedream, FLUX...), Generative Expand/Fill/Upscale, Generate Vector/3D, Decompose Layer, tool and panel switching. A UI-automation layer could cover them.
Reference project: sekharmalla/affinity-mcp-server (MIT, TypeScript/Bun, about 28 stars, 4 commits). It is a separate stdio MCP server with 23 tools that drive Affinity through AppleScript and System Events: menus, UI element clicks, keystrokes, mouse drags via Python Quartz, and screenshots. It does not use the built-in MCP server or the SDK.
What we tested (2026-10-18): the server starts and lists all 23 tools, but every call fails with osascript is not allowed assistive access (-1728) until the host app gets macOS Accessibility permission (screenshots also need Screen Recording). We did not test beyond that. Still unknown: whether Affinity's Canva AI Studio panels (model picker, Expand, Upscale) are exposed in the accessibility tree, or only reachable by screen coordinates.
If we add it later, the approach is:
- Feasibility probe first: with Accessibility granted, check whether the AI Studio controls are addressable by name. If they are only reachable by coordinates, drop the idea (too fragile and risky).
- Also test whether SDK AI commands inherit the model last chosen in the UI. If they do, model choice needs no UI automation at all.
- Write our own small module rather than copying theirs, so the code stays under this project's license. If any of their code is copied, keep their MIT notice in a
THIRD_PARTY_NOTICES.md. - Make it opt-in and off by default, macOS-only, limited to an allowlist: named menu items, model selection, Expand/Upscale. No save, close, delete or free typing.
- The skill keeps the SDK as the primary path and uses the UI layer only when no SDK route exists, with the same verify-by-render loop.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

