mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 21:44:18 +02:00
Fix import and remaining available port
This commit is contained in:
parent
ad8182eed0
commit
3d454380b1
2 changed files with 3 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ from typing import TYPE_CHECKING, Any, Literal
|
|||
import uvicorn
|
||||
|
||||
from fastmcp.settings import settings
|
||||
from fastmcp.utilities.http import find_available_port
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from fastmcp.server.server import FastMCP
|
||||
|
|
@ -84,9 +85,7 @@ def run_server_in_process(
|
|||
The server URL.
|
||||
"""
|
||||
host = "127.0.0.1"
|
||||
with socket.socket() as s:
|
||||
s.bind((host, 0))
|
||||
port = s.getsockname()[1]
|
||||
port = find_available_port()
|
||||
|
||||
proc = multiprocessing.Process(
|
||||
target=server_fn, args=(host, port, *args), daemon=True
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import fastmcp.client.auth # Import module, not the function directly
|
|||
from fastmcp.client import Client
|
||||
from fastmcp.client.transports import StreamableHttpTransport
|
||||
from fastmcp.server.auth.auth import ClientRegistrationOptions
|
||||
from fastmcp.server.auth.providers.in_memory import InMemory
|
||||
from fastmcp.server.auth.in_memory_provider import InMemoryOAuthProvider as InMemory
|
||||
from fastmcp.server.server import FastMCP
|
||||
from fastmcp.utilities.tests import run_server_in_process
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue