youtube_helper.mcp module
YouTube Helper — Model Context Protocol (MCP) surface.
Adapter that exposes the FastAPI app defined in youtube_helper.api
as MCP tools so an MCP-aware client (Claude Desktop, custom agents, IDE
integrations, …) can call metadata / resolve / list-streams
/ channel-info / … as first-class tools. Uses fastapi_mcp
(https://github.com/tadata-org/fastapi_mcp) — one line wraps the whole
existing HTTP surface, so we never duplicate the route definitions.
Install the extra to pull in fastapi-mcp:
pip install 'youtube-helper[api,mcp]'
Then run the MCP server:
youtube-helper-mcp # entry point (see pyproject)
# or, equivalently:
python -m youtube_helper.mcp
Usage Example
>>> # Register the MCP endpoint in your client. It publishes:
>>> # metadata / valid / resolve / list-streams / pick-stream /
>>> # channel-info / channel-videos / engagement / engagement-batch /
>>> # comments / ytdlp-version / video / audio / thumbnail / subtitles
>>> # …with the same argument names as the FastAPI routes.
- youtube_helper.mcp.main()[source]
Entry point for the
youtube-helper-mcpconsole script.Boots the FastAPI app (which now serves both the
/…HTTP routes and the MCP endpoint) withuvicornin single-worker mode. Meant for local / container usage; behind a real load balancer useuvicorn/gunicorndirectly.- Return type:
None