How rugvedp/trends-mcp works
1. Repository shape
- This is a small Python MCP service centered on a single server entrypoint: src/server.py (also referenced as server.py in the README).
- The other top-level files are support artifacts: requirements.txt for Python dependencies, mcp_config_mac.json / mcp_config_win.json for client launch configuration, test.py for local testing, and temp.json as a scratch/output file.
2. Core runtime boundary
- The main runtime is FastMCP.
- The server is launched either directly with fastmcp run server.py or indirectly through an MCP client configuration that shells out via uv.
- This makes the repository an MCP tool provider rather than a traditional web application.
3. Primary responsibility
- The service aggregates “what’s trending” data from social platforms and exposes it as MCP tools.
- Its job is to translate MCP tool calls into platform-specific scraping/API requests, then return normalized results to the caller.
4. Exposed tool layer
- The README lists six tools:
- YouTube comments by video ID
- YouTube global trending
- YouTube region-specific trending
- YouTube video metadata
- TikTok trending summaries
- Instagram Reels weekly trend scraping
- These tools form the public API surface of the repository.
5. YouTube subsystem
- YouTube features are implemented through a mix of scraping and metadata extraction.
- Dependencies such as youtube-comment-downloader and yt_dlp suggest two different data paths:
- comment retrieval from a video ID
- video/trending metadata extraction
- The YouTube trending endpoints likely read from public feeds or pages rather than authenticated APIs.
6. TikTok subsystem
- TikTok trending is handled via RapidAPI, not direct scraping.
- The README indicates an external token is required, passed through environment configuration (tiktok in the MCP config).
- This creates a clear dependency boundary: the server delegates TikTok data acquisition to a third-party API provider.
7. Instagram subsystem
- Instagram Reels trends are collected by scraping Later.com’s blog post about trends.
- This is a pure HTML-parsing path using requests and beautifulsoup4.
- The dependency is intentionally indirect: the repo does not talk to Instagram itself, but to a third-party article that summarizes trends.
8. Data flow
- MCP client or local CLI invokes a tool.
- FastMCP routes the call into the corresponding function in server.py.
- That function fetches data from an external site/API, parses or summarizes it, then returns structured content back through the MCP response channel.
- The architecture is therefore request/response with no persistent internal datastore.
9. External integrations and trust boundaries
- External dependencies are the main architectural risk and variability:
- YouTube public pages and unofficial comment scraping
- TikTok RapidAPI
- Later.com HTML structure
- The README explicitly notes that YouTube scraping and Instagram parsing may break if upstream layouts change, which means the system is brittle to upstream UI changes.
10. Configuration and deployment
- The provided MCP config files are important for local integration with desktop or CLI MCP clients.
- They define the command invocation and environment variables needed to start the server.
- The repo appears designed for local/private use rather than a hosted multi-tenant service.
11. Dependencies that materially affect the architecture
- fastmcp defines the tool-server model.
- requests and beautifulsoup4 support HTTP fetching and parsing.
- yt_dlp and youtube-comment-downloader support YouTube-specific extraction.
- These libraries imply a scraping-heavy architecture with lightweight Python orchestration, not a database-backed service.
12. What to draw in an architecture diagram
- A central FastMCP server box in Python.
- Six tool handlers inside it.
- Three external data-source groups: YouTube, TikTok RapidAPI, and Later.com.
- A client boundary on the left for MCP consumers/CLI.
- An env-config/input boundary for the TikTok token.
- No persistent storage, queueing, or internal microservices are indicated by the repository structure.
Main entry points: server.py FastMCP server · requirements.txt Dependencies · mcp_config_mac.json Mac config · mcp_config_win.json Windows config
Components 19
MCP clients
Local desktop or CLI consumers that invoke the server
- MCP client · Calls exposed tools through MCP
- uv/CLI · Starts the server locally from config or shell
Python MCP runtime
FastMCP server and its tool handlers
- FastMCP server · Main server entrypoint and dispatcher
src/server.py - YT comments · Fetch comments by video ID
src/server.py - YT trending · Fetch global YouTube trending content
src/server.py - YT region trend · Fetch region-specific YouTube trending content
src/server.py - YT metadata · Extract YouTube video metadata
src/server.py - TikTok trend · Summarize TikTok trending content
src/server.py - Instagram reels · Scrape weekly Instagram Reels trends
src/server.py
External sources
Upstream sites and APIs scraped or queried by the tools
- YouTube pages · Public video, trending, and feed pages
- Comment source · Unofficial comment retrieval from video IDs
- YT metadata feed · Video metadata extraction path used by yt_dlp
- RapidAPI · External TikTok data provider requiring a token
- Later.com post · Blog article parsed for Instagram Reels trends
Support files
Launch configs and local support artifacts
- Dependencies · Pinned runtime libraries and scraper dependencies
requirements.txt - Mac config · macOS MCP launch configuration
mcp_config_mac.json - Windows config · Windows MCP launch configuration
mcp_config_win.json - Scratch file · Temporary output or test data
temp.json - Local test · Manual testing entrypoint
test.py
Connections 22
- MCP client → FastMCP server: MCP calls · Client invokes server tools
- uv/CLI → Mac config: launches · Local CLI can start the server using config
- uv/CLI → Windows config: launches · Windows client config starts the server
- Mac config → FastMCP server: runs · Launch config points at the FastMCP entrypoint
- Windows config → FastMCP server: runs · Launch config points at the FastMCP entrypoint
- Dependencies → FastMCP server: supports · Dependencies enable the MCP runtime and scrapers
- Local test → FastMCP server: tests · Local testing exercises server behavior
- FastMCP server → YT comments: exposes · Registers tool handler
- FastMCP server → YT trending: exposes · Registers tool handler
- FastMCP server → YT region trend: exposes · Registers tool handler
- FastMCP server → YT metadata: exposes · Registers tool handler
- FastMCP server → TikTok trend: exposes · Registers tool handler
- FastMCP server → Instagram reels: exposes · Registers tool handler
- YT comments → Comment source: scrapes · Fetches comments from video IDs
- YT trending → YouTube pages: reads · Pulls global trending data from public pages
- YT region trend → YouTube pages: reads · Pulls region-specific trending data from public pages
- YT metadata → YT metadata feed: extracts · Uses metadata extraction path for videos
- TikTok trend → RapidAPI: queries · Delegates TikTok trending lookup to RapidAPI
- Instagram reels → Later.com post: parses · Scrapes trend summaries from Later.com
- YT comments → Dependencies: depends on · Uses scraper libraries
- YT metadata → Dependencies: depends on · Uses yt_dlp metadata extraction
- TikTok trend → Mac config: uses token · MCP config provides environment token for the API