MCPServerAdapter to authenticate and retrieve an image project you
already created. This example calls native BaseTool.run methods directly. It
requires no Agent, Crew, language model or model-provider key, and starts no new
generation or media download.
Install and configure
Use Python 3.12. Download recover-image.py and requirements.txt into the same private directory, then install the normal declared dependencies:crewai==1.15.22 and crewai-tools[mcp]==1.15.22, matching the
existing upstream quickstart PR.
These are the full released packages; the example does not remove their dependencies.
Provide a Magic Hour API key through
your normal private process environment or secret manager. Keep it out of source,
notebook cells, prompts and shared logs. Select an image project owned by that account:
MAGIC_HOUR_API_KEY from its own environment. No model-provider
credentials are needed for direct tool invocation.
Retrieve a status snapshot
The adapter connects tohttps://mcp.magichour.ai/ using Streamable HTTP and bearer
authorization. It admits only account_retrieve and image_projects_retrieve_details.
The account call verifies field types before printing an authorization marker; account
values are not printed. The project call supplies only the saved id and checks that
the response contains that exact ID and a string status.
The runnable example is:
Connection lifecycle and privacy
The released adapter passes a single MCP text block through as text. The example parses the API-backed tools’ JSON response and validates its shape before reporting success. Any failure produces a static message without a raw response, account values or temporary download URL.MCPServerAdapter connects during construction. Its context manager disconnects after
the calls, including when validation fails; do not call start() again inside it.
The script sets supported OTEL_SDK_DISABLED and CREWAI_DISABLE_TELEMETRY flags
before importing CrewAI. Keep verbose tool/response logging and tracing off when
handling private metadata. Use a dedicated working directory and preserve any existing
CrewAI storage when cleaning up your own disposable run.
Verification scope
The exact example ran with CrewAI and CrewAI Tools 1.15.22, MCP 1.28.1 and MCPAdapt 0.1.20 on Python 3.12 with all normal declared dependencies. Its two filtered native tools verified account field types and retrieved an existing image project with the requested ID andcomplete status. The process exited successfully with no stderr;
neither the key nor private response data appeared in captured output. The context
closed, and the owned process and private runtime state were cleaned up.
This verifies native direct tool invocation and saved-project metadata retrieval.
It does not verify a model-driven Crew, image/video creation or media preservation.
The optional Crew branch in the existing upstream notebook remains separately
unverified; an open PR does not imply upstream acceptance.
See Magic Hour MCP,
image-project retrieval, and the
released CrewAI MCP adapter.