Skip to main content

A MCP server to allow LLM's to interact with your plex server

Project description

๐ŸŽฌ Plex MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to interact with your Plex Media Server! ๐Ÿš€

TL;DR

To use this server with an MCP client (like Cursor), add this configuration to your MCP settings:

{
  "mcpServers": {
    "plex-mcp": {
      "command": "uvx",
      "args": [
        "plex-mcp",
        "--baseurl",
        "<PLEX_BASEURL>",
        "--token",
        "<PLEX_TOKEN>"
      ]
    }
  }
}

Replace <PLEX_BASEURL> / <PLEX_TOKEN> with your actual Plex server URL and authentication token.

โœจ Features

๐ŸŽฅ Movies

  • Search movies by title, genre, year, or rating
  • Browse recently added movies
  • Get detailed movie info including cast, directors, and ratings
  • Filter by year ranges and rating criteria

๐ŸŽต Music

  • Search music tracks and artists
  • Create and manage playlists
  • Get random tracks by decade for discovery
  • Browse music library information

๐Ÿ“บ TV Shows

  • Search TV shows and episodes
  • Browse episodes by season
  • Get detailed episode information
  • Find recently added shows

๐ŸŽฎ Client Control

  • Control Plex clients remotely (play, pause, stop, seek)
  • Navigate client interfaces (up, down, left, right, select, back)
  • Set volume levels on connected clients
  • Get playback state information
  • Play media on specific clients

๐Ÿ“š Collections

  • Create and manage collections of movies, shows, or music
  • Add/remove items from collections
  • Search collections by title or criteria
  • Update collection metadata (title, summary)
  • Delete collections when no longer needed

โš™๏ธ Settings & Management

  • View and modify server settings
  • Get library section information
  • Scan libraries for new media
  • Empty trash to free up space
  • Analyze libraries for metadata
  • Get detailed server information

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.12+
  • A running Plex Media Server
  • Plex authentication token

Installation

# Clone the repository
git clone https://github.com/knguyen1/plex-mcp.git
cd plex-mcp

# Install dependencies
uv venv && uv sync

Configuration

Set up your Plex server credentials:

export PLEX_BASEURL="http://localhost:32400"  # Your Plex server URL
export PLEX_TOKEN="your-plex-token-here"      # Your Plex token

Finding your Plex token:

  1. Go to your Plex server web interface
  2. Navigate to Settings โ†’ Network
  3. Look for "Plex Token" or use browser dev tools to find the X-Plex-Token header

Running the Server

uv run plex-mcp

๐ŸŽฏ Sample Use Cases

๐ŸŽฌ Movie Discovery

"Find all sci-fi movies from the 80s with ratings above 7.0"
"Show me recently added action movies"
"What are the highest rated movies in my library?"

๐ŸŽต Music Curation

"Create a playlist of random 90s rock songs"
"Find all tracks by The Beatles"
"Show me my most recently added music"

๐Ÿ“บ TV Show Management

"List all episodes of Breaking Bad season 1"
"Find shows I haven't watched yet"
"What's the latest episode of The Office?"

๐ŸŽฎ Remote Control

"Play Inception on my living room TV"
"Pause the current show on my phone"
"Set volume to 50% on the bedroom client"
"Navigate up and select on the Apple TV"

๐Ÿ“š Collection Management

"Create a collection called 'Marvel Movies'"
"Add all Iron Man movies to the Marvel collection"
"Find collections with 'action' in the title"
"Update the description of my 'Holiday Movies' collection"

โš™๏ธ Server Management

"Show me all server settings"
"Scan my Movies library for new content"
"Empty trash in the Music library"
"Get detailed information about my Plex server"

๐Ÿ” Smart Search

"Find movies similar to Inception"
"Show me horror movies from the last 5 years"
"Create a workout playlist with high-energy songs"

๐Ÿ› ๏ธ Available Tools

Movies ๐ŸŽฅ

  • search_movies - Search movies by title
  • get_movies_library - Get library information
  • get_movie_info - Detailed movie information
  • search_movies_by_genre - Filter by genre
  • search_movies_by_year - Filter by year/range
  • get_recently_added_movies - Latest additions
  • get_movies_by_rating - Filter by rating

