summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-09-12 20:40:07 +0900
committertanaka takashi <isazaka@gmail.com>2026-09-12 20:40:07 +0900
commit4f3f548b1b55d4c7477250fc3373b3bd6d0d397f (patch)
tree5688ea7fa04af051055323e316e53533b9db6193 /tests/conftest.py
parentcc6165947a82d2182df8accbc7b4adfe2606db9e (diff)
streamable-httpトランスポート対応を追加
MCP SDK 2.xのMCPServer.run(transport="streamable-http")を使い、stdioに 加えてStreamable HTTPトランスポートで起動できるようにする。SSEはMCP仕様で 非推奨のため選択肢から除外し、transport enumはstdioとstreamable-httpの 2種類のみとした。 transportの選択はTOML [server] tableで指定し、CLI引数は追加しない。 仕様の「CLI上書きを行わない」「TOML集約」原則に準拠する。[server]省略時は stdio(後方互換)、streamable-http時はhost=127.0.0.1 port=8000を既定値とする。 変更内容: - config.py: ServerConfig dataclass、VALID_TRANSPORTS定数、AppConfig.server フィールド、load_configの[server]読込・validation追加 - cli.py: main()でconfig.server.transportに応じたrun()引数分岐 - tests/conftest.py: app_config fixtureにserver=ServerConfig()追加 - tests/test_config.py: [server]の正常系・異常系・境界値テスト追加 (省略時stdio既定値、streamable-http読込、sse/http/ws/unknown拒否、 port境界値0/65536/-1/文字列、host空文字拒否) - doc/config.md: [server]セクション追記、設定項目一覧表更新 - config.example.toml: [server]コメント例追記 - doc/Specifications.md: スコープ表にMCPトランスポート行追加 - doc/Design.md: 責務表と起動フロー更新 - doc/mcp.md: 概要のtransport記載更新 - README.md: streamable-http起動例追記 - script/smoke_streamable_http.py: streamable-http経由の検証スクリプト追加 検証: - ruff format/check、pyright 0 errors、pytest 50 passed - 実GPU・実モデルでstreamable-http経由generate_imageの全ルート確認 (HTTP接続→MCP initialize→tools/list→tools/call→PNG生成・返却) - 生成結果: 335KB PNG、512x512、20 steps、CFG 7.0
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index d364dbd..862b4f5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -14,6 +14,7 @@ from mcp_sd15.config import (
GenerationConfig,
ModelConfig,
OutputConfig,
+ ServerConfig,
)
@@ -28,6 +29,7 @@ def app_config(tmp_path: Path) -> AppConfig:
inpaint=ControlModelConfig(True, "inpaint.safetensors"),
),
output=OutputConfig(tmp_path / "outputs", False),
+ server=ServerConfig(),
)