How to give your coding agent real images
Coding agents write a whole landing page in a minute and then fill every image slot with a gray box, a stock placeholder service, or a URL they made up that returns 404. The fix is to give the agent an image search tool. With the Lightdrift MCP server connected, the agent searches 1.85 million openly licensed photos, downloads the one that fits, and adds the credit line the license asks for.
Updated
1. Connect the image search MCP server
Lightdrift runs as a remote MCP server at https://lightdrift.ai/mcp. In Claude Code:
claude mcp add --transport http lightdrift https://lightdrift.ai/mcpIn Codex:
codex mcp add lightdrift --url https://lightdrift.ai/mcp
codex mcp login lightdriftIn Cursor, add the server to .cursor/mcp.json:
{
"mcpServers": {
"lightdrift": { "url": "https://lightdrift.ai/mcp" }
}
}Sign in when the browser opens, or use an API key header instead. Setup for other clients is on the image search MCP page. The free plan includes 500 credits a month, enough for up to 5,000 results.
2. Tell the agent how to use images
Add a short rule to AGENTS.md, CLAUDE.md, or a Cursor rule so the agent uses the tool every time instead of falling back to placeholders:
## Images
- Never use placeholder images or invent image URLs.
- When a page needs a photo, call the lightdrift search_images tool with a
specific description of the subject, framing, and mood.
- Download the chosen file into public/images/ and reference it locally.
- If attribution_required is true, render the attribution string in a
<figcaption> or in a credits section linked from the footer.
- Only use results where commercial is true for commercial projects.3. Ask for specific images
Search is semantic, so describe the image the way you would brief a photographer. Good queries name the subject and the use:
rainbow darter fish, side view, bright breeding colorswide photo of a coastal lighthouse at dusk with empty sky for a headlineoverhead shot of kraft paper texture, warm lightNASA X-38 test vehicle under its parafoil
Specific subjects are where retrieval beats image generation: a generated rainbow darter is a plausible invention, while a retrieved one is the real species with the right field marks. See the field guide example, built by an agent with twelve retrieval calls.
4. Handle licenses and attribution
Each result carries a rights object: license, commercial, derivatives, attribution_required, and a ready-made attribution string. By default, search only returns licenses that permit commercial use. Licenses are reported as declared by the source; people, logos, and artworks in a photo can carry separate rights. Read how rights answers work.