MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / mcpserver_server

Function mcpserver_server

tests/client/transports/test_memory.py:41–55  ·  view source on GitHub ↗

Create an MCPServer server for testing.

()

Source from the content-addressed store, hash-verified

39
40@pytest.fixture
41def mcpserver_server() -> MCPServer:
42 """Create an MCPServer server for testing."""
43 server = MCPServer("test")
44
45 @server.tool()
46 def greet(name: str) -> str:
47 """Greet someone by name."""
48 return f"Hello, {name}!"
49
50 @server.resource("test://resource")
51 def test_resource() -> str: # pragma: no cover
52 """A test resource."""
53 return "Test content"
54
55 return server
56
57
58pytestmark = pytest.mark.anyio

Callers

nothing calls this directly

Calls 1

MCPServerClass · 0.90

Tested by

no test coverage detected