Remove SSE transport, fix cli tests
This commit is contained in:
parent
f582fb1be0
commit
dce60fa461
7 changed files with 12 additions and 54 deletions
|
|
@ -111,9 +111,6 @@ haiku-rag serve
|
|||
|
||||
# stdio transport
|
||||
haiku-rag serve --stdio
|
||||
|
||||
# SSE transport
|
||||
haiku-rag serve --sse
|
||||
```
|
||||
|
||||
## Settings
|
||||
|
|
|
|||
|
|
@ -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
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue