/ tests / mcp / test_cli.py
test_cli.py
 1  import sys
 2  
 3  import pytest
 4  from fastmcp import Client
 5  from fastmcp.client.transports import StdioTransport
 6  
 7  import mlflow
 8  
 9  
10  @pytest.mark.asyncio
11  async def test_cli():
12      transport = StdioTransport(
13          command=sys.executable,
14          args=[
15              "-m",
16              "mlflow",
17              "mcp",
18              "run",
19          ],
20          env={
21              "MLFLOW_TRACKING_URI": mlflow.get_tracking_uri(),
22              "MLFLOW_MCP_TOOLS": "traces,scorers",
23          },
24      )
25      async with Client(transport) as client:
26          tools = await client.list_tools()
27          assert len(tools) > 0