pexels-mcp
MCP + CLI toolkit to search and download free Pexels stock images/videos.
- Zero third-party dependencies — pure Python standard library (urllib). Install, run, done.
- No API key, no quota — talks to Pexels' own web front-end API v3 (the public
secret-keyconstant Pexels hardcodes in its JS). - Built-in relevance gate — Pexels returns something for any query (even
zzzqqqxxx_not_exist_9999). This tool validates every candidate against title/tags and drops 0-hit junk, so you never get unrelated footage. - Right resolution tier, automatically — picks the video_files tier closest to your target (default 1080×1920 portrait) and refuses to upscale postage-stamp clips.
- Chinese query rejected — the English site can't search Chinese meaningfully. Translate to concrete English words (
office meeting>work).
Works as an MCP server (5 tools) or a plain CLI.
Quick start
pip install pexels-mcp # or: uvx pexels-mcp@latest
As an MCP server
{
"mcpServers": {
"pexels": {
"command": "uvx",
"args": ["pexels-mcp@latest"],
"env": { "PEXELS_OUT_DIR": "/tmp/pexels_download" }
}
}
}
Any MCP client (Claude Desktop, CowAgent, …) sees 5 tools:
| tool | what it does |
|---|---|
pexels_search |
search only, returns direct links + size/duration metadata; no junk hits |
pexels_get |
search and download N items to a local dir, returns paths + byte counts |
pexels_download |
download a single direct link you already have |
pexels_health |
channel self-check; includes a reverse probe (a nonsense query must return 0 hits) |
pexels_info |
capability boundary, no network |
PEXELS_OUT_DIR sets the download folder (default: OS temp dir).
As a CLI
pexels-cli search "elderly woman face" --kind video -n 5
pexels-cli search "office meeting" --json
pexels-cli get "hands holding cash" -o ./out -n 2
pexels-cli health
pexels-cli info
All subcommands support --json for machine-readable output.
Why it's reliable
- No fake hits: Pexels fabricates total_results even for nonsense queries. We split your query into content tokens (with a stop-word list —
notmust not matchdo not lean), and require ≥1 token to actually appear in the item's title/tags/slug. A test withzzzqqqxxx_not_exist_9999returns 0 hits. - No decompression trap: we request
Accept-Encoding: identity(avoid brotli unless you have it) and fall back to gunzip. - Throttle-safe: measured 100 sequential + 8-way parallel direct downloads at 100% success with no Cloudflare intervention.
- Bomb fuse: downloads stream with size cap, and a
text/htmlresponse is rejected as a Cloudflare block page masquerading as HTTP 200.
Notes
- This package is just "give me a keyword → get good direct-link stock media". It does not assemble videos — pair it with an assembler MCP (e.g.
video-assembler-mcp) for the full pipeline. - The endpoint is Pexels' own public web API and could change at any time. It's a third-party behavior, out of our control;
pexels_healthexists precisely to catch that the day it happens.
License
MIT
Metadata
Release files for pexels-mcp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pexels_mcp-1.0.1.tar.gz | 19.6 kB | Without provenance | Details for pexels_mcp-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pexels_mcp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pexels_mcp-1.0.1-py3-none-any.whl |
Total release size: 41.6 kB
Release files / pexels_mcp-1.0.1.tar.gz
| Download URL | pexels_mcp-1.0.1.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b0c2cbe0091f33f5d8560ec2edae3e5dbcfc2eb0b1dbbaa43b1b28071e503ac
|
|
BLAKE2b-256 checksum How to use checksums |
0749a33527236ccb2589d3032543d039e0003da04b846caec53bab6f8540faf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Release files / pexels_mcp-1.0.1-py3-none-any.whl
| Download URL | pexels_mcp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2de7ffd585766e216c31f01a6f3f12dabd18df67a24c575e824c324b43d4ddd
|
|
BLAKE2b-256 checksum How to use checksums |
efa29862ae1279b1deea7d0675d46c394d3b483a842c77f9fe59179899ce9202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.7
|
Security for pexels-mcp 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.