Music ๐ŸŽต

  • search_music_tracks - Search music library
  • get_music_library - Library information
  • create_music_playlist - Create playlists
  • get_random_tracks_by_decade - Random discovery
  • search_tracks_by_artist - Artist-specific search
  • get_playlist_info - Playlist details
  • delete_playlist - Remove playlists

TV Shows ๐Ÿ“บ

  • search_tv_shows - Search TV library
  • get_tv_shows_library - Library information
  • get_show_episodes - Episode listings
  • get_episode_info - Episode details
  • search_episodes_by_show - Show-specific episodes
  • get_recently_added_shows - Latest additions

Client Control ๐ŸŽฎ

  • list_clients - List all connected Plex clients
  • get_client_info - Get detailed client information
  • play_media - Play media on a specific client
  • control_playback - Control playback (play, pause, stop, seek)
  • set_volume - Set volume on a client
  • navigate_client - Navigate client interface
  • get_playback_state - Get current playback state

Collections ๐Ÿ“š

  • list_collections - List all collections in a library
  • get_collection_info - Get detailed collection information
  • create_collection - Create a new collection
  • add_to_collection - Add items to a collection
  • remove_from_collection - Remove items from a collection
  • update_collection - Update collection metadata
  • delete_collection - Delete a collection
  • search_collections - Search collections by title

Settings & Management โš™๏ธ

  • get_server_settings - Get all server settings
  • get_setting - Get a specific server setting
  • set_setting - Set a server setting value
  • get_library_sections - Get all library sections
  • scan_library - Scan a library for new media
  • empty_trash - Empty trash for a library
  • analyze_library - Analyze library for metadata
  • get_server_info - Get detailed server information

๐Ÿ”ง Development

Setup Development Environment

# Install development dependencies
uv venv && uv sync

# Run linting
uv run ruff check --fix && uv run ruff format

# Run tests
pytest

Project Structure

src/plex_mcp/
โ”œโ”€โ”€ client/           # Plex API client
โ”œโ”€โ”€ sections/         # Media type handlers
โ”‚   โ”œโ”€โ”€ movies.py     # Movie operations
โ”‚   โ”œโ”€โ”€ music.py      # Music operations
โ”‚   โ”œโ”€โ”€ tv_shows.py   # TV show operations
โ”‚   โ”œโ”€โ”€ client_control.py  # Client control operations
โ”‚   โ”œโ”€โ”€ collections.py     # Collection management
โ”‚   โ””โ”€โ”€ settings.py       # Server settings & management
โ””โ”€โ”€ __init__.py       # Main server entry point

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with FastMCP framework
  • Uses PlexAPI for Plex integration
  • Inspired by the Model Context Protocol specification

Happy streaming! ๐ŸŽฌ๐ŸŽต๐Ÿ“บ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plex_mcp-0.2.0.tar.gz (328.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plex_mcp-0.2.0-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file plex_mcp-0.2.0.tar.gz.

File metadata

  • Download URL: plex_mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 328.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plex_mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7eeb40c7bc24a6ae27f53e03c840840fa35b83d8c55181d40ab91105441c0cc2
MD5 327bfcaa6a87d0701406c8a3fe471ef3
BLAKE2b-256 495ae82579d65aacdd5b84f631bd907e48cc5dc2c61565f520da0e119caeb26c

See more details on using hashes here.

Provenance

The following attestation bundles were made for plex_mcp-0.2.0.tar.gz:

Publisher: publish.yml on knguyen1/plex-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plex_mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: plex_mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for plex_mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 827d47762e4109866a0ba3b956544d0a62ed594996e7bd6762ee22ede11581a2
MD5 584d7dfafd41d2c55d44851868dc2ea3
BLAKE2b-256 14d19120e8da6007a0849443918dcf8d913313b6899c632aa2315fcda8396f22

See more details on using hashes here.

Provenance

The following attestation bundles were made for plex_mcp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on knguyen1/plex-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page