MediaMonkey 2024 MCP
Python-based Model Context Protocol (MCP) server that proxies MediaMonkey 2024 / MediaMonkey 5 via the official COM automation surface. The MCP tools expose playback control, volume/seek management, queue inspection, and a safe wrapper around the runJSCode bridge described in MediaMonkey's documentation.
References
- Controlling MM5 from External Applications
- SDBApplication automation reference
- SDBPlayer / SDBSongData object model
- ISDBUI::Menu Compendium (menu scopes)
- SDBIniFile reference (config settings)
Requirements
- Windows host with MediaMonkey 5+/2024 installed.
- Python 3.11+ (the MCP SDK requires 3.10+, we target 3.11).
pywin32(installed automatically viapyproject.toml).modelcontextprotocolPython SDK 1.2.0+.
Note: MediaMonkey automatically launches when the COM
SongsDB5.SDBApplicationobject is created. The MCP server keepsShutdownAfterDisconnect = Falseso MediaMonkey is not force-closed when the server exits.
Setup
uv venv
uv pip install -e .
If you do not use uv, replace with python -m venv and pip install -e ..
Running the MCP server
uv run mm2024-mcp
Or execute directly:
python -m mm2024_mcp.server
The server speaks MCP over stdio. Configure your MCP host (Claude for Desktop, VS Code MCP client, etc.) to launch the mm2024-mcp console command or python -m mm2024_mcp.server within this repository.
Using VS Code as your MCP host
Visual Studio Code 1.102+ with GitHub Copilot supports MCP servers natively (see the VS Code "Use MCP servers" guide). This repository includes a ready-to-use workspace configuration under .vscode/mcp.json.
- Install the latest VS Code and sign in to Copilot.
- Enable the MCP gallery (
chat.mcp.gallery.enabled) or open the Command Palette and run MCP: Open Workspace Folder Configuration. - Inspect
.vscode/mcp.json, update the path if your repository resides somewhere other than${workspaceFolder}, and tweakenventries (for example, overrideMM2024_COM_PROGID). - Open the Chat view (Ctrl+Alt+I), pick the
mm2024server in the Tools picker, and approve the trust prompt the first time VS Code launches the server. - While developing MediaMonkey plugins, invoke MCP tools directly from chat (for example,
#get_playback_state,#list_now_playing, or#run_javascript) to validate COM behavior without leaving the editor.
Tips:
- VS Code caches tool metadata. Use the MCP: Reset Cached Tools command after adding new MCP tools in
server.py. - Enable MCP: Reset Trust if you change the server command and VS Code refuses to restart it.
- Development mode is already configured in
.vscode/mcp.jsonso editingsrc/**/*.pyautomatically restarts the MCP server that VS Code launched.
Available tools
| Tool | Description |
|---|---|
get_playback_state |
Returns SDBPlayer status plus metadata from CurrentSong. |
control_playback |
Dispatches Play, Pause, Stop, Next, Previous, toggle, or stop_after_current. |
set_volume |
Sets the SDBPlayer.Volume property (0-100). |
seek |
Sets SDBPlayer.PlaybackTime (milliseconds). |
list_now_playing |
Reads the CurrentSongList queue (first N entries). |
run_javascript |
Invokes SDBApplication.runJSCode per the MediaMonkey wiki for advanced automations. |
invoke_menu_item |
Walks an SDB.UI menu/toolbar scope and executes the resolved SDBMenuItem. |
set_config_value |
Writes MediaMonkey.ini entries through SDB.IniFile (string, int, or bool). |
All tool results are serialized using Pydantic models defined under src/mm2024_mcp/models.py.
Menu automation
invoke_menu_item uses the menu scopes listed in the ISDBUI::Menu Compendium. Provide the scope name (for example Menu_Tools) and a list of captions to traverse beneath that scope (["Options..."]). Captions are normalized by removing ampersands and trailing ellipses, and you can loosen matching via match_strategy="startswith" or match_strategy="contains". Some menu trees are generated on demand; if a path fails, open the target menu in MediaMonkey once to warm it up before calling the tool again. Passing allow_disabled=True is useful for diagnostic scenarios, but be careful—MediaMonkey may still block execution for items that are disabled in the UI.
Configuration helpers
set_config_value wraps SDB.IniFile (see the SDBIniFile reference) so you can modify MediaMonkey.ini remotely. Pick a value_type (string, int, or bool), supply the new value, and optionally choose persist_mode="flush" or persist_mode="apply" to force MediaMonkey to write or re-load the ini file immediately. The tool returns the prior value whenever possible so you can confirm that a change was accepted. Some settings only take effect after restarting MediaMonkey—consult the MediaMonkey wiki for per-setting caveats.
Plugin development workflow
- Launch MediaMonkey 2024 normally so its COM automation layer is warmed up.
- Open this repository in VS Code, enable the bundled
mm2024MCP server (Chat → Tools → Servers), and keep the MCP chat panel docked next to your add-on source files. - While editing your MediaMonkey plug-in, use chat prompts such as
Run list_now_playing to confirm the testing playlistorCall run_javascript with the playlist enumerator snippetto validate behavior live. - After iterating on COM changes inside
media_monkey_client.py, runuv run mm2024-mcpin a terminal if you need to debug outside of VS Code's agent view.
Packaging & releases
Local builds
-
Install the packaging tools (this uses the optional
devextra defined inpyproject.toml):uv pip install -e .[dev]
-
Build the source distribution and wheel:
python -m build --sdist --wheel
-
Verify the metadata before uploading:
python -m twine check dist/*
-
Publish to PyPI (requires an API token created in your PyPI account):
$env:TWINE_USERNAME = "__token__" $env:TWINE_PASSWORD = "pypi-xxxxxxxxxxxxxxxx" python -m twine upload dist/*
Artifacts are emitted to dist/ (already ignored by .gitignore). Delete the folder between releases if you want a clean rebuild.
GitHub Actions workflow
.github/workflows/publish.ymlruns on manual dispatch, annotated tag pushes that matchv*, andreleaseevents when a GitHub release is published.- The workflow builds the wheel and sdist, runs
twine check, uploads thedist/contents as a workflow artifact, and optionally pushes to PyPI viapypa/gh-action-pypi-publish. - Configure the
PYPI_API_TOKENrepository secret with a token generated on PyPI (__token__scope). If the secret is unset, the workflow still builds artifacts but skips publishing. - Typical release flow: bump the version in
pyproject.toml, tag the commit (git tag v0.2.0 && git push origin v0.2.0), then watch the workflow finish. You can also rerun it via Actions → Build and Publish → Run workflow to regenerate artifacts without pushing a new tag.
Troubleshooting
- If the MCP host reports
pywin32 is not available, ensure you're installing dependencies within a Windows Python environment. - If the COM automation object cannot be created, confirm MediaMonkey is installed and that the
SongsDB5.SDBApplicationProgID exists. Override viaMM2024_COM_PROGIDif needed. run_javascriptwraps payloads sorunJSCode_callbackreturns JSON. For raw scripts that manage callbacks themselves, passexpect_callback=Falseto avoid double-wrapping.
Metadata
Release files for mm2024-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mm2024_mcp-0.1.0.tar.gz | 15.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mm2024_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / mm2024_mcp-0.1.0.tar.gz
| Download URL | mm2024_mcp-0.1.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14916a08b480863b5646675df675018b4f8b6c50a653e9fc28b30db14ca840c6
|
|
BLAKE2b-256 checksum How to use checksums |
47f5f0230a1cd54a55c1919d5645b90cbccf1a3768353f09d16e2f543e7a17ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / mm2024_mcp-0.1.0-py3-none-any.whl
| Download URL | mm2024_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a14308b4378f0a17c75cf040896d3e33c80cae1017ab1346f08b60974e45a19
|
|
BLAKE2b-256 checksum How to use checksums |
ca22033293be32737d15db8d33d251ecaa48644e3a8709c7f3bc39b8f590d51b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for mm2024-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.