Plex

by niavasha

Not rated
GitHub

About

Provides AI assistants with comprehensive access to a Plex Media Server.

Details

Author
niavasha
Categories
Other, Media

Setup

Install Plex in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/niavasha/plex-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

AModel 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.

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"

46 toolsout of the box (58 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, rate media, and mark media watched or unwatched

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.

- Node.js20+
- Plex Media Server(any recent version)
- Plex Token(How to get your token)
- MCP-compatible client(Claude Desktop, etc.)

# 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 build

-

Get your Plex token(seeinstructions 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" } } } }

OnlyPLEX_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 keyscan be found atSettings > General > API Keyin each app's web UI.

Trakt.tv setuprequires aTrakt OAuth application. Create one with redirect URIurn: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 theTrakt setup guidefor 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 tobuild/plex-mcp-server.jsand remove any duplicate server entries.

See themigration guidefor full details.

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"

- 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
- 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
- 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)
- 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?"

46 tools out of the box (58 with write operations enabled).

SetPLEX_ENABLE_MUTATIVE_OPS=trueto 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.
- Open Plex Web Appin your browser
- Navigate to Settings> Account > Privacy
- Click "Show Advanced"at the bottom
- Copy your Plex Token

- Visit:http://YOUR_PLEX_IP:32400/web/index.html#!/settings/account
- Look for the "Plex Token" field

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.md
# 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:watch
git clone https://github.com/niavasha/plex-mcp-server.git cd plex-mcp-server npm install npm run dev

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.

Merged contributors are credited inCONTRIBUTORS.md. Please useConventional Commits— releases and the changelog are generated from them, seedocs/RELEASING.md.
- 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

- Verify your Plex server is running
- Check thePLEX_URLin your environment config
- Ensure the port (usually 32400) is correct

Host unreachable (EHOSTUNREACH/ connect errors) on macOS:

- On macOS Sequoia, Sonoma, or later, connections to local IP addresses (like10.0.0.10or192.168.1.50) may be blocked byLocal Network Privacysettings.
- Workaround 1:Try connecting using the local hostname (e.g.,plex.localor your Plex server name) rather than the direct IP address. Alternatively, use a Plex*.plex.directdomain.
- Workaround 2:Go toSystem Settings -> Privacy & Security -> Local Networkon your Mac and ensure that the MCP client (e.g., Claude Desktop, Terminal, or VS Code) is enabled and has permission to access the local network.

- Verify your Plex token is correct
- Check token permissions in Plex settings
- Ensure token hasn't expired

- Some features require Plex Pass
- Check if your libraries are accessible
- Verify media has been scanned and is available

- 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 path
- For large Radarr libraries (20k+ movies), the initialradarr_get_moviescall may take up to 30 seconds

- EnsureTRAKT_CLIENT_IDandTRAKT_CLIENT_SECRETare both set
- Use thetrakt_authenticatetool to start the OAuth flow
- Complete authentication withtrakt_complete_authusing the code from Trakt

- Ensure the path is set tobuild/plex-mcp-server.js(the unified server)
- Check that Node.js is in your system PATH
- Verify environment variables are set in client config

- Open an issue
- Check existing
discussions
- Review the
MCP documentation

- Node.js20.0.0 or higher
- Plex Media Server(any recent version)
- Network accessbetween MCP server and Plex server
- Valid Plex tokenwith appropriate permissions

- Keep your Plex token secure- never commit it to version control
- Use environment variablesfor sensitive configuration
- Run on trusted networks- the server communicates directly with Plex
- Regular token rotation- consider refreshing tokens periodically
- Write operationsare disabled by default — enable only if you trust your AI assistant's judgment

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

- Everyone who has contributed code— this project is not a solo effort
-
Anthropicfor the Model Context Protocol
-
Plexfor the amazing media server
-
Tautullifor analytics inspiration
- The open-source community for various libraries and tools

- 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

MCP server for Google Cast — discover devices, play media, control volume, launch apps, and manage queues over stdio

Generates dog images with an LGTM (Looks Good To Me) overlay using the Dog CEO API.

A virtual travel environment for an avatar on Google Maps, utilizing various Google Maps and optional AI image generation APIs.

An integration for Claude Desktop to interact with Spotify using the Model Context Protocol (MCP).

Control a media player via Home Assistant.

Access real-time entertainment data and personal viewing history from the Trakt.tv API.

Tracks movies, books, and TV shows to provide intelligent recommendations based on your preferences.

A soundboard MCP server with millions of meme sounds from myinstants.com — search, play, and browse categories. npx myinstants-mcp to get started.

PaKi Curator — Visual Medicine Art Catalog

MCP server for César Yagüe's Visual Medicine — 301 contemplative moving art works (seamless loops up to 16K), 109 vibrational capsules, 6 tools including spatial recommendations and direct artist inquiry.

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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.