Skip to content

Commit d774be7

Browse files
dsp-antpraboud-ant
authored andcommitted
fix
1 parent 88edddc commit d774be7

File tree

7 files changed

+41
-28
lines changed

7 files changed

+41
-28
lines changed

examples/clients/simple-chatbot/mcp_simple_chatbot/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,7 @@ async def process_llm_response(self, llm_response: str) -> str:
322322
total = result["total"]
323323
percentage = (progress / total) * 100
324324
logging.info(
325-
f"Progress: {progress}/{total} "
326-
f"({percentage:.1f}%)"
325+
f"Progress: {progress}/{total} ({percentage:.1f}%)"
327326
)
328327

329328
return f"Tool execution result: {result}"

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ mcp = "mcp.cli:app [cli]"
4343
[tool.uv]
4444
resolution = "lowest-direct"
4545
dev-dependencies = [
46-
"pyright>=1.1.391",
46+
"pyright>=1.1.396",
4747
"pytest>=8.3.4",
4848
"ruff>=0.8.5",
4949
"trio>=0.26.2",
@@ -70,9 +70,6 @@ strict = [
7070
"src/mcp/server/fastmcp/tools/base.py",
7171
]
7272

73-
[tool.pytest.ini_options]
74-
markers = ["anyio"]
75-
7673
[tool.ruff.lint]
7774
select = ["E", "F", "I"]
7875
ignore = []
@@ -95,8 +92,12 @@ mcp = { workspace = true }
9592
xfail_strict = true
9693
filterwarnings = [
9794
"error",
95+
# this is a long-standing issue with fastmcp, which is just now being exercised by tests
96+
"ignore:Unclosed:ResourceWarning",
9897
# This should be fixed on Uvicorn's side.
9998
"ignore::DeprecationWarning:websockets",
10099
"ignore:websockets.server.WebSocketServerProtocol is deprecated:DeprecationWarning",
101-
"ignore:Returning str or bytes.*:DeprecationWarning:mcp.server.lowlevel"
100+
"ignore:Returning str or bytes.*:DeprecationWarning:mcp.server.lowlevel",
101+
# this is a problem in starlette
102+
"ignore:Please use `import python_multipart` instead.:PendingDeprecationWarning",
102103
]

src/mcp/client/auth/oauth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,15 @@ async def open_user_agent(self, url: AnyHttpUrl) -> None:
385385
...
386386

387387
async def client_registration(
388-
self, endpoint: AnyHttpUrl
388+
self, issuer: AnyHttpUrl
389389
) -> DynamicClientRegistration | None:
390390
"""
391391
Loads the client registration for the given endpoint.
392392
"""
393393
...
394394

395395
async def store_client_registration(
396-
self, endpoint: AnyHttpUrl, metadata: DynamicClientRegistration
396+
self, issuer: AnyHttpUrl, metadata: DynamicClientRegistration
397397
) -> None:
398398
"""
399399
Stores the client registration to be retreived for the next session

src/mcp/server/lowlevel/server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,12 @@ async def _handle_notification(self, notify: Any):
578578
assert type(notify) in self.notification_handlers
579579

580580
handler = self.notification_handlers[type(notify)]
581-
logger.debug(
582-
f"Dispatching notification of type " f"{type(notify).__name__}"
583-
)
581+
logger.debug(f"Dispatching notification of type {type(notify).__name__}")
584582

585583
try:
586584
await handler(notify)
587585
except Exception as err:
588-
logger.error(f"Uncaught exception in notification handler: " f"{err}")
586+
logger.error(f"Uncaught exception in notification handler: {err}")
589587

590588

591589
async def _ping_handler(request: types.PingRequest) -> types.ServerResult:

src/mcp/server/sse.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def __init__(self, endpoint: str) -> None:
7979
self._read_stream_writers = {}
8080
logger.debug(f"SseServerTransport initialized with endpoint: {endpoint}")
8181

82-
@deprecated("use connect_sse_v2 instead")
8382
@asynccontextmanager
8483
async def connect_sse(self, scope: Scope, receive: Receive, send: Send):
8584
if scope["type"] != "http":
@@ -130,11 +129,6 @@ async def sse_writer():
130129
tg.start_soon(response, scope, receive, send)
131130

132131
logger.debug("Yielding read and write streams")
133-
# TODO: hold on; shouldn't we be returning the EventSourceResponse?
134-
# I think this is why the tests hang
135-
# TODO: we probably shouldn't return response here, since it's a breaking
136-
# change
137-
# this is just to test
138132
yield (read_stream, write_stream, response)
139133

140134
async def handle_post_message(

tests/client/test_oauth.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pydantic import AnyHttpUrl
77

88
from mcp.client.auth.oauth import (
9+
AccessToken,
910
ClientMetadata,
1011
DynamicClientRegistration,
1112
OAuthClient,
@@ -24,7 +25,30 @@ def client_metadata(self) -> ClientMetadata:
2425
response_types=["code"],
2526
)
2627

27-
def save_client_information(self, metadata: DynamicClientRegistration) -> None:
28+
@property
29+
def redirect_url(self) -> AnyHttpUrl:
30+
return AnyHttpUrl("https://client.example.com/callback")
31+
32+
async def open_user_agent(self, url: AnyHttpUrl) -> None:
33+
pass
34+
35+
async def client_registration(
36+
self, issuer: AnyHttpUrl
37+
) -> DynamicClientRegistration | None:
38+
return None
39+
40+
async def store_client_registration(
41+
self, issuer: AnyHttpUrl, metadata: DynamicClientRegistration
42+
) -> None:
43+
pass
44+
45+
def code_verifier(self) -> str:
46+
return "test-code-verifier"
47+
48+
async def token(self) -> AccessToken | None:
49+
return None
50+
51+
async def store_token(self, token: AccessToken) -> None:
2852
pass
2953

3054

@@ -229,8 +253,5 @@ def test_build_discovery_url_with_various_formats(input_url, expected_discovery_
229253
# Create auth client with the given URL
230254
auth_client = OAuthClient(AnyHttpUrl(input_url), MockOauthClientProvider())
231255

232-
# Call the method under test
233-
discovery_url = auth_client._build_discovery_url()
234-
235256
# Assertions
236-
assert discovery_url == AnyHttpUrl(expected_discovery_url)
257+
assert auth_client.discovery_url == AnyHttpUrl(expected_discovery_url)

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)