Coding agents can write a landing page, but the images are usually
placeholders. stock-images-mcp is a small MCP server that lets the agent find
real photos and save them into your project.
What it does
The server has two tools. search_images queries Pexels, Unsplash and Pixabay,
one provider or all of them, and returns each photo's description, size,
photographer, photographer URL and download URL. download_image saves the
chosen photo into a folder in your project.
In the demo I asked for three photos of a rainy city street at night and for
the most atmospheric landscape one to be downloaded. The agent searched, picked
one from the results, saved it into downloads/ and told me which credit to
add. It chose from the descriptions and sizes in the search results. It did not
look at the images.
Setup
You need at least one free API key from Pexels, Unsplash or Pixabay. Add the
server to your MCP config for Claude Code, Cursor or Claude Desktop:
{
"mcpServers": {
"stock-images": {
"command": "npx",
"args": ["-y", "stock-images-mcp"],
"env": { "PEXELS_API_KEY": "your-key-here" }
}
}
}
It needs Node.js 22 or newer, and there is a Docker image too.
Letting an agent download files
A download tool that an agent controls should be strict about what it accepts.
It only takes https URLs on pexels.com, unsplash.com and pixabay.com, and
redirects can only go to those hosts. It saves only image/* responses, with a
50 MiB limit and a 30 second timeout. Paths that escape the download folder are
rejected, symlinks included, and it never overwrites an existing file.
If one provider fails, you still get results from the others, with a
per-provider error list. For Unsplash downloads the tool calls their download
endpoint, which their API guidelines require.
The images stay under each provider's license. The search results include the
photographer's name and URL so you can credit them where the license asks for it.
Repo: https://github.com/jeanpfs/stock-images-mcp
npm: https://www.npmjs.com/package/stock-images-mcp
MIT licensed.

Top comments (0)