Use Copera Designs with Your Coding Agent
Design an app, dashboard, or set of pages as an artifact in Copera, then hand it to your coding agent to build for real. Claude Code, Codex, OpenCode, and Cursor connect to Copera MCP Cloud and read everything they need with a single tool call: get_artifact_handoff.
What your agent receives
get_artifact_handoff returns the whole artifact in one read:
| Part | What it contains |
|---|---|
| Spec | The artifact's Spec — what it is for, who uses it, and how it should behave. |
| Notes | The notes people pinned to pages or to the Spec. |
| Design | The shared design: guidance, tokens, and components files, plus logos, fonts, and images with short-lived download links. |
| Pages | Every page with its surface, viewport size, entry file, and the files it loads. |
| Links | How the pages link to each other (the flows between screens). |
| Source files | The artifact's source, with file contents included. |
Set it up
Coding agents that run on your computer connect with a Personal Access Token. In Copera, open Workspace Settings → Integrations, create a Personal Access Token, and give it Drive access (the access_drive scope). Copy the token (cp_pat_…) — treat it like a password. See Authentication for details.
Replace <YOUR_TOKEN> with your token. These are the same lines Copera shows in an artifact's Export → Build it with your coding agent menu.
- Claude Code
- Codex
- OpenCode
- Cursor
Run in your terminal:
claude mcp add --transport http copera https://mcp.copera.ai/mcp --header "Authorization: Bearer <YOUR_TOKEN>"
Add to ~/.codex/config.toml:
[mcp_servers.copera]
url = "https://mcp.copera.ai/mcp"
bearer_token_env_var = "COPERA_TOKEN"
Then make the token available to Codex:
export COPERA_TOKEN="<YOUR_TOKEN>"
Save this as opencode.json in your project. If the file already exists, add the copera entry inside its mcp object instead:
{
"mcp": {
"copera": {
"type": "remote",
"url": "https://mcp.copera.ai/mcp",
"headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
}
}
}
Save this as .cursor/mcp.json in your project. If the file already exists, add the copera entry inside its mcpServers object instead:
{
"mcpServers": {
"copera": {
"url": "https://mcp.copera.ai/mcp",
"headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
}
}
}
Restart or reload the agent so it picks up the copera server.
Copy the prompt from the same Export menu and send it to your agent:
Build the <artifact name> artifact from Copera
Add anything about your stack, for example "as a Next.js app with Tailwind". The agent finds the artifact with list_artifacts, calls get_artifact_handoff, and builds from the result.
How the agent builds
get_artifact_handoff tells the agent what to do next, in this order:
- Read the Spec — the intent, the people who use it, and the rules.
- Read the notes — feedback and decisions pinned to pages.
- Set up the design — tokens, components, fonts, logos, and images first, so every page shares them.
- Build each page from its files, at its surface and viewport size.
- Wire the links between pages so the flows work.
By default the agent gets the latest version of the artifact that built successfully. To build a specific version, pass its versionId (find it with list_artifact_versions).
To keep tool results small, file contents are included up to 32 KiB by default. Larger files come back marked omitted: "over_budget", and the agent reads them with read_artifact_source. If your client accepts large tool results, the agent can raise maxInlineBytes (up to 1 MiB).
opencode.json and .cursor/mcp.json often live inside a project. If you paste your token there, do not commit the file. Rotate the token in Workspace Settings → Integrations if it ever leaks.
Troubleshooting
| Symptom | Likely cause |
|---|---|
401 Unauthorized | The token is missing, mistyped, or expired. Check the Authorization: Bearer … value. |
403 Forbidden on an artifact tool | The token lacks Drive access (access_drive), or Artifacts isn't available in your workspace. |
| The artifact isn't found | The token's user can't open that artifact. Ask its owner to share it with you. |
| The agent asks you to sign in | It's trying to connect without your token. Re-check the setup line from step 2. |
Related
- Tool reference — Artifacts — every artifact tool and its inputs.
- Connect an MCP client — endpoint details and testing with the MCP Inspector.
- Artifacts in Drive — create, upload, and share artifacts in Copera.