supercollider-mcp 0.2.0__py3-none-any.whl
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.
- supercollider_mcp-0.2.0.dist-info/METADATA +225 -0
- supercollider_mcp-0.2.0.dist-info/RECORD +30 -0
- supercollider_mcp-0.2.0.dist-info/WHEEL +4 -0
- supercollider_mcp-0.2.0.dist-info/entry_points.txt +2 -0
- supercollider_mcp-0.2.0.dist-info/licenses/LICENSE +21 -0
- supercollidermcp/__init__.py +8 -0
- supercollidermcp/__main__.py +30 -0
- supercollidermcp/compose.py +653 -0
- supercollidermcp/engine.py +173 -0
- supercollidermcp/osc.py +226 -0
- supercollidermcp/patterns.py +116 -0
- supercollidermcp/server.py +339 -0
- supercollidermcp/synthdefs/__init__.py +19 -0
- supercollidermcp/synthdefs/mcp_blip.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_fm.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_fx.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_grain.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_hat.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_kick.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_lfo.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_limiter.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_noise.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_pad.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_pluck.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_saw.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_sine.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_snare.scsyndef +0 -0
- supercollidermcp/synthdefs/mcp_square.scsyndef +0 -0
- supercollidermcp/synthdefs/synthdefs.scd +164 -0
- supercollidermcp/theory.py +169 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: supercollider-mcp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP server that lets AI assistants make sound with SuperCollider over OSC
|
|
5
|
+
Project-URL: Homepage, https://github.com/Tok/SuperColliderMCP
|
|
6
|
+
Project-URL: Issues, https://github.com/Tok/SuperColliderMCP/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/Tok/SuperColliderMCP/blob/main/CHANGELOG.md
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: audio,mcp,model-context-protocol,music,osc,supercollider,synthesis
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Sound Synthesis
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: mcp<3,>=2.3
|
|
21
|
+
Requires-Dist: python-osc>=1.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
[](https://github.com/Tok/SuperColliderMCP/actions/workflows/ci.yml)
|
|
25
|
+
[](https://mseep.ai/app/70ac07b9-ec05-4fec-9456-5c4331cdf994)
|
|
26
|
+
|
|
27
|
+
# SuperCollider MCP 🎛️
|
|
28
|
+
|
|
29
|
+
A [Model Context Protocol](https://modelcontextprotocol.io/) server that lets AI assistants make sound with
|
|
30
|
+
[SuperCollider](https://supercollider.github.io/). Ask for "a dark ambient drone with slow swells" or
|
|
31
|
+
"a breakbeat at 170 under a Cm7-Fm7 arpeggio" and it plays on your SuperCollider server.
|
|
32
|
+
|
|
33
|
+
- **Real synths and drums.** It ships its own SynthDefs (sine, saw, square, noise, FM, pad, Karplus-Strong
|
|
34
|
+
pluck, kick, snare, hats, grains) plus an effect chain (distortion, low-pass, delay, reverb) and a safety
|
|
35
|
+
limiter. Nothing depends on sclang's `default` synth or on sc3-plugins.
|
|
36
|
+
- **Sample-accurate timing.** Phrases are streamed to scsynth as timestamped OSC bundles, so every tool
|
|
37
|
+
returns immediately. Calls can overlap, so you can layer drums, chords and melody.
|
|
38
|
+
- **Music-aware tools.** Melodies follow 14 scales, chords understand symbols like `Am7`, `Bbmaj9` and `G/B`,
|
|
39
|
+
drum patterns are readable step strings the assistant can write itself, and generative tools take a
|
|
40
|
+
`seed` so a result you like can be replayed exactly.
|
|
41
|
+
- **A panic button.** `stop_all` silences everything this server started.
|
|
42
|
+
|
|
43
|
+
## Requirements
|
|
44
|
+
|
|
45
|
+
- [SuperCollider](https://supercollider.github.io/downloads) 3.10 or newer (tested with 3.13). Only the
|
|
46
|
+
audio server, `scsynth`, has to be running.
|
|
47
|
+
- [uv](https://docs.astral.sh/uv/), or any Python 3.10+ with pip.
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
**1. Install and boot SuperCollider.** Install it from the
|
|
52
|
+
[downloads page](https://supercollider.github.io/downloads) (or `brew install --cask supercollider` on
|
|
53
|
+
macOS, `sudo apt install supercollider` on Debian/Ubuntu), then boot the server:
|
|
54
|
+
|
|
55
|
+
- in the SuperCollider IDE: *Server → Boot Server* (or run `s.boot;`)
|
|
56
|
+
- or without the IDE: `scsynth -u 57110`
|
|
57
|
+
|
|
58
|
+
**2. Add the MCP server to your assistant.**
|
|
59
|
+
|
|
60
|
+
Claude Code:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
claude mcp add supercollider -- uvx supercollider-mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Claude Desktop, Cursor, Cline, Roo Code and other clients that use an `mcpServers` config:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"supercollider": {
|
|
72
|
+
"command": "uvx",
|
|
73
|
+
"args": ["supercollider-mcp"]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
To run the latest code from GitHub instead of the PyPI release, use
|
|
80
|
+
`"args": ["--from", "git+https://github.com/Tok/SuperColliderMCP", "supercollider-mcp"]`.
|
|
81
|
+
|
|
82
|
+
**3. Ask for something.** Start with "play a test sound" to check the connection, then try the prompts
|
|
83
|
+
below.
|
|
84
|
+
|
|
85
|
+
### Configuration
|
|
86
|
+
|
|
87
|
+
| Setting | Flag | Environment | Default |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| scsynth host | `--host` | `SC_HOST` | `127.0.0.1` |
|
|
90
|
+
| scsynth UDP port | `--port` | `SC_PORT` | `57110` |
|
|
91
|
+
| log level (stderr) | `--log-level` | | `WARNING` |
|
|
92
|
+
|
|
93
|
+
For example `"args": ["supercollider-mcp", "--port", "57111"]`.
|
|
94
|
+
|
|
95
|
+
## Tools
|
|
96
|
+
|
|
97
|
+
| Tool | What it does |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| `server_status` | Connection check: scsynth version, CPU, running playbacks, recent server errors |
|
|
100
|
+
| `stop_all` | Silence everything this server started and cancel scheduled notes |
|
|
101
|
+
| `play_example_osc` | A short test chime |
|
|
102
|
+
| `play_synth` | One note on `sine`, `saw`, `square`, `noise`, `fm`, `pad` or `pluck` |
|
|
103
|
+
| `create_layered_synth` | A thick unison: several detuned copies of one note spread in stereo |
|
|
104
|
+
| `create_lfo_modulation` | A held note with a server-side LFO on pitch, volume, filter or pan |
|
|
105
|
+
| `create_granular_texture` | A cloud of 5–100 tiny grains per second, scattered in pitch and space |
|
|
106
|
+
| `play_melody` | A generated melody in one of 14 scales that resolves to the tonic |
|
|
107
|
+
| `create_sequence` | A melody you spell out: `"C4 E4_ G4_ . C5+"` |
|
|
108
|
+
| `create_chord_progression` | Chord symbols as pads, staccato stabs, 8th-note arpeggios or power chords |
|
|
109
|
+
| `create_drum_pattern` | `four_on_floor`, `breakbeat`, `shuffle`, `half_time`, `two_step`, `random`, or your own |
|
|
110
|
+
| `create_generative_rhythm` | Drums that keep mutating: `minimal`, `techno`, `glitch`, `jazz`, `ambient` |
|
|
111
|
+
| `create_ambient_soundscape` | A drone with overlapping swells in a `calm`, `dark`, `bright`, `mysterious` or `chaotic` mood |
|
|
112
|
+
|
|
113
|
+
Most tools also take `volume` (0–1) and an optional `effects` object:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{"reverb": 0.6, "delay": 0.3, "delay_time": 0.25, "distortion": 0.0, "filter": 0.2}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
All amounts are 0–1, and 0 means off. `filter` darkens the sound with a low-pass filter. `delay_time` is in
|
|
120
|
+
seconds and defaults to three quarters of a beat.
|
|
121
|
+
|
|
122
|
+
**Notes** are names like `C4` (middle C), `F#3` or `Bb2`, or frequencies like `"440"` or `"440hz"`.
|
|
123
|
+
|
|
124
|
+
**Sequences** separate notes with spaces or dashes. `_` halves a note, `+` doubles it, `:1.5` sets its
|
|
125
|
+
length in beats, and `.` is a rest.
|
|
126
|
+
|
|
127
|
+
**Drum patterns** use one character per 16th note: `X` accent, `x` hit, `o` ghost note, `.` rest. Lanes
|
|
128
|
+
(`kick`, `snare`, `hat`, `open_hat`, `perc`) can have different lengths and loop independently:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{"custom": {"kick": "X..x..X...x.....", "snare": "....X.......X..o", "hat": "x.x.x.x.x.x.x.x."}, "tempo": 92, "swing": 0.2}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Things to try
|
|
135
|
+
|
|
136
|
+
- "Play a dorian melody in D on the pluck synth with some delay, then the same one an octave lower."
|
|
137
|
+
- "Give me two bars of breakbeat at 170 BPM, then layer an Am7-Dm7-G7-Cmaj7 arpeggio on top."
|
|
138
|
+
- "A mysterious ambient soundscape, 60 seconds, low register."
|
|
139
|
+
- "Sweep a saw's filter with a slow triangle LFO while a granular cloud shimmers around A5."
|
|
140
|
+
- "Write me a half-time drum pattern with ghost notes on the snare."
|
|
141
|
+
|
|
142
|
+
## How it works
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
assistant ──MCP (stdio)──▶ supercollider-mcp ──OSC/UDP──▶ scsynth ──▶ speakers
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
On first use the server checks that scsynth answers, uploads its SynthDefs (`/d_recv`) and creates its own
|
|
149
|
+
node group with a voice group, an effects group and a limiter. Node IDs sit far above the ranges sclang
|
|
150
|
+
uses, so your own SuperCollider work is not affected. If scsynth restarts, the setup runs again on the next
|
|
151
|
+
call.
|
|
152
|
+
|
|
153
|
+
Each tool call turns into a *phrase*: a time-ordered stream of synth events (`supercollidermcp/compose.py`,
|
|
154
|
+
pure Python). A background task sends each event about half a second ahead as an OSC bundle with an NTP
|
|
155
|
+
timetag, and scsynth starts it at exactly that time. Every synth frees itself when its envelope ends. When
|
|
156
|
+
a call asks for effects, its voices go to a private bus that one `mcp_fx` synth reads.
|
|
157
|
+
|
|
158
|
+
## Upgrading from 0.1
|
|
159
|
+
|
|
160
|
+
- Point your MCP config at `uvx supercollider-mcp` as shown above. Old configs that run
|
|
161
|
+
`mcp run path/to/server.py` still work through a small compatibility `server.py`.
|
|
162
|
+
- Sounds now come from real SynthDefs, so you no longer need sclang's `default` synth.
|
|
163
|
+
- Tools return right away instead of blocking until the sound ends.
|
|
164
|
+
- Some parameters changed meaning. `create_drum_pattern` takes `bars` (16 steps each) instead of `beats`.
|
|
165
|
+
`effects` is an object instead of a JSON string. `detune` is now ±50 cents at 1.0 instead of up to an
|
|
166
|
+
octave. The `sc-osc` command-line tool is gone.
|
|
167
|
+
|
|
168
|
+
See [CHANGELOG.md](CHANGELOG.md) for everything else.
|
|
169
|
+
|
|
170
|
+
## Troubleshooting
|
|
171
|
+
|
|
172
|
+
- **"No reply from the SuperCollider server…"**: scsynth is not running, or it listens on a different
|
|
173
|
+
port. Boot it, or set `SC_PORT`.
|
|
174
|
+
- **Calls succeed but you hear nothing**: check that scsynth's outputs are connected to your sound card
|
|
175
|
+
and that `server_status` shows synths while something plays.
|
|
176
|
+
- **Linux with PipeWire** (the default on current Ubuntu and Fedora): scsynth talks to JACK, so install
|
|
177
|
+
PipeWire's JACK layer (`sudo apt install pipewire-jack`) and start SuperCollider through it:
|
|
178
|
+
`pw-jack scide`, or `pw-jack scsynth -u 57110` without the IDE. Otherwise scsynth tries to start its
|
|
179
|
+
own `jackd`, which conflicts with PipeWire.
|
|
180
|
+
- **`FAILURE IN SERVER /g_queryTree Group 2147480000 not found` in the post window** on first connect is
|
|
181
|
+
expected: it is how the server notices that scsynth still needs to be set up.
|
|
182
|
+
- **Remote scsynth**: timetags use wall-clock time, so keep both machines' clocks in sync (NTP).
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
git clone https://github.com/Tok/SuperColliderMCP.git
|
|
188
|
+
cd SuperColliderMCP
|
|
189
|
+
uv sync
|
|
190
|
+
uv run pytest # unit and protocol tests run anywhere
|
|
191
|
+
uv run ruff check . && uv run ruff format --check .
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Some tests need SuperCollider:
|
|
195
|
+
|
|
196
|
+
- `tests/test_synthdefs_nrt.py` renders every SynthDef with `scsynth -N` (no audio device needed) and
|
|
197
|
+
checks the audio. It runs automatically when `scsynth` is on `PATH`, or set `SCSYNTH=/path/to/scsynth`.
|
|
198
|
+
- `tests/test_live_server.py` runs every tool against a live server. Start a silent one with
|
|
199
|
+
`scsynth -u 57199 -i 0 -o 0`, then run `SC_TEST_PORT=57199 uv run pytest`.
|
|
200
|
+
|
|
201
|
+
The SynthDefs are written in SuperCollider itself, in `supercollidermcp/synthdefs/synthdefs.scd`. After
|
|
202
|
+
editing that file, rebuild the compiled `.scsyndef` files with `python scripts/build_synthdefs.py`
|
|
203
|
+
(needs `sclang`; it runs headless).
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
supercollidermcp/
|
|
207
|
+
├── server.py MCP tools: validation and wiring
|
|
208
|
+
├── compose.py musical logic: requests → timed events (pure, unit-tested)
|
|
209
|
+
├── theory.py notes, scales, chords
|
|
210
|
+
├── patterns.py drum patterns as step strings
|
|
211
|
+
├── engine.py server setup, buses, streaming playback, stop_all
|
|
212
|
+
├── osc.py async OSC client that also reads scsynth's replies
|
|
213
|
+
└── synthdefs/ synthdefs.scd (source) + compiled .scsyndef files
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Contributions are welcome. New sounds usually mean a SynthDef in `synthdefs.scd` plus a composer function
|
|
217
|
+
in `compose.py`.
|
|
218
|
+
|
|
219
|
+
## External Security Assessment
|
|
220
|
+
|
|
221
|
+
[](https://mseep.ai/app/tok-supercollidermcp)
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
supercollidermcp/__init__.py,sha256=V8XlubtKzdQeA6ON8W5CcPPYKQrjFCwaYv9EmNPUNE8,315
|
|
2
|
+
supercollidermcp/__main__.py,sha256=89kDbLOQmPt9dNWJn1Wv3-JQb7BCpwnsgVq4LPlOMaA,1226
|
|
3
|
+
supercollidermcp/compose.py,sha256=NFVPQVYO_bdbIVX-sTOjkoA4LVq3bBL4hBAPN1py_4w,23413
|
|
4
|
+
supercollidermcp/engine.py,sha256=rVZkVG1BRZv9IdgLLZF2Ovo2SqwRFcCoVSfVG7gJvuc,7127
|
|
5
|
+
supercollidermcp/osc.py,sha256=uCHNj_JDuBL1gqktw_YfhP5A3DC9BgBrmYt8RYUrS90,8773
|
|
6
|
+
supercollidermcp/patterns.py,sha256=bDhgDya3Uv2ve0xajOyxoQeBumclhiFe4EuO51qj4rw,4567
|
|
7
|
+
supercollidermcp/server.py,sha256=s9HxjOYqXM4YbX91C_xgLfis_T5jj4leFCG3Z26EAhQ,15630
|
|
8
|
+
supercollidermcp/theory.py,sha256=ZcB_cnW29v_E_4M5sPTyoPDu1erbxmMt8RQSWS6LmVE,5691
|
|
9
|
+
supercollidermcp/synthdefs/__init__.py,sha256=1DahkqoG7VsmTFFqTklEPESsweZJTb-EVT5gAjqa_5k,673
|
|
10
|
+
supercollidermcp/synthdefs/mcp_blip.scsyndef,sha256=Lm-E4IAtcQJVTGwxmTB8An5vbXJqOJlJKKmrFL4SjKE,634
|
|
11
|
+
supercollidermcp/synthdefs/mcp_fm.scsyndef,sha256=sJJ2DgbpDin0Vw99gg-Uk-aStLIeYzlSQsfZ5msyln8,1009
|
|
12
|
+
supercollidermcp/synthdefs/mcp_fx.scsyndef,sha256=b1oKcUSx6WLcso7SaSsRllSU_E0uS6zFyT7CsDdzgD8,1614
|
|
13
|
+
supercollidermcp/synthdefs/mcp_grain.scsyndef,sha256=KdNRd-AU9-MM8nkwZnKc9Wmlt6iwE9FMAA4BNoZ7Cfc,590
|
|
14
|
+
supercollidermcp/synthdefs/mcp_hat.scsyndef,sha256=WY2WonKEHu4ZYnxNph1piajTQX4t0aQx8VrJ9lF74oI,573
|
|
15
|
+
supercollidermcp/synthdefs/mcp_kick.scsyndef,sha256=eTK5nTF8vp-8R6gmhc2zSscFwnpYNDSJYR_N9OB_agI,1124
|
|
16
|
+
supercollidermcp/synthdefs/mcp_lfo.scsyndef,sha256=h55CxZcAIvqayU7K7FYHzARfvGZ4WikDaBlSSieGwTk,1101
|
|
17
|
+
supercollidermcp/synthdefs/mcp_limiter.scsyndef,sha256=xjq7X_2qEw9pAU9DOWc5NwlS3xSh6O1Je7pEEDuzvr0,249
|
|
18
|
+
supercollidermcp/synthdefs/mcp_noise.scsyndef,sha256=nQbyqksEqkF4X8lClZRrETiMb5YPWADX3ywgK3PtSac,744
|
|
19
|
+
supercollidermcp/synthdefs/mcp_pad.scsyndef,sha256=wZUTWbxM0OJskgAyHl_9y2b5ufCzf1y7x1xOLTvCevM,1745
|
|
20
|
+
supercollidermcp/synthdefs/mcp_pluck.scsyndef,sha256=ydGv8JTaYWTwci2SRXgb2duedkXx0iZcgmZluzLMD1I,985
|
|
21
|
+
supercollidermcp/synthdefs/mcp_saw.scsyndef,sha256=cUyImaUVWJqLwuHokb_bqMXqKnJHBo3eOvY0Gd5kiXo,715
|
|
22
|
+
supercollidermcp/synthdefs/mcp_sine.scsyndef,sha256=IPZ_2cY-oIVzAKrV4g-HNKYmJwFr2ZdUK0Ea3M34Ouk,564
|
|
23
|
+
supercollidermcp/synthdefs/mcp_snare.scsyndef,sha256=Rf99ZL4YMgHlX9dgEwSaczzgV9k6xebSIcLv303YcWM,1018
|
|
24
|
+
supercollidermcp/synthdefs/mcp_square.scsyndef,sha256=hkNwPVUL2OahlrAnLlfnNNmOQSaGEGFCUFZbf9pbCVs,792
|
|
25
|
+
supercollidermcp/synthdefs/synthdefs.scd,sha256=WGf2K-JLAP_lopubQRFhGxSrhgMCufF3afbzA5kYmQw,7774
|
|
26
|
+
supercollider_mcp-0.2.0.dist-info/METADATA,sha256=7PNmKKzzL5CdnliJx2EEIPFqWjbPzkSHJukBKRPgCa0,10789
|
|
27
|
+
supercollider_mcp-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
28
|
+
supercollider_mcp-0.2.0.dist-info/entry_points.txt,sha256=1e19aubxQcUUdND1rUTXwa4W5J_bmTkTOdK0RdDTpXo,69
|
|
29
|
+
supercollider_mcp-0.2.0.dist-info/licenses/LICENSE,sha256=mHYNjxna5ngTcw4nxr78_bU5XJw8MFjn1Uox5nihAZw,1060
|
|
30
|
+
supercollider_mcp-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 tok
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""SuperColliderMCP: an MCP server for making sound with SuperCollider over OSC."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
__version__ = version("supercollider-mcp")
|
|
7
|
+
except PackageNotFoundError: # running from a source checkout without installing
|
|
8
|
+
__version__ = "0.0.0+unknown"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Run the MCP server over stdio: `supercollider-mcp` or `python -m supercollidermcp`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import logging
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
from .engine import Engine
|
|
11
|
+
from .osc import SCClient
|
|
12
|
+
from .server import config_from_env, create_server
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main(argv: list[str] | None = None) -> None:
|
|
16
|
+
host, port = config_from_env()
|
|
17
|
+
parser = argparse.ArgumentParser(prog="supercollider-mcp", description="MCP server for SuperCollider (stdio)")
|
|
18
|
+
parser.add_argument("--host", default=host, help=f"scsynth host (env SC_HOST, default {host})")
|
|
19
|
+
parser.add_argument("--port", type=int, default=port, help=f"scsynth UDP port (env SC_PORT, default {port})")
|
|
20
|
+
parser.add_argument("--log-level", default="WARNING", choices=["DEBUG", "INFO", "WARNING", "ERROR"])
|
|
21
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
22
|
+
args = parser.parse_args(argv)
|
|
23
|
+
|
|
24
|
+
# stdout carries the MCP protocol, so logs must go to stderr
|
|
25
|
+
logging.basicConfig(level=args.log_level, stream=sys.stderr, format="%(levelname)s %(name)s: %(message)s")
|
|
26
|
+
create_server(Engine(SCClient(args.host, args.port))).run()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|