Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

This is an attempt to reproduce MCP's Framework does not handle refreshed tokens correctly issue.

uv run server.py

Connect a client, e.g. Claude Code.

claude mcp add dice --transport http http://127.0.0.1:6464/mcp

Type /mcp and authenticate with the dice server. After authentication, the log immediately shows numerous calls to exchange_refresh_token.

2025-10-06 09:28:22,210 - __main__ - INFO - Refreshed access token: fake_token_67352b806... (length: 43, expires in 30s)
2025-10-06 09:28:22,310 - __main__ - INFO - Refreshed access token: fake_token_513e5f8e1... (length: 43, expires in 30s)
2025-10-06 09:28:22,425 - __main__ - INFO - Refreshed access token: fake_token_0e0884fca... (length: 43, expires in 30s)
2025-10-06 09:28:22,561 - __main__ - INFO - Refreshed access token: fake_token_0d3d9f5dc... (length: 43, expires in 30s)
2025-10-06 09:28:22,630 - __main__ - INFO - Refreshed access token: fake_token_f1c257baf... (length: 43, expires in 30s)
2025-10-06 09:28:22,715 - __main__ - INFO - Refreshed access token: fake_token_66c6bacbb... (length: 43, expires in 30s)
2025-10-06 09:28:22,716 - __main__ - INFO - Refreshed access token: fake_token_67a7d8fe4... (length: 43, expires in 30s)
2025-10-06 09:28:22,918 - __main__ - INFO - Refreshed access token: fake_token_b894617ab... (length: 43, expires in 30s)
2025-10-06 09:28:30,191 - __main__ - INFO - Refreshed access token: fake_token_7a108f0ab... (length: 43, expires in 30s)

Ask Claude Code to "roll the dice". Despite ongoing calls to exchange_refresh_token, the tool receives an outdated access token from the context.

2025-10-06 09:28:30,265 - mcp.server.lowlevel.server - INFO - Processing request of type CallToolRequest
2025-10-06 09:28:30,265 - __main__ - INFO - Tool called with token: fake_token_513e5f8e1... (expires in 22s)
2025-10-06 09:28:30,265 - __main__ - INFO - Rolled 6-sided dice: 4
INFO:     127.0.0.1:62590 - "GET /.well-known/oauth-authorization-server/mcp HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:62591 - "GET /.well-known/oauth-authorization-server HTTP/1.1" 200 OK
2025-10-06 09:29:32,945 - __main__ - INFO - Loading refresh token: refresh_63764ff2b0e4... (expires in 3530s)
2025-10-06 09:29:32,945 - __main__ - INFO - Refreshed access token: fake_token_5ce976e46... (length: 43, expires in 30s)
INFO:     127.0.0.1:62593 - "POST /token HTTP/1.1" 200 OK
INFO:     127.0.0.1:62590 - "POST /mcp HTTP/1.1" 200 OK
2025-10-06 09:29:33,018 - mcp.server.lowlevel.server - INFO - Processing request of type CallToolRequest
2025-10-06 09:29:33,018 - __main__ - INFO - Tool called with token: fake_token_513e5f8e1... (expires in -41s)
2025-10-06 09:29:33,018 - __main__ - INFO - Rolled 6-sided dice: 1

About

An attempt to reproduce MCP's issue 1250

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages