mml-composemusic-mcp
Summary: This MCP server turns LLM-written MML (Music Macro Language) into retro 2A03-APU-style chiptune WAV audio through a single compose_mml tool.
Compose audio —
action: "compose"synthesizes MML into mono 16-bit PCM WAV, returned as a base64audio/wavAudioContent with metadata (duration_sec, note sequence, validation results); options includesample_rate(default 44100) andnormalize.Validate MML —
action: "validate"checks syntax, value ranges, and channel suitability before synthesis, returningvalid,errors(with line/column, cause, fix hints),warnings,note_sequence, andchannel_summary.Get templates —
action: "template"returns one of 8 editable examples (basic,melody,chord,drum,empty,expressive_lead,vibrato_lead,pitch_motion) in either mode.Two MML dialects —
mode: "ppmck"(lowercase, channelsA/B/T/N/L) ormode: "pyxel"(uppercase, channels0:–3:).4-channel chiptune synth — Pulse1, Pulse2, Triangle, Noise, with volume/timbre envelopes, vibrato, LFO, glide, sweep, detune, arpeggio, ties/slurs, and repeats.
Saves artifacts — writes
output.wavandoutput.mmlinto a timestamped folder under--output-dir(path not exposed in responses).Flexible transports — runs over stdio (default), HTTP, SSE, or Streamable HTTP for MCP client integration.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mml-composemusic-mcpcompose a short retro melody in pyxel format"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mml-composemusic-mcp
LLMにMMLを書かせ、レトロゲーム機風の音楽をWAVとして生成するMCPサーバです。
Pulse 2ch、Triangle 1ch、Noise 1chの構成を持つ簡易2A03 APU風シンセサイザーを内蔵しています。MCPクライアントから単一のcompose_mmlツールを呼び出すことで、作曲、検証、作例テンプレートの取得まで行えます。
ppmckとpyxelは、このプロジェクトが受理するMML構文モードの名前です。オリジナルのPPMCK/mckcやPyxelとの完全な互換性は保証しません。
主な機能
MMLを解析し、モノラル16-bit PCMのWAVファイルを生成
構文・値域・チャンネル適合性を合成前に検証
Pulse1、Pulse2、Triangle、Noiseの4チャンネルに対応
ppmck風の小文字MMLと、Pyxel風の大文字MMLに対応
音量・音色エンベロープ、ビブラート、LFO、グライド、スイープなどを合成へ反映
LLMがコピーして改変できる8種類の作例テンプレートを収録
stdio、HTTP、SSE、Streamable HTTPトランスポートに対応
Related MCP server: chord-player-mcp
サンプルデータ
実際にLLMを使用してこのMCPツールで作曲させてみたサンプルデータです。
ppmck版
pyxel版
必要環境
Python 3.14以上
uv(推奨)
セットアップ
リポジトリを取得し、プロジェクトのディレクトリで依存関係をインストールします。
uv sync
uv run mml-composemusic-mcp --helppipを使う場合は、仮想環境内で次のようにインストールできます。
python -m pip install -e .
mml-composemusic-mcp --helpMCPクライアントへの登録
標準入出力で起動する設定例です。C:\path\to\mml-composemusic-mcpと出力先を実際の絶対パスへ置き換えてください。
{
"mcpServers": {
"mml-composemusic": {
"command": "uv",
"args": [
"run",
"--project",
"C:\\path\\to\\mml-composemusic-mcp",
"mml-composemusic-mcp",
"--output-dir",
"C:\\path\\to\\mml-composemusic-mcp\\data"
]
}
}
}--output-dirを省略した場合は、サーバの作業ディレクトリにある./dataへ出力します。MCPクライアントによって作業ディレクトリが異なるため、通常は絶対パスの指定を推奨します。
HTTP系トランスポートで手動起動する場合は、次のオプションを利用できます。
uv run mml-composemusic-mcp \
--transport streamable-http \
--host 127.0.0.1 \
--port 8080 \
--output-dir ./data利用可能な--transportはstdio(デフォルト)、http、sse、streamable-httpです。HTTP側の接続URLは、使用するFastMCPとMCPクライアントのトランスポート設定に合わせてください。
LLMからの使い方
公開されるツールはcompose_mmlの1つです。基本的には、テンプレートを取得して編集し、検証してから合成します。
action: "template"で作例を取得する作りたい曲に合わせてLLMがMMLを書き換える
action: "validate"でエラーと警告を確認する問題がなければ
action: "compose"でWAVを生成する
MCPクライアントでは、たとえば次のように依頼できます。
pyxelモードのvibrato_leadテンプレートを参考に、テンポ150の明るい8小節のボス戦BGMを作ってください。まずvalidateし、問題を直してからcomposeしてください。
compose_mmlの引数
引数 | 型 | 使用するaction | デフォルト | 説明 |
| string | すべて | 必須 |
|
| string | すべて |
|
|
| string | validate/compose |
| 検証・合成するMML |
| string | template |
| 取得するテンプレート名 |
| integer | compose |
| WAVのサンプリング周波数 |
| boolean | compose |
| 合成後に振幅を正規化するか |
未知のmodeをtemplateで指定した場合はppmck、未知のテンプレート名を指定した場合はbasicへフォールバックします。validate/composeではmmlとmodeが必須です。
テンプレートを取得する
{
"action": "template",
"mode": "pyxel",
"template": "vibrato_lead"
}テンプレート | 用途 |
| メロディ、伴奏、ベース、リズムの基本4ch構成 |
| Pulse1の主旋律を中心にした構成 |
| Pulseのコード伴奏とTriangleベースを中心にした構成 |
| Noiseのビートを中心にした構成 |
| 各チャンネルを休符だけにした最小構成 |
| 音量・音色エンベロープを使うリード |
| ビブラート、ピッチ変化、デチューンを使うリード |
| アルペジオ、スイープ、グライドを使う効果的な音程変化 |
テンプレートは両モードに用意され、同じ目的を各モード固有のコマンドで表現します。
MMLを検証する
{
"action": "validate",
"mode": "ppmck",
"mml": "A t120 l8 o4 v15 q7 @2\n c d e f | g a b >c"
}valid、errors、warningsに加え、解析済みのnote_sequenceとチャンネルごとのchannel_summaryを返します。エラーには行・列、原因、修正ヒントが含まれます。
WAVを生成する
{
"action": "compose",
"mode": "pyxel",
"mml": "0: T120 L8 O4 V100 Q90 @1\n C D E F | G A B >C",
"sample_rate": 44100,
"normalize": true
}成功時は、MCPレスポンスのcontentにaudio/wavのAudioContentを返します。WAVデータはbase64エンコードされ、ファイルサイズにかかわらず同じ形式で返されます。structuredContentにはsuccess: true、duration_sec、音声メタデータ、解析済みのnote_sequence、検証結果が入ります。
指定した出力ディレクトリの下には、従来どおり生成時刻を表すYYYYMMDD_HHMMSS_mmmディレクトリを作り、output.wavと合成に使用したMML原文のoutput.mmlを保存します。この保存先はサーバ内部の情報であり、MCPレスポンスにはファイルパスを含めません。
MCPツールとしての成否はisErrorで判定します。compose、引数、actionなどのエラーはisError: true、正常に完了したvalidateは対象MMLが不正でもisError: falseです。composeのsuccessとvalidateのvalidは、それぞれの処理結果を表す構造化フィールドです。
MMLの書き方
チャンネル対応
音源 | ppmck | pyxel | 特徴 |
Pulse1 |
|
| デューティ比を変更できる矩形波 |
Pulse2 |
|
| デューティ比を変更できる矩形波 |
Triangle |
|
| 主にベース向けの三角波 |
Noise |
|
| ドラムや効果音向けのノイズ |
Loop |
| — | ppmckのループトラック |
ppmckは音符と基本コマンドに小文字、pyxelは大文字を使います。
ppmckモード
#TITLE "My Song"
#COMPOSER "LLM"
A t150 l8 o4 v15 q7 @2
c d e f | g a b >c
B l8 o3 v11 @1
c r g r | c r g r
T l4 o2 v7
c2 g2 | a2 f2
N l8 v10
c r c c | c r c r主な拡張機能:
D: セント単位のデチューンs: Pulseハードウェアスイープv+/v-: 相対音量@v/@@: 音量・デューティエンベロープ@MP/MP/MPOF: LFOの定義・適用・解除@EP/EP/EPOF: ピッチエンベロープ@EN/EN/ENOF: 高速アルペジオ向けノートエンベロープ^: タイ、&: スラー
pyxelモード
0: T150 L8 O4 V110 Q90 @1
C D E F | G A B >C
1: L8 O3 V80 @2
C R G R | C R G R
2: L4 O2 V60
C2 G2 | A2 F2
3: L8 V80
C R C C | C R C R主な拡張機能:
K: 半音単位のトランスポーズY: セント単位のデチューン@ENV: 音量エンベロープ@VIB: ビブラート@GLI: グライド[...]N: 回数付きリピート&: スラー
値域や正確な文法はMML構文規則、MCPの入出力はMCPツール仕様、内部構造は設計書を参照してください。
現在の制約
DPCM、NSF出力、GUI、Webプレイヤーはありません。
実機や既存ドライバの音を厳密に再現するエミュレーターではありません。
Pulse専用コマンドをTriangleやNoiseへ指定すると、エラーまたは警告になります。
ppmckの区間リピートなど、設計上予約されていても未実装の構文があります。
pyxelの無限リピートは安全のため有限回で打ち切られ、警告が返る場合があります。
開発
# 全テスト
uv run pytest
# lint
uv run ruff check .
# format
uv run ruff format .
# stdioサーバを手動起動
uv run mml-composemusic-mcp --output-dir ./data受理するMML文法を変更する場合は、実装・テストと合わせてdoc/MML_BNF.mdを更新してください。
変更履歴
CHANGELOG.mdを参照してください。
ライセンス
MIT
Available Tools
1 toolcompose_mmlC
Compose, validate, or generate templates for retro chiptune-style MML.
| Name | Required | Description | Default |
|---|---|---|---|
| mml | No | ||
| mode | No | ||
| action | Yes | ||
| template | No | basic | |
| normalize | No | ||
| sample_rate | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, and the description fails to disclose behavioral traits such as side effects, permissions, or limitations. The multiple actions are listed without detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single sentence is short but under-specifies the tool's capabilities and parameters, sacrificing informativeness for brevity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given six parameters and no annotations or sibling context, the description is insufficient. Output schema exists but not referenced.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description must explain parameters but does not. None of the six parameters (action, mml, mode, template, normalize, sample_rate) are described, leaving the agent guessing.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description specifies the tool's domain (retro chiptune-style MML) and three actions (compose, validate, generate templates). It's clear but could be more specific about the primary function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. The description only lists actions without context for selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
compose_mml
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion between tools. The single tool has a clear and distinct purpose.
With only one tool, naming consistency is perfect by default. The tool name follows a clear verb pattern.
A single tool is at the low end of the typical range. While it covers composition, validation, and template generation, it feels thin for a dedicated music composition server; multiple tools might be expected for separate concerns.
The tool attempts to cover compose, validate, and generate templates, but lacks any management or retrieval operations (e.g., listing, deleting, updating compositions), leaving significant gaps in the expected lifecycle.
Maintenance
Related MCP Connectors
MCP server for Producer/Riffusion AI music generation
MCP server for Text-to-Speech
An MCP server that used to create notes
MCP server exposing the AceDataCloud Fish Audio API (text-to-speech with voice conditioning)
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that generates music using your Suno account, enabling credit checking, song generation, and MP3 downloads without third-party APIs.711 PyPIMIT
- FlicenseNot gradedqualityFmaintenanceAn MCP server that plays chord progressions via MIDI/WAV synthesis.-
- AlicenseAqualityBmaintenanceA game-agnostic MCP toolkit for composing chiptune/retro MIDI and rendering game audio, enabling AI agents to generate multi-track MIDI files and render them to OGG/WAV.7MIT
- FlicenseNot gradedqualityBmaintenanceMCP server that lets AI agents compose real music through a persistent server-side score, supporting planning, voice writing, verification, and MIDI export.-