mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
feat(tests): enable MCP tests in server mode (#4146)
We would like to run all OpenAI compatibility tests using only the openai-client library. This is most friendly for contributors since they can run tests without needing to update the client-sdks (which is getting easier but still a long pole.) This is the first step in enabling that -- no using "library client" for any of the Responses tests. This seems like a reasonable trade-off since the usage of an embeddeble library client for Responses (or any OpenAI-compatible) behavior seems to be not very common. To do this, we needed to enable MCP tests (which only worked in library client mode) for server mode.
This commit is contained in:
parent
9eb81439d2
commit
1e81056a22
29 changed files with 13388 additions and 127 deletions
|
|
@ -244,8 +244,14 @@ def make_mcp_server(required_auth_token: str | None = None, tools: dict[str, Cal
|
|||
timeout = 2
|
||||
start_time = time.time()
|
||||
|
||||
server_url = f"http://localhost:{port}/sse"
|
||||
logger.debug(f"Waiting for MCP server thread to start on port {port}")
|
||||
# Determine the appropriate host for the server URL based on test environment
|
||||
# - For library client and server mode: use localhost (both on same host)
|
||||
# - For docker mode: use host.docker.internal (container needs to reach host)
|
||||
import os
|
||||
|
||||
mcp_host = os.environ.get("LLAMA_STACK_TEST_MCP_HOST", "localhost")
|
||||
server_url = f"http://{mcp_host}:{port}/sse"
|
||||
logger.debug(f"Waiting for MCP server thread to start on port {port} (accessible via {mcp_host})")
|
||||
|
||||
while time.time() - start_time < timeout:
|
||||
if server_thread.is_alive():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue