Plex MCP Server
A Model Context Protocol server that enables AI assistants to query and manage Plex Media Server content through natural language, providing library access, viewing statistics, and media management capabilities.
README
Plex MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to your Plex Media Server. Query your libraries, get viewing statistics, and manage your media through natural language interactions.
🎬 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?"
✨ Features
📚 Library Management
- Browse all Plex libraries
- Search across movies, TV shows, music, and more
- Get detailed metadata for any media item
📊 Tautulli-Style Analytics
- Comprehensive viewing statistics
- User activity tracking
- Popular content analysis
- Watch history with progress tracking
- Library usage metrics
🎯 Smart Querying
- Recently watched content
- Fully watched movies/shows
- Continue watching (On Deck)
- Recently added media
🚀 Quick Start
Prerequisites
- Node.js 18+
- 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 build
Configuration
-
Get your Plex token (see instructions below)
-
Create environment file:
# Copy the example environment file
cp .env.example .env
# Edit with your details
PLEX_URL=http://localhost:32400
PLEX_TOKEN=your_plex_token_here
- Configure your MCP client:
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"plex": {
"command": "node",
"args": ["/path/to/plex-mcp-server/build/index.js"],
"env": {
"PLEX_URL": "http://localhost:32400",
"PLEX_TOKEN": "your_plex_token_here"
}
}
}
}
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 Christopher Nolan movies in my library"
▶️ "What's on my continue watching list?"
📚 "List all my Plex libraries"
🛠️ Available Functions
| Function | Description | Example Usage |
|---|---|---|
get_libraries |
List all Plex libraries | "What libraries do I have?" |
search_media |
Search across all media | "Find movies with Tom Hanks" |
get_recently_added |
Recently added content | "What's new on my server?" |
get_on_deck |
Continue watching list | "What should I continue watching?" |
get_media_details |
Detailed media info | "Tell me about The Matrix" |
get_recently_watched |
Recently watched content | "What did I watch yesterday?" |
get_fully_watched |
Completed content | "Show me all watched movies" |
get_watch_history |
Detailed watch sessions | "Show my viewing history" |
get_watch_stats |
Viewing analytics | "My watching statistics" |
get_user_stats |
User activity data | "Who watches the most?" |
get_library_stats |
Library information | "Tell me about my movie library" |
get_popular_content |
Most popular media | "What's trending on my server?" |
🔑 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/account - Look for the "Plex Token" field
📁 Project Structure
plex-mcp-server/
├── src/
│ └── index.ts # Main MCP server implementation
├── build/ # Compiled JavaScript output
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .env.example # Environment variables template
├── README.md # This file
└── LICENSE # MIT License
🔧 Development
Scripts
# Development mode with auto-reload
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run tests (if implemented)
npm test
Building from Source
# Clone and setup
git clone https://github.com/niavasha/plex-mcp-server.git
cd plex-mcp-server
npm install
# Development
npm run dev
🤝 Contributing
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.envfile - Ensure 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
MCP client issues:
- Ensure the path to
build/index.jsis correct - Check that Node.js is in your system PATH
- Verify environment variables are set in client config
Getting Help
- 📝 Open an issue
- 💬 Check existing discussions
- 📖 Review the MCP documentation
📋 Requirements
- Node.js 18.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
📄 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 ❤️ for the Plex and AI community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。