Logo van Emby.MCP

Emby.MCP

Community
angeltek

Model Context Protocol (MCP) server that connects an Emby media server to an AI client such as Claude Desktop.

Uitgeverangeltek
RepositoryEmby.MCP
TaalPython
Forks
5
Sterren
10
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieGPL-3.0
Links
  • Koppel tools aan AI-workflows

    Emby.MCP biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • Beschikbare tools: 0

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Belangstelling voor het opensourceproject

    Statistieken van de gekoppelde repository (sterren: 10, forks: 5).

Emby.MCP

Model Context Protocol (MCP) server that connects an Emby media server to an AI client such as Claude Desktop, creating a kind of Amazon Alexa (tm) for any MCP compliant LLM using your own media collection. A personal MCP and Python learning exercise, inspired into action by hearing Yoko Li talk about her Morse Code MCP server.

Note, this is an independent project with no affiliation to, or endorsement by, Emby LLC.

Contents

Features | Requirements | Installation | Usage | Under The Hood | Also See | License

Features

A minimum viable project that allows an LLM to do the following via MCP tools:

  • Log on to & log out of an Emby media server;
  • Retrieve a list of media libraries;
  • Select a specified library;
  • Retrieve a list of genres used in that library;
  • Search for items in that library by genre, item title, album name, release year, and lyrics, chunking the response as needed;
  • Retrieve playlists, create new playlists, add items to playlists & re-order them, and share playlists with other Emby users;
  • Retrieve a list of accessible media players known to Emby;
  • Retrieve the current play queue of a specified media player;
  • Control the playing, pausing, seeking, etc of a specified media player, including transferring the queue to another player.

Requirements

  • Python v3.13 or higher
  • The uv package/project manager
  • The MCP Server SDK for Python v1.94 or higher
  • The Emby client SDK for Python v4.9.0.33, with hotfix patches (see below).
  • A working Emby Media Server with a library of media files, either local or accessible via a network.
  • An MCP-compatible LLM/AI client. Emby.MCP was developed using Claude Desktop, however at time of writing more than 60 other clients were listed in the Feature Support Matrix - pick one that supports Tools.
  • An LLM subscription plan that supports MCP (this may require payment).

Installation

The following instructions are for a clean installation on Windows 11 Pro - adjust for your own platform and needs.

Install Python | Install Emby.MCP | Install Patches | Login Config | Basic Checks | Configure LLM

Install Python

  • Install latest Python. Customise the install: Optional Features = select all | Advanced Options = install for all, associate files, create shortcuts, add to environment, precompile.
  • From a Powershell terminal, run:
pip install uv
  • Add uv to the path via Windows Settings > System > About > Advanced > [control panel opens] > Environment Variables > [double-click on Path in the User section at top] > [window opens] > New. Paste in the following (change "313" to the Python version that was installed above, ignoring the 3rd ".x" part): %USERPROFILE%\AppData\Roaming\Python\Python313\Scripts

Install Emby.MCP

  • Create empty folder \path\to\Emby.MCP somewhere on your computer.
  • Download the Emby.MCP files from GitHub into this folder, overwriting any existing files if you are performing an upgrade.
  • Install all dependencies by running the following from a Powershell terminal:
cd "\path\to\Emby.MCP"
uv sync --link-mode=copy

Install Hotfix Patches

At every Python virtual environment sync (like the step above) you will need to patch the Emby client SDK until these fix on github have been incorporated into Emby's official release.

  • From a Powershell terminal, run:
cd \path\to\Emby.MCP
copy "hotfixes\emby\configuration.py" ".venv\Lib\site-packages\emby_client"
copy "hotfixes\emby\user_service_api.py" ".venv\Lib\site-packages\emby_client\api"

Login Configuration

The Emby login credentials must be stored in file ".env" which you must create in \path\to\Emby.MCP (for security reasons it is NOT included in the git repo).

  • Paste the following into the new ".env" file, amending for your own server as required:
#------------
# Replace with your Emby server login details
EMBY_SERVER_URL = "http://localhost:8096"
EMBY_USERNAME = "user"
EMBY_PASSWORD = "pass"
# Set to False to NOT verify the server's SSL certificate (eg if self-signed). Defaults to True.
EMBY_VERIFY_SSL = True
# Each LLM has an upper limit on the amount of data it can ingest per tool call.
# Set the max number of items returned per chunk by search tools (or 0 for no limit).
# Items with rich metadata can average around 1,800 bytes each in JSON UTF8 format.
LLM_MAX_ITEMS = 100
#------------
  • You may want to create a dedicated Emby user for Emby.MCP so that you can limit what it can do and what it can see.

Basic Checks

At this point the script should be able to run some startup checks by accessing your Emby server.

  • From a Powershell terminal, run:
cd "\path\to\Emby.MCP"
uv run emby_mcp_server.py
  • This should produce an output similar to this (depending on your Emby set up):
Emby.MCP Copyright (C) 2025 Dominic Search <code@angeltek.co.uk>
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions; see LICENSE.txt for details.

Running startup checks...
Logon to media server was successful.
Found 3 available libraries
[
  {
    "name": "Music",
    "type": "music",
    "id": "23023"
  },
  {
    "name": "Playlists",
    "type": "playlists",
    "id": "23033"
  },
  {
    "name": "Movies",
    "type": "movies",
    "id": "23042"
  },
]
Logout from media server was successful
Startup checks have completed.

Running Emby.MCP in standalone mode, press CTRL-C to exit.
  • If this is successful, press Control-C or close the Powershell terminal to exit the script.

Configure Your LLM MCP Client

  • Add the Emby.MCP integration to the MCP SDK by running the following from a Powershell terminal:
cd \path\to\Emby.MCP
uv run mcp install --name "Emby" --with "embyclient" emby_mcp_server.py
  • Use the instructions below for your choice of client, If you use a client that is not listed here, then you will need to adapt these instructions yourself.

Claude Desktop

Claude is a good choice as a general-purpose LLM chatbot that works well with Emby.MCP, but requires payment.

  • Install the latest Claude Desktop app on the same machine that you installed Python.
  • You will need to have at least a Pro subscription - the free plan does not support MCP, unfortunately :-|
  • Edit file %USERPROFILE%\AppData\Roaming\Claude\claude_desktop_config.json (Clicking through Claude Desktop > File menu > Settings > Developer > Edit Config will open File Explorer on this file - edit it in Notepad or whatever). Modify so that it looks something like this, noting that on Windows path separators must be escaped as \\ :
{
  "mcpServers": {
    "Emby": {
      "command": "uv.exe",
      "args": [
        "run",
        "--directory",
        "C:\\path\\to\\Emby.MCP",
        "--with",
        "embyclient",
        "--with",
        "mcp[cli]",
        "mcp",
        "run",
        "emby_mcp_server.py"
      ]
    }
  }
}
  • Ensure Claude Desktop is fully shutdown (File menu > Exit) and then (re)start it.
  • Note: if you start Claude Desktop at any time when your Emby server is unavailable then you will get an error message. This is especially the case if Claude is set to "Run on Startup" and your Emby server is installed on the same computer (Claude may start before Emby). Claude will continue to function correctly without Emby.MCP - just restart Claude when the Emby server becomes available.
  • If you get an error message on first-time start up for any other reason, double-check the path in claude_desktop_config.json above, especially that it uses \\ not single \ in the directory path.
  • Emby.MCP sends messages about serious errors to the standard error output which Claude writes to its log files, so read through %USERPROFILE%\AppData\Roaming\Claude\logs\mcp-server-Emby.log and %USERPROFILE%\AppData\Roaming\Claude\logs\mcp.log looking for clues. This can be frustrating!

Microsoft Visual Studio Code

Visual Studio Code is a good choice for developers - it integrates with MS Copilot and works reasonably well with Emby.MCP

  • Install the latest VS Code app on the same machine that you installed Python. You need at least v1.102 for full MCP support.
  • You will need to have a Copilot enabled github account, along with the relevant VS Code extentions installed & working. You do not need a pay-for Copilot Pro subscription - the free plan supports MCP, however you may run into monthly usage limits.
  • Use the official documentation to Add an MCP Server, perhaps via your user configuration
  • Modify the mcp.json file so that it looks something like this, noting that on Windows path separators must be escaped as \\ :
{
	"servers": {
		"Emby": {
			"command": "uv.exe",
			"args": [
				"run",
				"--directory",
				"C:\\path\\to\\Emby.MCP",
				"--with",
				"embyclient",
				"--with",
				"mcp[cli]",
				"mcp",
				"run",
				"emby_mcp_server.py"
			]
		}
	}
}

Usage

Allow The Client to Use Tools

The first time an MCP client like Claude Desktop or VS Code tries to use a new MCP tool, a pop-up will appear asking for permission to use it. To avoid being asked each time, press or select Allow always.

Starting a Conversation:

It's a good idea to select an Emby library at the start of a conversation in order to narrow search results and reduce the amount of return data that the LLM has to deal with (that said, you can search across multiple libraries if you wish). E.g., from Claude:

list emby libraries

I'll help you explore your Emby library. Let me start by checking what libraries are available on your Emby server.

Your Emby server has several libraries available:

  • Music - Main music library

  • Playlists - Your saved playlists

  • Movies - Movie collection

  • BBC Sounds - BBC audio content

select bbc library

Perfect! I've selected the BBC Sounds library.

You can now search, browse, or explore content within the BBC Sounds library. What would you like to do next?

Instructing Your LLM

On startup, the MCP client receives the list of tools from Emby.MCP (all functions that have @mcp.tool() immediately prior to their def line), along with the parameter names and the content of the docstring.

