CrewAI agents use Pexafy through its MCP server, https://mcp.pexafy.com/mcp, with your API key in the Authorization header. The agent searches free-to-use photos (Unsplash, Pexels, Pixabay and more) and gets each one back with its licence and credit line.

Install

pip install crewai
export PEXAFY_API_KEY="pexafy_..."   # free key: pexafy.com/dashboard/api-keys/create
export OPENAI_API_KEY="sk-..."       # CrewAI's default model provider
Create a key at pexafy.com/dashboard/api-keys/create. Any Pexafy key works.

Use

import os

from crewai import Agent, Crew, Task
from crewai.mcp import MCPServerHTTP, create_static_tool_filter

illustrator = Agent(
    role="Illustrator",
    goal="Find free stock photos and give each photo's credit line",
    backstory="You pick real photos that match what a text is about.",
    mcps=[
        MCPServerHTTP(
            url="https://mcp.pexafy.com/mcp",
            headers={"Authorization": f"Bearer {os.environ['PEXAFY_API_KEY']}"},
            tool_filter=create_static_tool_filter(
                allowed_tool_names=["search_photos", "search_photos_by_image"]
            ),
        )
    ],
)

task = Task(
    description="Find a header photo for a post about remote work.",
    expected_output="The photo URL and its credit line.",
    agent=illustrator,
)

print(Crew(agents=[illustrator], tasks=[task]).kickoff())
The tool filter keeps the two search tools. The other tools are for chat clients, where a person views a photo grid or links an account. On the free plan, show the credit line next to each photo you publish. See what the MCP server can do for the full tool list.