Trakt Entertainment Gateway
STDIOBridge between AI language models and Trakt.tv API for entertainment data access.
Bridge between AI language models and Trakt.tv API for entertainment data access.
A Model Context Protocol (MCP) server that creates a bridge between AI language models and the Trakt.tv API, allowing LLMs to access real-time entertainment data and personal Trakt viewing history.
Other than this paragraph, everything here has been generated by AI, including the code. I had a goal to learn more about MCP and have been playing a lot with Cursor, so it seemed like a natural next move to bring these together. The result was this project. All changes moving forward will also be done by AI.
Model Context Protocol (MCP) is an open specification that enables Large Language Models (LLMs) like Claude to interact with external systems and data sources.
MCP creates a standardized way for AI models to:
At its core, MCP works by defining:
trakt://shows/trending
)fetch_trending_shows
)MCP servers like this one act as bridges between AI models and the external world, allowing them to be extended with new capabilities without requiring retraining.
Trakt.tv is a platform that automatically tracks what TV shows and movies you watch. The service offers:
Trakt has become the standard for entertainment tracking with:
This MCP server taps into Trakt's rich API ecosystem to bring real-time entertainment data directly to your conversations with AI assistants like Claude.
This entire project was developed using Cursor, a code editor built for the AI era, with Claude 3.7 Sonnet generating all code. This approach demonstrates:
As of April 2025, you can access trending shows like:
The hottest movies right now:
Resource | Description | Example Data |
---|---|---|
trakt://shows/trending | Most watched shows over the last 24 hours | Show title, year, watchers count |
trakt://shows/popular | Most popular shows based on ratings | Show title, year, popular score |
trakt://shows/favorited | Most favorited shows | Show title, year, favorites count |
trakt://shows/played | Most played shows | Show title, year, play count |
trakt://shows/watched | Most watched shows by unique users | Show title, year, watcher count |
Resource | Description | Example Data |
---|---|---|
trakt://movies/trending | Most watched movies over the last 24 hours | Movie title, year, watchers count |
trakt://movies/popular | Most popular movies based on ratings | Movie title, year, popular score |
trakt://movies/favorited | Most favorited movies | Movie title, year, favorites count |
trakt://movies/played | Most played movies | Movie title, year, play count |
trakt://movies/watched | Most watched movies by unique users | Movie title, year, watcher count |
Resource | Description | Example Data |
---|---|---|
trakt://user/auth/status | Current authentication status | Authentication status, token expiry |
trakt://user/watched/shows | Shows watched by the authenticated user | Show title, year, last watched date, play count |
trakt://user/watched/movies | Movies watched by the authenticated user | Movie title, year, last watched date, play count |
Resource | Description | Example Data |
---|---|---|
trakt://comments/movie/:id | Comments for a specific movie | Comment text, author, date, likes |
trakt://comments/show/:id | Comments for a specific show | Comment text, author, date, likes |
trakt://comments/show/:id/season/:season | Comments for a specific season | Comment text, author, date, likes |
trakt://comments/show/:id/season/:season/episode/:episode | Comments for a specific episode | Comment text, author, date, likes |
trakt://comments/:id | A specific comment | Comment text, author, date, likes |
trakt://comments/:id/replies | Replies to a specific comment | Reply text, author, date |
Resource | Description | Example Data |
---|---|---|
trakt://shows/:id/ratings | Ratings for a specific show | Average rating, vote count, distribution |
trakt://movies/:id/ratings | Ratings for a specific movie | Average rating, vote count, distribution |
# Get trending shows with optional limit parameter fetch_trending_shows(limit=10) # Get popular shows with optional limit parameter fetch_popular_shows(limit=10) # Get favorited shows with optional limit and period parameters fetch_favorited_shows(limit=10, period="weekly") # Get most played shows with optional limit and period parameters fetch_played_shows(limit=10, period="weekly") # Get most watched shows with optional limit and period parameters fetch_watched_shows(limit=10, period="weekly") # Search for shows by title to get show IDs and details search_shows(query="Breaking Bad", limit=5) # Search for movies by title to get movie IDs and details search_movies(query="The Godfather", limit=5)
# Get trending movies with optional limit parameter fetch_trending_movies(limit=10) # Get popular movies with optional limit parameter fetch_popular_movies(limit=10) # Get favorited movies with optional limit and period parameters fetch_favorited_movies(limit=10, period="weekly") # Get most played movies with optional limit and period parameters fetch_played_movies(limit=10, period="weekly") # Get most watched movies with optional limit and period parameters fetch_watched_movies(limit=10, period="weekly")
# Start the device authorization flow with Trakt start_device_auth() # Check the status of an ongoing authentication check_auth_status() # Clear authentication (logout) clear_auth() # Fetch shows watched by the authenticated user fetch_user_watched_shows(limit=0) # 0 for all shows # Fetch movies watched by the authenticated user fetch_user_watched_movies(limit=0) # 0 for all movies
# Method 1: Check in using show ID (recommended when precision is important) # First use search_shows to find the correct show ID search_shows(query="Breaking Bad", limit=5) # Then use the ID for check-in checkin_to_show( season=1, episode=3, show_id="1388", message="Loving this show!" ) # Method 2: Check in using show title (more convenient) checkin_to_show( season=1, episode=1, show_title="Breaking Bad", show_year=2008, # Optional but helps with accuracy message="I'm the one who knocks!", share_twitter=True, share_mastodon=False, share_tumblr=False )
# Get comments for a movie (sorted by newest by default) fetch_movie_comments(movie_id="123", limit=10, show_spoilers=False) # Get comments for a show sorted by most likes fetch_show_comments(show_id="456", limit=10, show_spoilers=False, sort="likes") # Get comments for a specific season sorted by highest rating fetch_season_comments(show_id="456", season=1, limit=10, show_spoilers=False, sort="highest") # Get comments for a specific episode sorted by most replies fetch_episode_comments(show_id="456", season=1, episode=3, limit=10, show_spoilers=False, sort="replies") # Get a specific comment fetch_comment(comment_id="789", show_spoilers=False) # Get a comment with its replies sorted by oldest first fetch_comment_replies(comment_id="789", limit=10, show_spoilers=False, sort="oldest")
# Get ratings for a show fetch_show_ratings(show_id="game-of-thrones") # Get ratings for a movie fetch_movie_ratings(movie_id="tron-legacy-2010")
The server uses Trakt's device authentication flow:
You can log out at any time using the clear_auth
tool.
Clone this repository
git clone https://github.com/yourusername/mcp-trakt.git cd mcp-trakt
Install dependencies
pip install -r requirements.txt
Set up your environment
cp .env.example .env
Then edit .env
to add your Trakt API credentials:
TRAKT_CLIENT_ID=your_client_id
TRAKT_CLIENT_SECRET=your_client_secret
Run the server
python server.py
mcp dev server.py
mcp install server.py
# Install test dependencies pip install -r requirements-dev.txt # Run all tests pytest # Run with verbose output pytest -v -s # Type checking pyright # Code linting and formatting with ruff ruff check ruff format --check
Once installed, you can ask Claude questions like:
Claude will use this MCP server to provide you with real-time data from Trakt.
With authentication, you can access:
All data is fetched directly from your Trakt account in real-time.
Built with 🧠 AI and human collaboration
Powered by Cursor + Claude 3.7 Sonnet