Search and download free stock images from Pexels, Unsplash, and Pixabay.
An MCP (Model Context Protocol) server for searching and downloading stock images from Pexels, Unsplash, and Pixabay.
| Provider | Env var | Get a key |
|---|---|---|
| Pexels | PEXELS_API_KEY | https://www.pexels.com/api/ |
| Unsplash | UNSPLASH_API_KEY | https://unsplash.com/developers |
| Pixabay | PIXABAY_API_KEY | https://pixabay.com/api/docs/ |
Optional: STOCK_IMAGES_DOWNLOAD_DIR — where download_image writes files (default ./downloads).
Add to your MCP config (~/.claude/mcp.json, ~/.cursor/mcp.json, or claude_desktop_config.json):
{
"mcpServers": {
"stock-images": {
"command": "npx",
"args": ["-y", "stock-images-mcp"],
"env": {
"PEXELS_API_KEY": "your-key-here",
"UNSPLASH_API_KEY": "your-key-here",
"PIXABAY_API_KEY": "your-key-here"
}
}
}
}
Requires Node.js 20+.
docker build -t stock-images-mcp .
docker run -i --rm -e PEXELS_API_KEY=xxx -v "$PWD/downloads:/downloads" stock-images-mcp
git clone https://github.com/jeanpfs/stock-images-mcp.git
cd stock-images-mcp
npm ci && npm run build
PEXELS_API_KEY=xxx node dist/index.js
Search for stock images across configured providers.
Parameters:
query (required): search termprovider: "pexels", "unsplash", "pixabay", or "all" (default: "all")count: results per provider (default 5, max 20)orientation: "landscape", "portrait", or "square"Each result has id, provider, url, thumbnail, description, author, authorUrl, downloadUrl, width, height. Pass downloadUrl to download_image.
Download an image into the download directory.
Parameters:
url (required): https image URL on pexels.com, unsplash.com or pixabay.com (use downloadUrl from search_images)filename: output name — letters, digits, _, -, . only; the extension is added from the content-type if missing (auto-generated if omitted)folder: subfolder inside the download directoryBehavior and limits:
./downloads, or STOCK_IMAGES_DOWNLOAD_DIR if set. Paths that escape it (including via symlinks) are rejected.image/* responses are saved; max 50 MiB; 30 s timeout; redirects are followed only to allowed hosts.UNSPLASH_API_KEY: the tool calls Unsplash's download endpoint, as their API guidelines require.Failures return isError: true. search_images also returns a per-provider errors list when some providers fail but others succeed. Provider requests time out after 10 s and are retried on network errors, 429 and 502/503/504.
Images stay under each provider's license. Credit the photographer where the provider requires it (author and authorUrl are returned for that purpose) and review the terms: Pexels, Unsplash, Pixabay.
npm ci
npm run lint && npm run format:check && npm run typecheck && npm test
See CONTRIBUTING.md and SECURITY.md.
MIT
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y stock-images-mcpMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-jeanpfs-stock-images-mcp": {
"command": "npx",
"args": [
"-y",
"stock-images-mcp"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referencestock-images-mcpnpmStock Images MCP works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.