Can Claude Code Generate Images? Here’s How
Short answer: Claude Code cannot generate images on its own. It is a text-based coding agent that runs in your terminal. It can write code, edit files, run commands, and reason about your codebase, but it has no built-in image generation model. With MCP tools connected, though, Claude Code gains access to image generation without leaving your session.
What Claude Code Can Do Natively
Claude Code is built for software development. It reads and writes files, runs shell commands, searches codebases, and holds context across long sessions. If you need to scaffold a project, debug a tricky function, or refactor a module, it handles that well.
It also understands image formats conceptually. It can write HTML that references images, generate SVG markup, create CSS gradients, and produce data URIs. If your “image” can be expressed as code (like an SVG icon or a CSS pattern), Claude Code can build it. But that is fundamentally different from producing a photograph, illustration, or raster graphic.
Claude Code supports MCP, which means it can call external tools that are registered in its configuration. This is the path to actual image generation.
What It Cannot Do Without Tools
Claude Code cannot produce raster images: no PNGs, no JPEGs, no AI-generated photographs or illustrations. If you ask it to “generate a hero image for my landing page,” it will either explain that it cannot or attempt to write code that calls an image API, which still requires you to have that API configured separately.
This matters for workflows where images are part of the deliverable. Blog post hero graphics, placeholder assets during development, social media cards, documentation diagrams that go beyond what SVG can handle. These all require an external image generation service.
How MCP Tools Fill the Gap
AgentPatch provides a Recraft-powered image generation tool through MCP. Recraft produces realistic photos, digital illustrations, and vector-style output. When you connect AgentPatch to Claude Code, the agent can call this tool mid-session, generate an image, and continue working with it.
The workflow stays inside your terminal. You describe the image you want, Claude Code calls the tool, and the result comes back. You can then ask Claude Code to save it to your project’s asset directory, reference it in your HTML, or use it in a README.
You don’t need a Recraft account or API key. AgentPatch handles the authentication and billing through your single API key.
Setup
The AgentPatch CLI is designed for AI agents to use via shell access. Install it, and your agent can discover and invoke any tool on the marketplace.
Install (zero dependencies, Python 3.10+):
pip install agentpatch
Set your API key:
export AGENTPATCH_API_KEY=your_api_key
Example commands your agent will use:
ap search "web search"
ap run google-search --input '{"query": "test"}'
Get your API key from the AgentPatch dashboard.
Skill (Recommended)
Install the AgentPatch skill — it teaches Claude Code when to use AgentPatch and how to use the CLI:
/plugin marketplace add fullthom/agentpatch-claude-skill
/plugin install agentpatch@agentpatch
MCP Server (Alternative)
If you prefer raw MCP tool access instead of the skill:
claude mcp add -s user --transport http agentpatch https://agentpatch.ai/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your actual key from the AgentPatch dashboard.
Example
You’re building a documentation site and need visual assets:
“Generate an illustration of a three-layer architecture: client, API server, and database. Use a clean, minimal style with a white background and dark blue elements.”
Claude Code calls the Recraft tool through AgentPatch and returns the image. You can follow up:
“Save that to docs/assets/architecture.png and add it to the architecture page.”
Claude Code handles the file placement and updates the markdown reference.
For a more creative use case, say you’re working on a marketing page:
“Generate a realistic photo of a laptop on a wooden desk with a code editor on screen. Warm lighting, shallow depth of field.”
The tool produces the image. Claude Code can then resize it, convert the format, or embed it in your HTML template, all in the same session.
If the result needs adjustment:
“Make the background darker and add a coffee cup to the left side of the frame.”
Claude Code calls the tool again with the revised prompt. The iteration loop stays fast because you never leave the terminal.
Wrapping Up
Claude Code is a text and code agent, not an image generator. But with AgentPatch connected via MCP, it gains access to Recraft image generation alongside web search, email, Google Maps, and dozens of other tools. One configuration, one API key. Visit agentpatch.ai to get started.