microsoft / microsoft/foundry-dev-tools
MCP Token Refresh do not work
@MuyangAmigo is already working on this.
Since Jan 6, 2026.
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 260
- Avg merge
- 42m
- Merged PRs (30d)
- 29
Description
Type: Bug
I wrote an simple mcp with oidc Authorisation and add the mcp to the AI Toolkit.
When is start the mcp, I will redirect to my local Keycloak, fill in my Credentials ans everything works as expected.
After a while, the Token expires.
The Extension try again to Autorize via the local Keycloak, but in this case the callback seem to be unavailable.
see the logs:
2026-01-05 16:02:19.941 [info] Calling tool echo with args: {"message":"345"}
2026-01-05 16:02:19.970 [info] Loaded OAuth tokens for http://localhost:8085/mcp
2026-01-05 16:02:19.994 [info] Tool echo response: {"content":[{"type":"text","text":"{"message":"345"}"}],"structuredContent":{"message":"345"}}
2026-01-05 16:03:32.046 [error] Error when calling MCP Server MCP-ECHO: SSE stream disconnected: TypeError: terminated
2026-01-05 16:03:33.063 [info] Access token expired for http://localhost:8085/mcp
2026-01-05 16:03:33.160 [info] Loaded OAuth client information for http://localhost:8085/mcp
2026-01-05 16:03:33.163 [info] Access token expired for http://localhost:8085/mcp
2026-01-05 16:03:33.171 [info] Saved PKCE code verifier for http://localhost:8085/mcp
2026-01-05 16:03:33.171 [info] Opening authorization URL: http://localhost:8181/realms/gomcpstd/protocol/openid-connect/auth?response_type=code&client_id=f7c81bcd-f22c-4967-b71c-ccccc14d02be&code_challenge=TA7U3fEyqowuu5wNF1Ymi60D8OolDuWvldvL4ibDhPI&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A36464%2Foauth%2Fcallback&state=9d4f5c7e-caef-4269-94b0-fbc1535118e2&resource=http%3A%2F%2Flocalhost%3A8085%2Fmcp
2026-01-05 16:03:33.179 [error] Error when calling MCP Server MCP-ECHO: Unauthorized
2026-01-05 16:03:33.180 [error] Error when calling MCP Server MCP-ECHO: Failed to reconnect SSE stream: Unauthorized
2026-01-05 16:03:34.698 [info] Access token expired for http://localhost:8085/mcp
2026-01-05 16:03:34.781 [info] Loaded OAuth client information for http://localhost:8085/mcp
2026-01-05 16:03:34.783 [info] Access token expired for http://localhost:8085/mcp
2026-01-05 16:03:34.802 [info] Saved PKCE code verifier for http://localhost:8085/mcp
2026-01-05 16:03:34.803 [info] Opening authorization URL: http://localhost:8181/realms/gomcpstd/protocol/openid-connect/auth?response_type=code&client_id=f7c81bcd-f22c-4967-b71c-ccccc14d02be&code_challenge=VZYOrHPUazlyxsrQztJ2TI3i8xYDAjZmsAcdkpTWI7E&code_challenge_method=S256&redirect_uri=http%3A%2F%2F127.0.0.1%3A36464%2Foauth%2Fcallback&state=9d4f5c7e-caef-4269-94b0-fbc1535118e2&resource=http%3A%2F%2Flocalhost%3A8085%2Fmcp
2026-01-05 16:03:34.812 [error] Error when calling MCP Server MCP-ECHO: Unauthorized
2026-01-05 16:03:34.813 [error] Error when calling MCP Server MCP-ECHO: Failed to reconnect SSE stream: Unauthorized
2026-01-05 16:03:34.813 [error] Error when calling MCP Server MCP-ECHO: Maximum reconnection attempts (2) exceeded.
Extension version: 0.26.5
VS Code version: Code 1.107.1 (994fd12f8d3a5aa16f17d42c041e5809167e845a, 2025-12-17T14:15:14.850Z)
OS version: Windows_NT x64 10.0.26100
Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) Ultra 7 155U (14 x 2688) |
| GPU Status | 2d_canvas: enabled direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off trees_in_viz: disabled_off video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 31.52GB (8.19GB free) |
| Process Argv | --crash-reporter-id 6488783b-8789-4e30-af60-1c3330aea77b |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31436602
aj953862:31281341
6abeh943:31336334
cloudbuttont:31379625
todos-1:31405332
3efgi100_wstrepl:31403338
use-responses-api:31390855
ddidtcf:31399634
je187915:31401257
d5i5i512:31428709
ec5jj548:31422691
terminalsuggestenabled:31431119
cmp-ext-treat:31426748
cp_cls_c_966_ss:31435507
copilot6169-t750:31440802
c0683394:31419495
3gif2411:31435631
478ah919:31426797
ge8j1254_inline_auto_hint_haiku:31431912
nes-autoexp-10:31439333
a5gib710:31434435
5j92g670_sonnet:31434465
request_with_suggest:31435827
rename_enabled:31436409
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31432745
406hc587_ask_agent:31428393
cp_cls_c_1081:31433293
copilot-nes-oct-trt:31432596
nes-slash-models-on:31441832
nes-set-to-on:31441941
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.