diff --git a/docs/cli.md b/docs/cli.md index cc543d08..29304493 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -111,9 +111,6 @@ haiku-rag serve # stdio transport haiku-rag serve --stdio - -# SSE transport -haiku-rag serve --sse ``` ## Settings diff --git a/docs/mcp.md b/docs/mcp.md index f0bf8c93..ec2d02c9 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -19,7 +19,7 @@ The MCP server exposes `haiku.rag` as MCP tools for compatible MCP clients. ## Starting MCP Server -The MCP server starts automatically with the serve command and supports Streamable HTTP, stdio and SSE transports: +The MCP server starts automatically with the serve command and supports Streamable HTTP and stdio transports: ```bash # Default streamable HTTP transport @@ -27,7 +27,4 @@ haiku-rag serve # stdio transport (for Claude Desktop) haiku-rag serve --stdio - -# SSE transport -haiku-rag serve --sse ``` diff --git a/docs/server.md b/docs/server.md index afd8a836..15f862b1 100644 --- a/docs/server.md +++ b/docs/server.md @@ -11,7 +11,6 @@ haiku-rag serve Transport options: - Default - Streamable HTTP transport - `--stdio` - Standard input/output transport -- `--sse` - Server-sent events transport ## File Monitoring diff --git a/src/haiku/rag/app.py b/src/haiku/rag/app.py index d0948ea4..c41d6267 100644 --- a/src/haiku/rag/app.py +++ b/src/haiku/rag/app.py @@ -289,8 +289,6 @@ class HaikuRAGApp: try: if transport == "stdio": await server.run_stdio_async() - elif transport == "sse": - await server.run_sse_async() else: await server.run_http_async(transport="streamable-http") except KeyboardInterrupt: diff --git a/src/haiku/rag/cli.py b/src/haiku/rag/cli.py index c23916c9..4fc5b144 100644 --- a/src/haiku/rag/cli.py +++ b/src/haiku/rag/cli.py @@ -356,11 +356,6 @@ def serve( "--stdio", help="Run MCP server on stdio Transport", ), - sse: bool = typer.Option( - False, - "--sse", - help="Run MCP server on SSE transport", - ), ) -> None: """Start the MCP server.""" from haiku.rag.app import HaikuRAGApp @@ -370,8 +365,6 @@ def serve( transport = None if stdio: transport = "stdio" - elif sse: - transport = "sse" asyncio.run(app.serve(transport=transport)) diff --git a/tests/test_app.py b/tests/test_app.py index ec1aaada..5e7f80d1 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -172,7 +172,7 @@ async def test_search_no_results(app: HaikuRAGApp, monkeypatch): @pytest.mark.asyncio -@pytest.mark.parametrize("transport", ["stdio", "sse", "http", None]) +@pytest.mark.parametrize("transport", ["stdio", "http", None]) async def test_serve(app: HaikuRAGApp, monkeypatch, transport): """Test the serve method with different transports.""" mock_server = AsyncMock() @@ -199,8 +199,6 @@ async def test_serve(app: HaikuRAGApp, monkeypatch, transport): if transport == "stdio": mock_server.run_stdio_async.assert_called_once() - elif transport == "sse": - mock_server.run_sse_async.assert_called_once() else: mock_server.run_http_async.assert_called_once_with(transport="streamable-http") diff --git a/tests/test_cli.py b/tests/test_cli.py index d025a16b..d4e5a455 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -8,7 +8,7 @@ runner = CliRunner() def test_list_documents(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.list_documents = AsyncMock() mock_app.return_value = mock_app_instance @@ -20,7 +20,7 @@ def test_list_documents(): def test_add_document_text(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.add_document_from_text = AsyncMock() mock_app.return_value = mock_app_instance @@ -34,7 +34,7 @@ def test_add_document_text(): def test_add_document_src(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.add_document_from_source = AsyncMock() mock_app.return_value = mock_app_instance @@ -46,7 +46,7 @@ def test_add_document_src(): def test_get_document(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.get_document = AsyncMock() mock_app.return_value = mock_app_instance @@ -58,7 +58,7 @@ def test_get_document(): def test_delete_document(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.delete_document = AsyncMock() mock_app.return_value = mock_app_instance @@ -70,7 +70,7 @@ def test_delete_document(): def test_search(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.search = AsyncMock() mock_app.return_value = mock_app_instance @@ -82,7 +82,7 @@ def test_search(): def test_serve(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.serve = AsyncMock() mock_app.return_value = mock_app_instance @@ -94,7 +94,7 @@ def test_serve(): def test_serve_stdio(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.serve = AsyncMock() mock_app.return_value = mock_app_instance @@ -105,32 +105,8 @@ def test_serve_stdio(): mock_app_instance.serve.assert_called_once_with(transport="stdio") -def test_serve_sse(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: - mock_app_instance = MagicMock() - mock_app_instance.serve = AsyncMock() - mock_app.return_value = mock_app_instance - - result = runner.invoke(cli, ["serve", "--sse"]) - - assert result.exit_code == 0 - mock_app_instance.serve.assert_called_once_with(transport="sse") - - -def test_serve_stdio_and_sse(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: - mock_app_instance = MagicMock() - mock_app_instance.serve = AsyncMock() - mock_app.return_value = mock_app_instance - - result = runner.invoke(cli, ["serve", "--stdio", "--sse"]) - - assert result.exit_code == 1 - assert "Error: Cannot use both --stdio and --http options" in result.stdout - - def test_ask(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.ask = AsyncMock() mock_app.return_value = mock_app_instance @@ -144,7 +120,7 @@ def test_ask(): def test_ask_with_cite(): - with patch("haiku.rag.cli.HaikuRAGApp") as mock_app: + with patch("haiku.rag.app.HaikuRAGApp") as mock_app: mock_app_instance = MagicMock() mock_app_instance.ask = AsyncMock() mock_app.return_value = mock_app_instance