mcp-mpv-player 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -82
- package/README.zh.md +84 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -1,106 +1,84 @@
|
|
|
1
|
-
# mpv-
|
|
1
|
+
# mcp-mpv-player
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[中文文档](./README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Control mpv media player through AI conversation. Play music and video, manage playlists — all via natural language.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|------|-------------|
|
|
9
|
-
| `player_play` | Open file or URL (auto-starts mpv) |
|
|
10
|
-
| `player_pause` | Toggle pause/resume |
|
|
11
|
-
| `player_stop` | Stop playback |
|
|
12
|
-
| `player_next` | Next track |
|
|
13
|
-
| `player_prev` | Previous track |
|
|
14
|
-
| `player_seek` | Seek by seconds / absolute time / percent |
|
|
15
|
-
| `player_set_volume` | Set volume 0–130 |
|
|
16
|
-
| `player_set_speed` | Set speed (0.5x, 1x, 2x…) |
|
|
17
|
-
| `player_status` | Get current playback state |
|
|
18
|
-
| `playlist_create` | Create a new .m3u playlist |
|
|
19
|
-
| `playlist_add` | Append files to a playlist |
|
|
20
|
-
| `playlist_remove` | Remove an item by index |
|
|
21
|
-
| `playlist_load` | Load & play a saved playlist |
|
|
22
|
-
| `playlist_list` | List all playlists or inspect one |
|
|
23
|
-
| `playlist_delete` | Delete a playlist file |
|
|
24
|
-
|
|
25
|
-
Playlists are saved as `.m3u` files in `%USERPROFILE%\mpv-playlists\`.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Requirements
|
|
30
|
-
|
|
31
|
-
- **Node.js** 18+
|
|
32
|
-
- **mpv** installed and in PATH
|
|
33
|
-
Download: https://mpv.io/installation/
|
|
34
|
-
Recommended: `winget install mpv` or `scoop install mpv`
|
|
35
|
-
|
|
36
|
-
---
|
|
7
|
+
Works with [opencode](https://opencode.ai/) and any MCP-compatible AI tool.
|
|
37
8
|
|
|
38
9
|
## Installation
|
|
39
10
|
|
|
11
|
+
Make sure [Node.js](https://nodejs.org) is installed, then run:
|
|
12
|
+
|
|
40
13
|
```bash
|
|
41
|
-
|
|
42
|
-
npm install
|
|
14
|
+
npx mcp-mpv-player
|
|
43
15
|
```
|
|
44
16
|
|
|
45
|
-
|
|
17
|
+
The setup wizard will automatically:
|
|
18
|
+
- Detect or install mpv
|
|
19
|
+
- Locate your opencode config file
|
|
20
|
+
- Register the MCP tool
|
|
46
21
|
|
|
47
|
-
|
|
22
|
+
Restart opencode when done.
|
|
48
23
|
|
|
49
|
-
|
|
24
|
+
## Usage Examples
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
26
|
+
Just talk to your AI naturally:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Play D:/Music/song.mp3
|
|
30
|
+
Pause
|
|
31
|
+
Next track
|
|
32
|
+
Skip forward 30 seconds
|
|
33
|
+
Jump to 2 minutes 30 seconds
|
|
34
|
+
Set volume to 80
|
|
35
|
+
Create a playlist called "chill" with D:/Music/a.mp3 and D:/Music/b.mp3
|
|
36
|
+
Play the "chill" playlist
|
|
37
|
+
Shuffle
|
|
60
38
|
```
|
|
61
39
|
|
|
62
|
-
|
|
63
|
-
> ```json
|
|
64
|
-
> {
|
|
65
|
-
> "mcpServers": {
|
|
66
|
-
> "mpv": {
|
|
67
|
-
> "command": "node",
|
|
68
|
-
> "args": ["C:/path/to/mpv-mcp/index.js"],
|
|
69
|
-
> "env": {
|
|
70
|
-
> "MPV_PATH": "C:/tools/mpv/mpv.exe"
|
|
71
|
-
> }
|
|
72
|
-
> }
|
|
73
|
-
> }
|
|
74
|
-
> }
|
|
75
|
-
> ```
|
|
76
|
-
|
|
77
|
-
---
|
|
40
|
+
## Tools
|
|
78
41
|
|
|
79
|
-
|
|
42
|
+
### Playback Control
|
|
80
43
|
|
|
81
|
-
|
|
44
|
+
| Tool | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| `player_play` | Play a file or URL, auto-starts mpv |
|
|
47
|
+
| `player_pause` | Toggle pause / resume |
|
|
48
|
+
| `player_stop` | Stop playback |
|
|
49
|
+
| `player_next` | Next track |
|
|
50
|
+
| `player_prev` | Previous track |
|
|
51
|
+
| `player_seek` | Seek by seconds / absolute time / percent |
|
|
52
|
+
| `player_set_volume` | Set volume (0–130) |
|
|
53
|
+
| `player_set_speed` | Set playback speed (0.5x / 1x / 2x …) |
|
|
54
|
+
| `player_status` | Get current playback status |
|
|
55
|
+
| `player_shuffle` | Shuffle playlist and play from the start |
|
|
82
56
|
|
|
83
|
-
|
|
84
|
-
- All other tools check the pipe first and return a helpful error if mpv isn't running.
|
|
85
|
-
- Playlist files are plain `.m3u` text files — you can edit them manually too.
|
|
57
|
+
### Playlist Management
|
|
86
58
|
|
|
87
|
-
|
|
59
|
+
| Tool | Description |
|
|
60
|
+
|------|-------------|
|
|
61
|
+
| `playlist_create` | Create a new playlist |
|
|
62
|
+
| `playlist_load` | Load and play a saved playlist |
|
|
63
|
+
| `playlist_add` | Add files to a playlist |
|
|
64
|
+
| `playlist_remove` | Remove a track from a playlist |
|
|
65
|
+
| `playlist_list` | List all playlists or inspect one |
|
|
66
|
+
| `playlist_delete` | Delete a playlist |
|
|
88
67
|
|
|
89
|
-
|
|
68
|
+
Playlists are saved as `.m3u` files in `%USERPROFILE%\mpv-playlists\`.
|
|
90
69
|
|
|
91
|
-
|
|
92
|
-
播放一个文件:
|
|
93
|
-
"播放 D:/Music/song.mp3"
|
|
70
|
+
## Requirements
|
|
94
71
|
|
|
95
|
-
|
|
96
|
-
|
|
72
|
+
- Windows 10 / 11
|
|
73
|
+
- Node.js 18+
|
|
74
|
+
- mpv (can be installed automatically by the setup wizard)
|
|
97
75
|
|
|
98
|
-
|
|
99
|
-
"跳到2分30秒" → player_seek(150, absolute)
|
|
76
|
+
## How It Works
|
|
100
77
|
|
|
101
|
-
|
|
102
|
-
"创建一个叫 jazz 的播放列表,包含 D:/Music/a.mp3 和 D:/Music/b.mp3"
|
|
78
|
+
mpv exposes a JSON IPC interface via a Windows Named Pipe (`\\.\pipe\mpv-ipc`). This tool runs as an MCP server, receives commands from the AI, and forwards them to mpv.
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
80
|
+
When `player_play` is called and mpv is not running, it is launched automatically with the IPC flag and stays running in the background between tracks.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# mcp-mpv-player
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
通过 AI 对话控制 mpv 播放器,支持播放音乐、视频,管理播放列表。
|
|
6
|
+
|
|
7
|
+
适用于 [opencode](https://opencode.ai/) 等支持 MCP 协议的 AI 编程工具。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
确保电脑上已安装 [Node.js](https://nodejs.org),然后运行:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx mcp-mpv-player
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
安装向导会自动完成以下步骤:
|
|
18
|
+
- 检测或安装 mpv 播放器
|
|
19
|
+
- 找到 opencode 配置文件
|
|
20
|
+
- 自动注册 MCP 工具
|
|
21
|
+
|
|
22
|
+
完成后重启 opencode 即可使用。
|
|
23
|
+
|
|
24
|
+
## 使用示例
|
|
25
|
+
|
|
26
|
+
安装完成后,直接用自然语言对 AI 说:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
播放 D:/Music/周杰伦 - 晴天.mp3
|
|
30
|
+
暂停
|
|
31
|
+
下一曲
|
|
32
|
+
快进30秒
|
|
33
|
+
跳到第2分30秒
|
|
34
|
+
音量调到80
|
|
35
|
+
创建一个叫 "周末" 的播放列表,包含 D:/Music/a.mp3 和 D:/Music/b.mp3
|
|
36
|
+
播放 "周末" 播放列表
|
|
37
|
+
随机播放
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 功能列表
|
|
41
|
+
|
|
42
|
+
### 播放控制
|
|
43
|
+
|
|
44
|
+
| 工具 | 说明 |
|
|
45
|
+
|------|------|
|
|
46
|
+
| `player_play` | 播放文件或 URL,自动启动 mpv |
|
|
47
|
+
| `player_pause` | 暂停 / 继续 |
|
|
48
|
+
| `player_stop` | 停止播放 |
|
|
49
|
+
| `player_next` | 下一曲 |
|
|
50
|
+
| `player_prev` | 上一曲 |
|
|
51
|
+
| `player_seek` | 快进快退 / 跳到指定时间 / 按百分比跳转 |
|
|
52
|
+
| `player_set_volume` | 设置音量(0–130) |
|
|
53
|
+
| `player_set_speed` | 设置播放速度(0.5x / 1x / 2x …) |
|
|
54
|
+
| `player_status` | 查看当前播放状态 |
|
|
55
|
+
| `player_shuffle` | 随机打乱播放列表并播放 |
|
|
56
|
+
|
|
57
|
+
### 播放列表管理
|
|
58
|
+
|
|
59
|
+
| 工具 | 说明 |
|
|
60
|
+
|------|------|
|
|
61
|
+
| `playlist_create` | 创建新播放列表 |
|
|
62
|
+
| `playlist_load` | 加载并播放已保存的播放列表 |
|
|
63
|
+
| `playlist_add` | 向播放列表添加文件 |
|
|
64
|
+
| `playlist_remove` | 从播放列表移除指定曲目 |
|
|
65
|
+
| `playlist_list` | 查看所有播放列表或列表内容 |
|
|
66
|
+
| `playlist_delete` | 删除播放列表 |
|
|
67
|
+
|
|
68
|
+
播放列表以 `.m3u` 格式保存在 `%USERPROFILE%\mpv-playlists\`。
|
|
69
|
+
|
|
70
|
+
## 系统要求
|
|
71
|
+
|
|
72
|
+
- Windows 10 / 11
|
|
73
|
+
- Node.js 18+
|
|
74
|
+
- mpv(安装向导可自动安装)
|
|
75
|
+
|
|
76
|
+
## 工作原理
|
|
77
|
+
|
|
78
|
+
mpv 提供了 JSON IPC 接口,通过 Windows Named Pipe(`\\.\pipe\mpv-ipc`)通信。本工具作为 MCP server 运行,接收 AI 发来的指令并转发给 mpv 执行。
|
|
79
|
+
|
|
80
|
+
调用 `player_play` 时如果 mpv 未运行,会自动启动并附带 IPC 参数,之后保持后台运行。
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-mpv-player",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "MCP server for controlling mpv media player on Windows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -22,5 +22,13 @@
|
|
|
22
22
|
"media-player",
|
|
23
23
|
"opencode"
|
|
24
24
|
],
|
|
25
|
-
"license": "MIT"
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/guodaxia9527/mcp-mpv-player"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/guodaxia9527/mcp-mpv-player#readme",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/guodaxia9527/mcp-mpv-player/issues"
|
|
33
|
+
}
|
|
26
34
|
}
|