Plex MCP Server
The Plex MCP Server provides AI assistants with comprehensive access to your Plex Media Server through 12 tools, enabling natural language queries for library management, viewing statistics, and media analysis.
Core Capabilities:
Library Management - Browse all Plex libraries, search across movies, TV shows, episodes, music (artists, albums, tracks), and retrieve detailed metadata for any media item
Content Discovery - View recently added media, access "On Deck" (continue watching) queue, find recently watched and fully watched content with flexible filtering
Watch History & Analytics - Track comprehensive watch history with session details, viewing patterns, and customizable time ranges (default 30 days)
Tautulli-Style Statistics - Access detailed analytics including watch statistics (plays, duration), user activity insights, library usage metrics, popular content rankings, and platform breakdowns
Advanced Filtering - Filter by media type, library sections, specific users, and configurable result limits
Optional Integrations:
Sonarr/Radarr (via plex-arr-server) - Search, add, and manage series/movies using TVDB/TMDB IDs, view download queues and missing items, trigger searches, and monitor service status
Trakt.tv Sync (via plex-trakt-server) - Authenticate and sync Plex watch history, access enhanced statistics, search the Trakt database, and enable real-time scrobbling
Natural Language Interface - Query your media ecosystem with commands like "What movies did I watch last week?", "Show me my most popular TV shows", or "Find action movies in my library" through AI assistants.
Provides comprehensive access to a Plex Media Server, allowing querying of libraries, viewing statistics, user activity tracking, media searching, and content management through natural language interactions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Plex MCP Serverwhat movies did I watch last week?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Plex MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to your Plex Media Server, Sonarr, Radarr, and Trakt.tv — all from a single unified server.
What is this?
This MCP server transforms your Plex Media Server into an AI-queryable database. Ask your AI assistant questions like:
"What movies have I watched recently?"
"Show me my viewing statistics for the past month"
"What's the most popular content on my server?"
"Find action movies in my library"
"What's on my continue watching list?"
"Add that new show to Sonarr"
"What's in my download queue?"
"Sync my watch history to Trakt"
"Recommend me some movies I haven't seen"
Related MCP server: YARR Media Stack MCP Server
Features
45 tools out of the box (54 with write operations enabled):
Plex Library Management — Browse libraries, search media, get detailed metadata, list playlists and watchlist
Tautulli-Style Analytics — Viewing statistics, user activity, popular content, watch history
Personalized Recommendations — AI-powered movie suggestions based on your watch history, genres, directors, and actors. Supports per-user profiles for multi-user Plex servers.
Sonarr/Radarr Integration — Browse, search, add series/movies, view queues, trigger downloads
Trakt.tv Sync — OAuth authentication, watch history sync, enhanced statistics, scrobbling. When configured, Trakt data enriches recommendations by catching movies watched outside Plex.
Write Operations (opt-in) — Create/edit playlists, update metadata, manage watchlist
One server, all tools. Trakt and Sonarr/Radarr credentials are optional — tools that need them return a helpful setup message if the key is missing. You don't need to configure everything upfront.
Quick Start
Prerequisites
Node.js 20+
Plex Media Server (any recent version)
Plex Token (How to get your token)
MCP-compatible client (Claude Desktop, etc.)
Installation
# Clone the repository
git clone https://github.com/niavasha/plex-mcp-server.git
cd plex-mcp-server
# Install dependencies
npm install
# Build the project
npm run buildOr install directly from npm:
npx plex-mcp-serverConfiguration
Get your Plex token (see instructions below)
Configure your MCP client (e.g., Claude Desktop):
{
"mcpServers": {
"plex": {
"command": "node",
"args": ["/path/to/plex-mcp-server/build/plex-mcp-server.js"],
"env": {
"PLEX_URL": "http://localhost:32400",
"PLEX_TOKEN": "your_plex_token_here",
"SONARR_URL": "http://localhost:8989",
"SONARR_API_KEY": "optional_sonarr_api_key",
"RADARR_URL": "http://localhost:7878",
"RADARR_API_KEY": "optional_radarr_api_key",
"TRAKT_CLIENT_ID": "optional_trakt_client_id",
"TRAKT_CLIENT_SECRET": "optional_trakt_client_secret"
}
}
}
}Only
PLEX_TOKENis required. All other credentials are optional — tools for unconfigured services return a clear error message explaining how to set them up, rather than crashing the server.
Sonarr/Radarr API keys can be found at Settings > General > API Key in each app's web UI.
Trakt.tv setup requires a Trakt OAuth application. Create one with redirect URI
urn:ietf:wg:oauth:2.0:oob, then add the Client ID and Secret to your config. Once the server is running, ask your AI assistant to "authenticate with Trakt" — it will guide you through the OAuth flow. See the Trakt setup guide for detailed instructions.
In v1.0.x there were three separate server binaries (build/index.js, build/plex-trakt-server.js, build/plex-arr-server.js). In v1.1.0+ these are replaced by a single unified binary: build/plex-mcp-server.js.
The old binaries still work but emit a deprecation warning. Update your MCP config to point to build/plex-mcp-server.js and remove any duplicate server entries.
See the migration guide for full details.
Usage
Once configured, you can ask your AI assistant:
"What movies did I watch last week?"
"Show me my most popular TV shows this month"
"Give me viewing statistics for the past 30 days"
"Search for Night of the Living Dead in my library"
"What's on my continue watching list?"
"List all my Plex libraries"
"Add that new show to Sonarr"
"What's in my Radarr download queue?"
"Sync my Plex history to Trakt"Recommended Workflows
Sync Plex watch history to Trakt:
Set up Trakt credentials (see above)
Ask: "Authenticate with Trakt" — follow the OAuth flow
Ask: "Do a dry run sync of my Plex history to Trakt" — preview what would sync
Ask: "Sync my Plex watch history to Trakt" — run the actual sync
Find and add new content:
Ask: "Search Sonarr for The Beverly Hillbillies" — find the TVDB ID
Ask: "Add The Beverly Hillbillies to Sonarr" — it auto-detects quality profiles and root folders
Ask: "What's in my Sonarr download queue?" — monitor progress
Get personalized recommendations:
Ask: "Recommend me some movies from my library"
The engine analyzes your watch history — genres, directors, actors, ratings
Scores every unwatched movie and returns the top matches with reasons
For multi-user servers, specify the user: "Recommend movies for Titus"
If Trakt is configured, it automatically uses your Trakt history too — catching movies you watched outside Plex (other platforms, before tracking was set up)
Cross-platform viewing analytics:
Ask: "Show me my Plex viewing stats for the last 30 days"
Ask: "What are my Trakt stats?" — see lifetime stats (movies watched, hours, milestones)
Ask: "What are my most popular movies this month?"
Available Functions
Plex Tools (19 tools)
Function | Description |
| List all Plex libraries |
| List items in a library with pagination |
| Export a full library to JSON (under |
| Search media globally or within one library |
| Recently added content |
| Continue watching list |
| Detailed media info |
| Show editable fields and available tags for an item |
| List all Plex playlists |
| List items in a playlist |
| Get current Plex watchlist |
| Recently watched content |
| Detailed watch sessions |
| Fully watched movies/shows |
| Comprehensive viewing statistics |
| User activity statistics |
| Library usage metrics |
| Most popular content analysis |
| Personalized movie recommendations based on your watch history |
Write Operations (9 tools, opt-in)
Set PLEX_ENABLE_MUTATIVE_OPS=true to enable these tools. They allow your AI assistant to make changes to your Plex server. Use with care — while we test these tools, there are no guarantees. Review changes your assistant proposes before confirming.
Function | Description |
| Update metadata fields and editable tags for a media item |
| Apply a metadata JSON payload using best-effort field mapping |
| Create a new smart or static playlist |
| Add a media item to a playlist |
| Remove an item from a playlist |
| Preview and optionally clear all items from a playlist ( |
| Delete a playlist without deleting the underlying media |
| Add a media item to the Plex watchlist |
| Remove a media item from the Plex watchlist |
Sonarr Tools (8 tools)
Function | Description |
| List series with optional title filter |
| Search TheTVDB for new series |
| Add series by TVDB ID |
| Missing/wanted episodes |
| Download queue |
| Upcoming episodes |
| Quality profiles and root folders |
| Trigger missing episode search |
Radarr Tools (8 tools)
Function | Description |
| List movies with optional title filter |
| Search TMDB for new movies |
| Add movie by TMDB ID |
| Missing/wanted movies |
| Download queue |
| Upcoming movies |
| Quality profiles and root folders |
| Trigger missing movie search |
Cross-Service Tools (1 tool)
Function | Description |
| Check Sonarr/Radarr connection status |
Trakt Tools (9 tools)
Function | Description |
| Start Trakt.tv OAuth flow |
| Complete authentication |
| Check auth status |
| Sync Plex history to Trakt |
| Get Trakt data for comparison |
| Enhanced stats from Trakt |
| Search Trakt database |
| Real-time scrobbling |
| Check sync operation status |
Getting Your Plex Token
Open Plex Web App in your browser
Navigate to Settings > Account > Privacy
Click "Show Advanced" at the bottom
Copy your Plex Token
Alternative method:
Visit:
http://YOUR_PLEX_IP:32400/web/index.html#!/settings/accountLook for the "Plex Token" field
Project Structure
plex-mcp-server/
├── src/
│ ├── plex-mcp-server.ts # Unified server entry point (44+ tools)
│ ├── index.ts # Deprecated shim → plex-mcp-server
│ ├── plex-arr-server.ts # Deprecated shim → plex-mcp-server
│ ├── plex-trakt-server.ts # Deprecated shim → plex-mcp-server
│ ├── plex/ # Shared Plex module
│ │ ├── client.ts # Plex API client
│ │ ├── tools.ts # Plex tool implementations
│ │ ├── tool-registry.ts # Map-based tool dispatch
│ │ ├── tool-schemas.ts # MCP tool schema definitions
│ │ ├── constants.ts # Configuration defaults
│ │ └── types.ts # TypeScript type definitions
│ ├── arr/ # Sonarr/Radarr module
│ │ ├── client.ts # Base ArrClient + Sonarr/Radarr subclasses
│ │ ├── mcp-functions.ts # Tool implementations (17 tools)
│ │ ├── tool-registry.ts # Map-based tool dispatch
│ │ ├── tool-schemas.ts # MCP tool schema definitions
│ │ ├── constants.ts # Configuration defaults
│ │ └── types.ts # TypeScript type definitions
│ ├── trakt/ # Trakt.tv module
│ │ ├── client.ts # Trakt API client + OAuth
│ │ ├── sync.ts # Plex-to-Trakt sync engine
│ │ ├── mapper.ts # Plex-to-Trakt data mapping
│ │ ├── mcp-functions.ts # Tool implementations (9 tools)
│ │ ├── tool-registry.ts # Map-based tool dispatch
│ │ └── tool-schemas.ts # MCP tool schema definitions
│ ├── shared/ # Shared utilities
│ │ └── utils.ts # truncate, sleep, chunkArray
│ └── __tests__/ # Test suite (94 tests)
├── build/ # Compiled JavaScript output
├── docs/ # Documentation
├── package.json
├── tsconfig.json
├── vitest.config.ts
├── .env.example # Environment variables template
└── README.mdDevelopment
Scripts
# Development mode with auto-reload
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run tests
npm test
npm run test:watchBuilding from Source
git clone https://github.com/niavasha/plex-mcp-server.git
cd plex-mcp-server
npm install
npm run devContributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Guidelines
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Troubleshooting
Common Issues
Connection refused:
Verify your Plex server is running
Check the
PLEX_URLin your environment configEnsure the port (usually 32400) is correct
Authentication errors:
Verify your Plex token is correct
Check token permissions in Plex settings
Ensure token hasn't expired
Empty responses:
Some features require Plex Pass
Check if your libraries are accessible
Verify media has been scanned and is available
Sonarr/Radarr connection issues:
Verify Sonarr/Radarr is running and accessible from the MCP server host
Check that the API key is correct (Settings > General > API Key)
Sonarr uses API v3 at
/api/v3/— ensure your URL doesn't include a trailing pathFor large Radarr libraries (20k+ movies), the initial
radarr_get_moviescall may take up to 30 seconds
Trakt authentication issues:
Ensure
TRAKT_CLIENT_IDandTRAKT_CLIENT_SECRETare both setUse the
trakt_authenticatetool to start the OAuth flowComplete authentication with
trakt_complete_authusing the code from Trakt
MCP client issues:
Ensure the path is set to
build/plex-mcp-server.js(the unified server)Check that Node.js is in your system PATH
Verify environment variables are set in client config
Getting Help
Check existing discussions
Review the MCP documentation
Requirements
Node.js 20.0.0 or higher
Plex Media Server (any recent version)
Network access between MCP server and Plex server
Valid Plex token with appropriate permissions
Security Notes
Keep your Plex token secure - never commit it to version control
Use environment variables for sensitive configuration
Run on trusted networks - the server communicates directly with Plex
Regular token rotation - consider refreshing tokens periodically
Write operations are disabled by default — enable only if you trust your AI assistant's judgment
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Anthropic for the Model Context Protocol
Plex for the amazing media server
Tautulli for analytics inspiration
The open-source community for various libraries and tools
Related Projects
Model Context Protocol - The standard this server implements
Claude Desktop - Popular MCP client
Tautulli - Plex monitoring and analytics
PlexAPI - Python Plex API library
Built with love for the Plex and AI community
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/niavasha/plex-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server