Skip to content

Commit f1d1591

Browse files
Merge branch 'main' into feat/client-credentials
2 parents efecc7d + 6f43d1f commit f1d1591

File tree

5 files changed

+116
-78
lines changed

5 files changed

+116
-78
lines changed

src/mcp/client/session.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
DEFAULT_CLIENT_INFO = types.Implementation(name="mcp", version="0.1.0")
1717

18-
logging.basicConfig(level=logging.INFO)
1918
logger = logging.getLogger("client")
2019

2120

src/mcp/server/auth/routes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def validate_issuer_url(url: AnyHttpUrl):
3232
"""
3333

3434
# RFC 8414 requires HTTPS, but we allow localhost HTTP for testing
35-
if url.scheme != "https" and url.host != "localhost" and not url.host.startswith("127.0.0.1"):
35+
if (
36+
url.scheme != "https"
37+
and url.host != "localhost"
38+
and (url.host is not None and not url.host.startswith("127.0.0.1"))
39+
):
3640
raise ValueError("Issuer URL must be HTTPS")
3741

3842
# No fragments or query parameters allowed

tests/issues/test_188_concurrency.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,38 @@
1414
@pytest.mark.anyio
1515
async def test_messages_are_executed_concurrently():
1616
server = FastMCP("test")
17+
call_timestamps = []
1718

1819
@server.tool("sleep")
1920
async def sleep_tool():
21+
call_timestamps.append(("tool_start_time", anyio.current_time()))
2022
await anyio.sleep(_sleep_time_seconds)
23+
call_timestamps.append(("tool_end_time", anyio.current_time()))
2124
return "done"
2225

2326
@server.resource(_resource_name)
2427
async def slow_resource():
28+
call_timestamps.append(("resource_start_time", anyio.current_time()))
2529
await anyio.sleep(_sleep_time_seconds)
30+
call_timestamps.append(("resource_end_time", anyio.current_time()))
2631
return "slow"
2732

2833
async with create_session(server._mcp_server) as client_session:
29-
start_time = anyio.current_time()
3034
async with anyio.create_task_group() as tg:
3135
for _ in range(10):
3236
tg.start_soon(client_session.call_tool, "sleep")
3337
tg.start_soon(client_session.read_resource, AnyUrl(_resource_name))
3438

35-
end_time = anyio.current_time()
36-
37-
duration = end_time - start_time
38-
assert duration < 10 * _sleep_time_seconds
39-
print(duration)
39+
active_calls = 0
40+
max_concurrent_calls = 0
41+
for call_type, _ in sorted(call_timestamps, key=lambda x: x[1]):
42+
if "start" in call_type:
43+
active_calls += 1
44+
max_concurrent_calls = max(max_concurrent_calls, active_calls)
45+
else:
46+
active_calls -= 1
47+
print(f"Max concurrent calls: {max_concurrent_calls}")
48+
assert max_concurrent_calls > 1, "No concurrent calls were executed"
4049

4150

4251
def main():

tests/server/fastmcp/test_func_metadata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def func_dict_any() -> dict[str, Any]:
203203

204204
meta = func_metadata(func_dict_any)
205205
assert meta.output_schema == {
206+
"additionalProperties": True,
206207
"type": "object",
207208
"title": "func_dict_anyDictOutput",
208209
}

0 commit comments

Comments
 (0)