python-mpd2
A Python MPD client library
What it is and what it does
python-mpd2 is a Python client library for Music Player Daemon (MPD), a lightweight music server. It lets you control MPD playback, manage playlists, and query server state from Python code. The library supports both synchronous blocking calls and asynchronous patterns via asyncio or twisted, making it suitable for simple scripts, web applications, and event-driven systems.
The package started as a fork of python-mpd and has evolved to support Python 3.6+, client-to-client protocol messaging, and newer MPD commands including seekcur, prio, config, mount, and others. It includes explicit command declarations for IDE autocomplete, configurable connection timeouts, logging support, and improved Unicode handling. With zero runtime dependencies and a pure-Python wheel, it installs quickly and runs anywhere Python 3.6+ is available.
Use it for:
- Build a web dashboard or REST API to control MPD playback and queue from a browser.
- Write a command-line tool to automate playlist management and music library operations.
- Create a home automation script that integrates MPD with other services via asyncio.
- Develop a music client application with custom UI that talks to a remote MPD server.
- Monitor and log MPD server state and playback events for analytics or debugging.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python client library to communicate with Music Player Daemon (MPD) servers, supporting both synchronous and asynchronous operations.
Yes. This is a mature, actively maintained library with zero dependencies, a permissive copyleft license, and no known vulnerabilities. Install it if you need to control MPD from Python—whether for a simple script, web service, or async application. The only prerequisite is having an MPD server running; the library itself is straightforward to integrate.
Install
python-mpd2 on PyPI
pip
pip install python-mpd2uv
uv add python-mpd2poetry
poetry add python-mpd2Installing python-mpd2
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits; last release was 2024-01-13 and repository shows ongoing development.
License in practice
LGPLv3 copyleft license: you may use this library freely in proprietary software, but any modifications to the library itself must be released under the same license.
Quickstart
pip install python-mpd2
import python_mpd2
client = python_mpd2.MPDClient()
client.connect('localhost')
status = client.status()
client.close()
Requires Python 3.6 or later and a running Music Player Daemon server to connect to.
Verify before relying
- Whether asyncio/twisted support is production-ready or still experimental.
- Performance characteristics when controlling large playlists or music libraries.
- Compatibility matrix with specific MPD server versions.
- Default port and connection parameters for MPD server connections.
Package facts
| License | GNU Lesser General Public License v3 (LGPLv3) (copyleft) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 944 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 120,946/month — #12,002 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_mpd2-3.1.1-py2.py3-none-any.whl
Keywords: mpd
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
music-assistant-clientPython async client library for connecting to…
permissive · top 15,000 on PyPI
spotifywebapipythonA Python library that wraps the Spotify Web…
permissive · top 15,000 on PyPI
TwistedTwisted is an event-driven networking framework…
permissive · top 5,000 on PyPI
pyforked-daapdA Python client library for communicating with…
permissive · top 15,000 on PyPI
aioslimprotoAsync Python implementation of the SLIMProto…
permissive · top 15,000 on PyPI
pypdA Python client for PagerDuty's v2 API that…
permissive · top 15,000 on PyPI
pysqueezeboxAsynchronous Python library to control Logitech…
permissive · top 15,000 on PyPI
socoSoCo is a Python library for programmatic…
permissive · top 15,000 on PyPI
pyftpdlibBuilds asynchronous FTP servers in Python with…
unclear · top 15,000 on PyPI