sampsyo: Seems pretty good to me! Would you mind adding a changelog entry describing the change?
diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py
index f232d87e9..39b045f9b 100644
--- a/beetsplug/mpdstats.py
+++ b/beetsplug/mpdstats.py
@@ -108,8 +108,9 @@ class MPDClientWrapper(object):
         return self.get(command, retries=retries - 1)
 
     def currentsong(self):
-        """Return the path to the currently playing song.  Prefixes paths with the
-        music_directory, to get the absolute path.
+        """Return the path to the currently playing song, along with its
+        songid.  Prefixes paths with the music_directory, to get the absolute
+        path.
         """
         result = None
         entry = self.get('currentsong')
@@ -118,7 +119,7 @@ class MPDClientWrapper(object):
                 result = os.path.join(self.music_directory, entry['file'])
             else:
                 result = entry['file']
-        return result
+        return result, entry.get('id')
 
     def status(self):
         """Return the current status of the MPD.
@@ -240,7 +241,9 @@ class MPDStats(object):
     def on_stop(self, status):
         self._log.info(u'stop')
 
-        if self.now_playing:
+        # if the current song stays the same it means that we stopped on the
+        # current track and should not record a skip.
+        if self.now_playing and self.now_playing['id'] != status.get('songid'):
             self.handle_song_change(self.now_playing)
 
         self.now_playing = None
@@ -251,7 +254,7 @@ class MPDStats(object):
 
     def on_play(self, status):
 
-        path = self.mpd.currentsong()
+        path, songid = self.mpd.currentsong()
 
         if not path:
             return
@@ -286,6 +289,7 @@ class MPDStats(object):
             'started':    time.time(),
             'remaining':  remaining,
             'path':       path,
+            'id':         songid,
             'beets_item': self.get_item(path),
         }
 
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 0dfa2c5f8..47159ddc2 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -245,6 +245,10 @@ Fixes:
 * Fix a bug that caused metadata starting with something resembling a drive
   letter to be incorrectly split into an extra directory after the colon.
   :bug:`3685`
+* :doc:`/plugins/mpdstats`: Don't record a skip when stopping MPD, as MPD keeps
+  the current track in the queue.
+  Thanks to :user:`aereaux`.
+  :bug:`3722`
 
 For plugin developers:
 

mpdstats records a skip when stopping playback
<!--
Describe your problem, feature request, or discussion topic here.

Please fill out this and the "Setup" section below and remember to include
enough detail so that other people can reproduce the problem.
-->

### Problem

I am using the mpdstats plugin.  Running `beet mpdstats` and then starting a song playing in mpd and then stopping it makes mpdstats record a skip and adjust the song rating downwards, even though that song remains at the beginning of the mpd playlist (i.e. it's not actually skipped).  Interestingly pausing and then later stopping seems to not cause this problem.

### Setup

* OS: Arch Linux
* Python version: 3.8.5
* beets version: b89a2650c
* Turning off plugins made problem go away (yes/no): Well... yes?

My configuration (output of `beet config`) is:

```yaml
plugins: parentwork scrub info mbsync alternatives chroma mpdstats
directory: ~/music/beets/

paths:
    default: '%ifdef{parent_composer_sort,$parent_composer_sort,[unknown]}/%ifdef{parentwork_date,$parentwork_date - }%ifdef{parentwork,$parentwork,[unknown]}/%ifdef{year,$year - }$album%aunique{album year,albumartist albumtype label catalognum albumdisambig releasegroupdisambig}/$track $title'

import:
    from_scratch: yes
    move: yes
acoustid:
    apikey: REDACTED
alternatives:
    aphone:
        directory: /home/user/music/aphone/
        formats: opus
        query: ''
parentwork:
    auto: no
    force: no
chroma:
    auto: yes
mpd:
    music_directory: /home/user/music/beets
    rating: yes
    rating_mix: 0.75
    host: localhost
    port: 6600
    password: REDACTED
scrub:
    auto: yes
```

diff --git a/test/test_mpdstats.py b/test/test_mpdstats.py
index 0117e22aa..20226927f 100644
--- a/test/test_mpdstats.py
+++ b/test/test_mpdstats.py
@@ -62,10 +62,11 @@ class MPDStatsTest(unittest.TestCase, TestHelper):
                 {'state': u'stop'}]
     EVENTS = [["player"]] * (len(STATUSES) - 1) + [KeyboardInterrupt]
     item_path = util.normpath('/foo/bar.flac')
+    songid = 1
 
     @patch("beetsplug.mpdstats.MPDClientWrapper", return_value=Mock(**{
         "events.side_effect": EVENTS, "status.side_effect": STATUSES,
-        "currentsong.return_value": item_path}))
+        "currentsong.return_value": (item_path, songid)}))
     def test_run_mpdstats(self, mpd_mock):
         item = Item(title=u'title', path=self.item_path, id=1)
         item.add(self.lib)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest responses mock pylast rarfile pyxdg python-mpd2 discogs-client
apt-get update apt-get install -y gcc
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
anyio==4.9.0
-e git+https://github.com/beetbox/beets.git@ff445ed2f8ee17f8bd963691518198622cca06e5#egg=beets
certifi==2025.1.31
charset-normalizer==3.4.1
confuse==2.0.1
discogs-client==2.3.0
exceptiongroup==1.2.2
filetype==1.2.0
h11==0.14.0
httpcore==1.0.7
httpx==0.28.1
idna==3.10
iniconfig==2.1.0
jellyfish==1.2.0
mediafile==0.13.0
mock==5.2.0
munkres==1.1.4
musicbrainzngs==0.7.1
mutagen==1.47.0
oauthlib==3.2.2
packaging==24.2
pluggy==1.5.0
pylast==5.5.0
pytest==8.3.5
python-mpd2==3.1.1
pyxdg==0.28
PyYAML==6.0.2
rarfile==4.2
requests==2.32.3
responses==0.25.7
six==1.17.0
sniffio==1.3.1
tomli==2.2.1
typing_extensions==4.13.0
Unidecode==1.3.8
urllib3==2.3.0

name: beets
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - anyio==4.9.0
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - confuse==2.0.1
      - discogs-client==2.3.0
      - exceptiongroup==1.2.2
      - filetype==1.2.0
      - h11==0.14.0
      - httpcore==1.0.7
      - httpx==0.28.1
      - idna==3.10
      - iniconfig==2.1.0
      - jellyfish==1.2.0
      - mediafile==0.13.0
      - mock==5.2.0
      - munkres==1.1.4
      - musicbrainzngs==0.7.1
      - mutagen==1.47.0
      - oauthlib==3.2.2
      - packaging==24.2
      - pluggy==1.5.0
      - pylast==5.5.0
      - pytest==8.3.5
      - python-mpd2==3.1.1
      - pyxdg==0.28
      - pyyaml==6.0.2
      - rarfile==4.2
      - requests==2.32.3
      - responses==0.25.7
      - six==1.17.0
      - sniffio==1.3.1
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - unidecode==1.3.8
      - urllib3==2.3.0
prefix: /opt/conda/envs/beets

test/test_mpdstats.py::MPDStatsTest::test_run_mpdstats
test/test_mpdstats.py::MPDStatsTest::test_get_item test/test_mpdstats.py::MPDStatsTest::test_update_rating
beetsplug/mpdstats.py docs/changelog.rst
beetsplug/mpdstats.py docs/changelog.rst