# MCP server

Layer provides an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that lets you generate images, 3D assets, video, and audio directly from AI conversations — no code required.

The server is available at `https://mcp.app.layer.ai/mcp` over Streamable HTTP. Most clients connect with OAuth; some use a Personal Access Token.

[Setup](/docs/mcp/setup)Connect Claude, Cursor, VS Code, Codex, and more.

[Tools](/docs/mcp/tools)The tools the server exposes, grouped by category.

Administering a workspace (projects, members, usage) is handled by a **separate** [Management MCP server](/docs/mcp/management) — kept apart so its admin tools don’t crowd the creative toolset.

## How it works

Once connected, the MCP server exposes tools for workspaces, models, workflows, forge (direct model execution), and files. Your AI agent selects and calls them automatically based on your prompts — see [MCP tools](/docs/mcp/tools) for the full list.

## Interactive results (MCP Apps)

The server ships an [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) view, so a generation renders **inside the conversation** — you see and browse the images, video, 3D, or audio as they come back, instead of a run id to follow up on.

Nothing to install or configure. Clients that negotiate the `io.modelcontextprotocol/ui` extension (Claude and ChatGPT among them) render the view automatically; clients that don’t get the same structured result as before.

`ui://layer/execute-generation` — `text/html;profile=mcp-app`, rendered for `execute_forge`, `execute_workflow`.

The view inventory is also published unauthenticated at [/.well-known/mcp](https://layer.ai/.well-known/mcp) (`mcp_apps`), since an MCP client cannot list resources before completing the OAuth connection.

## Example prompts

Once connected, try prompts like:

* _“Generate 4 variations of a crystal sword icon on a transparent background”_
* _“Show me what image models are available for my workspace”_
* _“Create a 3D model of a treasure chest from this reference image”_
* _“Run the product shot workflow with a photo of my item”_
* _“How many Creative Units do I have left?”_

Your AI agent will pick the right tools, estimate costs, run the generation, and show you the results.

## Error codes

| Code                  | Status | Meaning                                                                                                        |
| --------------------- | ------ | -------------------------------------------------------------------------------------------------------------- |
| UNAUTHENTICATED       | 401    | OAuth connection not completed — reconnect in your Connectors settings                                         |
| FORBIDDEN             | 403    | You don’t have permission for this action                                                                      |
| INSUFFICIENT\_BALANCE | 402    | Not enough Creative Units — top up in **Settings > Billing**                                                   |
| RATE\_LIMITED         | 429    | Too many requests — generation is limited to 60/min (plus 30/min for video) per user. Retry after Retry-After. |
| WORKSPACE\_NOT\_FOUND | 404    | Workspace doesn’t exist or you’re not a member                                                                 |
| MODEL\_NOT\_FOUND     | 404    | Model not found or not available in this workspace                                                             |
| WORKFLOW\_NOT\_FOUND  | 404    | Workflow not found or not linked to this workspace                                                             |
| RUN\_NOT\_FOUND       | 404    | Workflow or forge run doesn’t exist                                                                            |
| INVALID\_INPUTS       | 400    | Malformed parameters or UUIDs                                                                                  |
| UPLOAD\_FAILED        | 400    | File could not be downloaded or stored                                                                         |

Having trouble connecting? See the [setup troubleshooting](/docs/mcp/setup#troubleshooting) section.
