From ca35520338057512a71acd42bb116ffbb82cc192 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Sat, 11 Jul 2026 19:02:14 +0900 Subject: feat: implement Famicom-style MML composer MCP server - Add FastMCP server with compose_mml tool - Support ppmck and pyxel MML syntax - Add lexer and parsers for both formats - Add NES APU-style synthesizer (pulse/triangle/noise) to WAV - Add MML templates (basic/melody/chord/drum/empty) for both modes - Add tests for lexer, parser, and server - Support stdio, http, sse, streamable-http transports - Update README, pyproject.toml, and .gitignore --- tests/test_server.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_server.py (limited to 'tests/test_server.py') diff --git a/tests/test_server.py b/tests/test_server.py new file mode 100644 index 0000000..533c88b --- /dev/null +++ b/tests/test_server.py @@ -0,0 +1,33 @@ +"""Tests for MCP server compose_mml tool.""" + +from mml_composemusic_mcp.server import compose_mml + +PPMCK_MML = """#TITLE "Test" +A t120 l4 o4 v15 q2 + c e g c +""" + + +def test_compose_ppmck(): + result = compose_mml(action="compose", mml=PPMCK_MML, mode="ppmck") + assert result["success"] is True + assert result["wav_path"] is not None + assert result["duration_sec"] > 0 + + +def test_validate_ppmck(): + result = compose_mml(action="validate", mml=PPMCK_MML, mode="ppmck") + assert result["valid"] is True + assert result["channel_summary"] + + +def test_template(): + result = compose_mml(action="template", mode="pyxel", template="basic") + assert "mml" in result + assert "0:" in result["mml"] + + +def test_compose_error(): + result = compose_mml(action="compose", mml="A t0\n c", mode="ppmck") + assert result["success"] is False + assert any(e["severity"] == "error" for e in result["validation"]["errors"]) -- cgit v1.2.3