@modelcontextprotocol/server-sheet-music 0.4.1
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 +89 -0
- package/dist/index.js +30583 -0
- package/dist/mcp-app.html +259 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +59236 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Example: Sheet Music Server
|
|
2
|
+
|
|
3
|
+
A demo MCP App that renders [ABC notation](https://en.wikipedia.org/wiki/ABC_notation) as sheet music with interactive audio playback using the [abcjs](https://www.abcjs.net/) library.
|
|
4
|
+
|
|
5
|
+
<table>
|
|
6
|
+
<tr>
|
|
7
|
+
<td><a href="https://modelcontextprotocol.github.io/ext-apps/screenshots/sheet-music-server/01-twinkle-twinkle-little-star.png"><img src="https://modelcontextprotocol.github.io/ext-apps/screenshots/sheet-music-server/01-twinkle-twinkle-little-star.png" alt="Twinkle, Twinkle Little Star" width="100%"></a></td>
|
|
8
|
+
<td><a href="https://modelcontextprotocol.github.io/ext-apps/screenshots/sheet-music-server/02-playing-on-repeat.png"><img src="https://modelcontextprotocol.github.io/ext-apps/screenshots/sheet-music-server/02-playing-on-repeat.png" alt="Playing on repeat" width="100%"></a></td>
|
|
9
|
+
</tr>
|
|
10
|
+
</table>
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Audio Playback**: Built-in audio player with play/pause and loop controls
|
|
15
|
+
- **Sheet Music Rendering**: Displays ABC notation as properly formatted sheet music
|
|
16
|
+
|
|
17
|
+
## Running
|
|
18
|
+
|
|
19
|
+
1. Install dependencies:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Build and start the server:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run start:http # for Streamable HTTP transport
|
|
29
|
+
# OR
|
|
30
|
+
npm run start:stdio # for stdio transport
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
|
|
34
|
+
|
|
35
|
+
### Tool Input
|
|
36
|
+
|
|
37
|
+
When calling the `play-sheet-music` tool, provide ABC notation:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"abcNotation": "X:1
|
|
42
|
+
T:C Major Scale
|
|
43
|
+
M:4/4
|
|
44
|
+
L:1/4
|
|
45
|
+
K:C
|
|
46
|
+
C D E F | G A B c |"
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### ABC Notation Examples
|
|
51
|
+
|
|
52
|
+
**C Major Scale:**
|
|
53
|
+
|
|
54
|
+
```abc
|
|
55
|
+
X:1
|
|
56
|
+
T:C Major Scale
|
|
57
|
+
M:4/4
|
|
58
|
+
L:1/4
|
|
59
|
+
K:C
|
|
60
|
+
C D E F | G A B c |
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Twinkle, Twinkle Little Star:**
|
|
64
|
+
|
|
65
|
+
```abc
|
|
66
|
+
X:1
|
|
67
|
+
T:Twinkle, Twinkle Little Star
|
|
68
|
+
M:4/4
|
|
69
|
+
L:1/4
|
|
70
|
+
K:C
|
|
71
|
+
C C G G | A A G2 | F F E E | D D C2 |
|
|
72
|
+
G G F F | E E D2 | G G F F | E E D2 |
|
|
73
|
+
C C G G | A A G2 | F F E E | D D C2 |
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Architecture
|
|
77
|
+
|
|
78
|
+
### Server (`server.ts`)
|
|
79
|
+
|
|
80
|
+
Exposes a single `play-sheet-music` tool that accepts:
|
|
81
|
+
|
|
82
|
+
- `abcNotation`: ABC notation string to render
|
|
83
|
+
|
|
84
|
+
The tool validates the ABC notation server-side using the abcjs parser and returns any parse errors. The actual rendering happens client-side when the UI receives the tool input.
|
|
85
|
+
|
|
86
|
+
### App (`src/mcp-app.ts`)
|
|
87
|
+
|
|
88
|
+
- Receives ABC notation via `ontoolinput` handler
|
|
89
|
+
- Uses abcjs for audio playback controls and sheet music rendering (in `renderAbc()`)
|