The docstring is a natural language description of the tool, its parameters and its output. From this, the LLM gains an understanding of the capabilities it has at hand, and is quite good at reasoning which tools are required for the instructions that you give it. But it isn't perfect, so:

  • Be brief and specific to reduce LLM confusion.
  • Start a conversation by mentioning Emby as a hint that Emby.MCP tools should be used.
  • If you want to search for audio or video based on a phrase in the lyrics or description then be explicit about this in your instructions, otherwise the LLM may only search on Title or Artist.
  • LLMs attempt not to ingest large amounts of data, such as from a vague search of a large library. Emby.MCP works around this by returning results in bite-sized chunks. Sometimes even this is insufficient, so your instructions may need get creatively persuasive.

Example Transcript

My Emby server contains a lot of BBC Radio audio drama files that have rich mp3/mp4 metadata, including a long description with full cast list in the Lyrics field. This is good material for demonstrating Emby.MCP... see the separate file Example Claude Transcript.md

Under The Hood

The Emby.MCP code is split over three files. emby_mcp_server.py contains all of the MCP related tool functions. In normal use, MCP does not require there be a classic 'main' function to call (although it is used here for testing purposes). Instead, the MCP Server SDK parses for functions declared as @mcp.tool() and offers these to the MCP client for direct calling.

At client start-up some preliminaries are executed, which includes instantiating FastMCP with 'lifespan' function app_lifespan. This is async code that logs into the Emby server, initialises some updateable 'context' storage (akin to a global variable), and then waits until either the client exits (causing app_lifespan to log out of Emby), or is prodded by other functions to yield its storage (tool functions can write as well as read the context storage).

The MCP tool functions are mostly thin wrappers to functions within lib_emby_functions.py where the heavy lifting takes place. These wrappers are written with LLM comprehension in mind, hence the rather long-form names for functions, parameters, and docstrings (remember that the MCP SDK passes all this to the LLM so that it gains a detailed understanding of the tools). They only return strings - either success/error messages or JSON formatted data.

The exception is search_for_item() and retrieve_next_search_chunk() which attempt to coax the LLM into accepting more data that it really wants to by chunking the return into bite-size pieces (defined by the LLM_MAX_ITEMS variable in the .env file).

The functions in lib_emby_functions.py use Emby's official Client SDK, which does a good job of presenting the server's REST API as Python objects. However it has a few minor bugs that, unpatched, prevent Emby.MCP from working correctly (hence the need for the hotfixes given in installation instructions above). It should be noted that Emby's REST API documentation makes heavy use of CamelCaseNames, whereas the SDK mostly uses lower_case_delinated_names, so a good read-through of the SDK code files is necessary to figure out how to name things correctly.

File lib_emby_debugging.py contains some rudimentary interactive testing of the lib_emby_functions.py functions. They are not full unit tests, but hey, there is only so much effort I wanted to expend in this round of developing a personal project. To activate them, set MY_DEBUG=True at top of emby_mcp_server.py, then interactively run that script (not lib_emby_debugging.py).

The tests write to standard output so that it can be redirected to a file to capture full data that the interactive terminal may otherwise truncate. Prompts & errors messages are sent to standard error so that interaction is still possible during redirection. Enable the different test blocks in lib_emby_debugging.py by setting if True: instead of if False: at their start.

To debug the MCP tools, either install the interactive client included in the SDK, which requires you have a working Node.js environment. Or get the LLM client to perform tests for you, which may mean wading through LLM log files when things break badly (Emby.MCP sends messages about serious problems to standard error, which some MCP clients will obligingly write to log files).

Also See

License

Copyright (C) 2025 Dominic Search code@angeltek.co.uk

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Installatie

TypingMind
Vereisten:

Node.js 18+

{
  "mcpServers": {
    "angeltek-emby-mcp": {
      "command": "",
      "args": []
    }
  }
}

Gebruik Emby.MCP MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra Emby.MCP is verbonden, kun je de verbinding dus met verschillende AI-modellen in TypingMind gebruiken, zonder die voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg Emby.MCP toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus op ‘Gereed’ staat.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van Emby.MCP.
  4. Sla de serverlijst op.
  5. Vernieuw de pagina als je wilt controleren of de connectorstatus nog op ‘Gereed’ staat.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "angeltek-emby-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "emby-mcp"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van Emby.MCP in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van Emby.MCP in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je Emby.MCP gebruiken om me hiermee te helpen?
Emby.MCP
Zeker. Ik heb het gelezen.
Dit vond ik met Emby.MCP.

Veelgestelde vragen

Waarvoor wordt de MCP-server Emby.MCP gebruikt?

Emby.MCP is een MCP-server waarmee compatibele AI-clients toegang krijgen tot externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik Emby.MCP MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je Emby.MCP gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom Emby.MCP MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als Emby.MCP verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik Emby.MCP MCP met TypingMind?

Emby.MCP werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt Emby.MCP MCP in TypingMind?

Emby.MCP biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om Emby.MCP MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als Emby.MCP authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