Skip to main content

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-key constant 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 — not must not match do not lean), and require ≥1 token to actually appear in the item's title/tags/slug. A test with zzzqqqxxx_not_exist_9999 returns 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/html response 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_health exists precisely to catch that the day it happens.

License

MIT

Metadata

Release files for pexels-mcp 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pexels-mcp 1.0.0
File Size Uploaded Provenance Actions
pexels_mcp-1.0.0.tar.gz 18.0 kB Without provenance Details for pexels_mcp-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pexels-mcp 1.0.0
File Interpreter ABI Platform Actions
pexels_mcp-1.0.0-py3-none-any.whl Python 3 none any Details for pexels_mcp-1.0.0-py3-none-any.whl

Total release size: 39.2 kB

Release files / pexels_mcp-1.0.0.tar.gz

Download URL pexels_mcp-1.0.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
02874ddb59651fc6b533231669dc43c78afdd903deba96663e1beb4d2b049a14
BLAKE2b-256 checksum
How to use checksums
b107575fe5ebab9fa9e744e4ae2f0a36a41f1125e995ff92323d0f39e6104c1e
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.0-py3-none-any.whl

Download URL pexels_mcp-1.0.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d86631aa7154690bbfc19ab90b9144e15bb367d575ce65a70cfa6203bfdde76
BLAKE2b-256 checksum
How to use checksums
68418454759350b155bc0fe5e2d38fb9a39cb23401f20cca8e3abc708e89ed34
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.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page