diff --git a/tests/conformance/server.py b/tests/conformance/server.py index d92b22dd7..158b0949e 100644 --- a/tests/conformance/server.py +++ b/tests/conformance/server.py @@ -12,7 +12,7 @@ from enum import Enum as PyEnum import mcp_types from mcp_types import EmbeddedResource, ImageContent, TextContent -from pydantic import AnyUrl, BaseModel, Field +from pydantic import BaseModel, Field from fastmcp import FastMCP from fastmcp.exceptions import ToolError @@ -77,7 +77,7 @@ async def test_embedded_resource() -> list: EmbeddedResource( type="resource", resource=mcp_types.TextResourceContents( - uri=AnyUrl("test://embedded-resource"), + uri="test://embedded-resource", mime_type="text/plain", text="This is an embedded resource content.", ), @@ -98,7 +98,7 @@ async def test_multiple_content_types() -> list: EmbeddedResource( type="resource", resource=mcp_types.TextResourceContents( - uri=AnyUrl("test://mixed-content-resource"), + uri="test://mixed-content-resource", mime_type="application/json", text='{"test":"data","value":123}', ), @@ -348,7 +348,7 @@ async def test_prompt_with_embedded_resource(resourceUri: str) -> list: EmbeddedResource( type="resource", resource=mcp_types.TextResourceContents( - uri=AnyUrl(resourceUri), + uri=resourceUri, mime_type="text/plain", text=f"Content of resource {resourceUri}", ), diff --git a/tests/server/auth/oauth_proxy/test_config.py b/tests/server/auth/oauth_proxy/test_config.py index c5e8e3078..a69330a3e 100644 --- a/tests/server/auth/oauth_proxy/test_config.py +++ b/tests/server/auth/oauth_proxy/test_config.py @@ -108,6 +108,7 @@ class TestResourceURLValidation: await proxy_with_resource_url.authorize(client, params) assert exc_info.value.error == "invalid_target" + assert exc_info.value.error_description is not None assert "Resource does not match" in exc_info.value.error_description async def test_authorize_accepts_matching_resource(self, proxy_with_resource_url): diff --git a/tests/server/tasks/test_task_tools.py b/tests/server/tasks/test_task_tools.py index 5656a4649..73ffc1310 100644 --- a/tests/server/tasks/test_task_tools.py +++ b/tests/server/tasks/test_task_tools.py @@ -83,7 +83,7 @@ async def test_task_tool_invalid_arguments_fail_before_task_state(): self.methods: list[str] = [] async def on_notification(self, message: mcp_types.ServerNotification) -> None: - self.methods.append(message.root.method) + self.methods.append(message.method) server = FastMCP("tool-task-invalid-args-server") diff --git a/tests/test_mcp_config.py b/tests/test_mcp_config.py index 16abfcb35..13b8b67c9 100644 --- a/tests/test_mcp_config.py +++ b/tests/test_mcp_config.py @@ -8,7 +8,6 @@ import sys import tempfile import time from collections.abc import AsyncGenerator -from datetime import timedelta from pathlib import Path from typing import Any from unittest.mock import AsyncMock, patch @@ -961,7 +960,8 @@ async def test_multi_server_timeout_propagation(): ) transport = MCPConfigTransport(config) - timeout = timedelta(seconds=42) + # SDK v2: read_timeout_seconds is a plain number of seconds, not a timedelta. + timeout = 42.0 # Mock _create_proxy to avoid real stdio connections and verify timeout mock_create_proxy = AsyncMock(