Labsco
djbriane logo

Plex MCP Server

β˜… 6

from djbriane

Search for movies and manage playlists on your Plex Media Server using the Plex API.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredNeeds API keys

Plex MCP Server

smithery badge

This is a Python-based MCP server that integrates with the Plex Media Server API to search for movies and manage playlists. It uses the PlexAPI library for seamless interaction with your Plex server.

Screenshots

Here are some examples of how the Plex MCP server works:

1. Find Movies in Plex Library by Director

Search for movies in your Plex library by specifying a director's name. For example, searching for "Alfred Hitchcock" returns a list of his movies in your library.

Find movies by director


2. Find Missing Movies for a Director

Identify movies by a specific director that are missing from your Plex library. This helps you discover gaps in your collection.

Find missing movies


3. Create a Playlist in Your Plex Library

Create a new playlist in your Plex library using the movies found in a search. This allows you to organize your library efficiently.

Create a playlist

Available Commands

The Plex MCP server exposes these commands:

CommandDescriptionOpenAPI Reference
search_moviesSearch for movies in your library by various filters (e.g., title, director, genre) with support for a limit parameter to control the number of results./library/sections/{sectionKey}/search
get_movie_detailsGet detailed information about a specific movie./library/metadata/{ratingKey}
get_movie_genresGet the genres for a specific movie./library/sections/{sectionKey}/genre
list_playlistsList all playlists on your Plex server./playlists
get_playlist_itemsGet the items in a specific playlist./playlists/{playlistID}/items
create_playlistCreate a new playlist with specified movies./playlists
delete_playlistDelete a playlist from your Plex server./playlists/{playlistID}
add_to_playlistAdd a movie to an existing playlist./playlists/{playlistID}/items
recent_moviesGet recently added movies from your library./library/recentlyAdded

Code Style and Conventions

  • Module Structure:
    Use clear section headers for imports, logging setup, utility functions, class definitions, global helpers, tool methods, and main execution (guarded by if __name__ == "__main__":).

  • Naming:
    Use CamelCase for classes and lower_snake_case for functions, variables, and fixtures. In tests, list built-in fixtures (e.g. monkeypatch) before custom ones.

  • Documentation & Comments:
    Include a concise docstring for every module, class, and function, with in-line comments for complex logic.

  • Error Handling & Logging:
    Use Python’s logging module with consistent error messages (prefix β€œERROR:”) and explicit exception handling.

  • Asynchronous Patterns:
    Define I/O-bound functions as async and use asyncio.to_thread() to handle blocking operations.