Add story-style examples suite (27 stories + harness + CI) (#2957)

This commit is contained in:
Max 2026-06-26 12:02:27 +02:00 • committed by GitHub
commit 4caa41f6d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6801 additions and 26 deletions

View file

@ -113,7 +113,7 @@ async def elicit_with_validation(
return AcceptedElicitation(data=validated_data)
elif result.action == "decline":
return DeclinedElicitation()
elif result.action == "cancel": # pragma: no cover
elif result.action == "cancel":
return CancelledElicitation()
else: # pragma: no cover
# This should never happen, but handle it just in case

View file

@ -561,7 +561,7 @@ class Server(Generic[LifespanResultT]):
)
)
if custom_starlette_routes: # pragma: no cover
if custom_starlette_routes:
routes.extend(custom_starlette_routes)
return Starlette(

View file

@ -200,7 +200,7 @@ class MCPServer(Generic[LifespanResultT]):
self._token_verifier = token_verifier
# Create token verifier from provider if needed (backwards compatibility)
if auth_server_provider and not token_verifier: # pragma: no cover
if auth_server_provider and not token_verifier:
self._token_verifier = ProviderTokenVerifier(auth_server_provider)
self._custom_starlette_routes: list[Route] = []
@ -822,7 +822,7 @@ class MCPServer(Generic[LifespanResultT]):
```
"""
def decorator( # pragma: no cover
def decorator(
func: Callable[[Request], Awaitable[Response]],
) -> Callable[[Request], Awaitable[Response]]:
self._custom_starlette_routes.append(
@ -830,7 +830,7 @@ class MCPServer(Generic[LifespanResultT]):
)
return func
return decorator # pragma: no cover
return decorator
async def run_stdio_async(self) -> None:
"""Run the server using stdio transport."""

View file

@ -38,7 +38,7 @@ class MCPError(Exception):
@property
def data(self) -> Any:
return self.error.data # pragma: no cover
return self.error.data
@classmethod
def from_jsonrpc_error(cls, error: JSONRPCError) -> MCPError: