Plex Media Server MCP server

Integrates with Plex media servers to enable browsing, searching, and managing media libraries, including content querying, metadata editing, poster management, and playback control.
Back to servers
Setup instructions
Provider
Vladimir Tutin
Release date
Mar 21, 2025
Language
Python
Stats
19 stars

This server provides a standardized interface for interacting with Plex Media Server through a JSON-based API. It allows for automation, scripting, and integration with other tools by offering a consistent way to manage your Plex libraries, collections, playlists, and more.

Getting Started

Requirements

  • Python 3.8+
  • Plex Media Server with valid authentication token
  • Access to the Plex server (locally or remotely)

Installation

Follow these steps to install and configure the Plex MCP Server:

  1. Clone the repository to your local machine
  2. Install the required dependencies:
pip install -r requirements.txt
  1. Create a configuration file by copying the example:
cp .env.example .env
  1. Edit the .env file to add your Plex credentials:
PLEX_URL=http://your-plex-server:32400
PLEX_TOKEN=your-plex-token

Usage Options

Using STDIO Transport

The STDIO transport mode is ideal for direct integration with applications like Claude Desktop or Cursor. In this mode, the server accepts commands via standard input and outputs results in JSON format.

To start the server in STDIO mode:

python3 -m plex_mcp

Or alternatively:

python3 plex_mcp_server.py --transport stdio

Configuration Example for Client Applications

If you're integrating with Claude Desktop or Cursor, add this configuration to your application settings:

{
  "plex": {
    "command": "python",
    "args": [
      "C://Users//User//Documents//plex-mcp-server//plex_mcp_server.py",
      "--transport=stdio"
    ],
    "env": {
      "PLEX_URL":"http://localhost:32400",
      "PLEX_TOKEN":"av3khi56h634v3",
      "PLEX_USERNAME:"Administrator"
    }
  }
}

Using SSE Transport

The Server-Sent Events (SSE) transport provides a web-based interface for integration with web applications and services.

To start the server with SSE transport:

python3 plex_mcp_server.py --transport sse --host 0.0.0.0 --port 3001

Default configuration:

  • Host: 0.0.0.0 (accessible from any network interface)
  • Port: 3001
  • SSE endpoint: /sse
  • Message endpoint: /messages/

SSE Client Configuration

When using SSE mode, configure your client with:

{
  "plex": {
    "url": "http://localhost:3001/sse"
  }
}

Available Commands

Library Management

  • List libraries
  • Get library statistics
  • Refresh libraries
  • Scan for new content
  • Get library details
  • Get recently added content
  • Get library contents

Media Operations

  • Search for media
  • Get detailed media information
  • Edit media metadata
  • Delete media
  • Get and set artwork
  • List available artwork

Playlist Management

  • List playlists
  • Get playlist contents
  • Create playlists
  • Delete playlists
  • Add/remove items to/from playlists
  • Edit playlist details
  • Upload custom poster images
  • Copy playlists to other users

Collection Management

  • List collections
  • Create collections
  • Add/remove items to/from collections
  • Edit collection details

User Management

  • Search for users
  • Get user information
  • Get user's on deck content
  • Get user watch history

Server Administration

  • Get Plex server logs
  • Get server information
  • Get bandwidth statistics
  • Get current resource usage
  • Get and run butler tasks
  • Get server alerts

Client Control

  • List clients
  • Get client details
  • Get client timelines
  • Get active clients
  • Control playback (play, pause, etc.)
  • Navigate client interfaces
  • Set audio/subtitle streams

Note: The Client Module functionality may be limited as some features are still in development.

Response Format

All commands return standardized JSON responses with a consistent structure:

Successful Operations

{
  "success_field": true,
  "relevant_data": "value",
  "additional_info": {}
}

Error Responses

{
  "error": "Error message describing what went wrong"
}

Search Results (Multiple Matches)

[
  {
    "title": "Item Title",
    "id": 12345,
    "type": "movie",
    "year": 2023
  },
  {
    "title": "Another Item",
    "id": 67890,
    "type": "show",
    "year": 2022
  }
]

This standardized format ensures compatibility with various tools, automation platforms, and AI systems.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "plex" '{"command":"python","args":["plex_mcp_server.py","--transport=stdio"],"env":{"PLEX_URL":"http://localhost:32400","PLEX_TOKEN":"av3khi56h634v3","PLEX_USERNAME":"Administrator"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "plex": {
            "command": "python",
            "args": [
                "plex_mcp_server.py",
                "--transport=stdio"
            ],
            "env": {
                "PLEX_URL": "http://localhost:32400",
                "PLEX_TOKEN": "av3khi56h634v3",
                "PLEX_USERNAME": "Administrator"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "plex": {
            "command": "python",
            "args": [
                "plex_mcp_server.py",
                "--transport=stdio"
            ],
            "env": {
                "PLEX_URL": "http://localhost:32400",
                "PLEX_TOKEN": "av3khi56h634v3",
                "PLEX_USERNAME": "Administrator"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later