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

Function app

tests/client/test_client.py:87–106  ·  view source on GitHub ↗

Create an MCPServer server for testing.

()

Source from the content-addressed store, hash-verified

85
86@pytest.fixture
87def app() -> MCPServer:
88 """Create an MCPServer server for testing."""
89 server = MCPServer("test")
90
91 @server.tool()
92 def greet(name: str) -> str:
93 """Greet someone by name."""
94 return f"Hello, {name}!"
95
96 @server.resource("test://resource")
97 def test_resource() -> str:
98 """A test resource."""
99 return "Test content"
100
101 @server.prompt()
102 def greeting_prompt(name: str) -> str:
103 """A greeting prompt."""
104 return f"Please greet {name} warmly."
105
106 return server
107
108
109async def test_client_is_initialized(app: MCPServer):

Callers 2

__init__.pyFile · 0.50
wrappedFunction · 0.50

Calls 1

MCPServerClass · 0.90

Tested by

no test coverage detected