mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 14:54:24 +01:00
The helper types in mcp.server.types got really confusioning during implementation as they overlapped with mcp.types. I now believe it is better if we stay more low level to the spec types. To do this, we now only use mcp.types everywhere. We renamed mcp.server.types to mcp.server.models and removed it to the absolute minimum.
30 lines
699 B
Python
30 lines
699 B
Python
import pytest
|
|
from pydantic import AnyUrl
|
|
|
|
from mcp.server import Server
|
|
from mcp.server.models import InitializationOptions
|
|
from mcp.types import Resource, ServerCapabilities
|
|
|
|
TEST_INITIALIZATION_OPTIONS = InitializationOptions(
|
|
server_name="my_mcp_server",
|
|
server_version="0.1.0",
|
|
capabilities=ServerCapabilities(),
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def mcp_server() -> Server:
|
|
server = Server(name="test_server")
|
|
|
|
@server.list_resources()
|
|
async def handle_list_resources():
|
|
return [
|
|
Resource(
|
|
uri=AnyUrl("memory://test"),
|
|
name="Test Resource",
|
|
description="A test resource",
|
|
)
|
|
]
|
|
|
|
return server
|