Skip to content

Commit 485fa37

Browse files
committed
Addressed comments
1 parent eb0079b commit 485fa37

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/mxcp/sdk/auth/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,17 @@ async def cleanup_expired_mappings(self) -> int:
202202
if self._refresh_token_mapping.pop(code, None):
203203
cleaned_count += 1
204204

205-
# Also check for orphaned mappings (mappings without corresponding auth codes)
205+
# Also check for orphaned mappings
206+
# Token mappings: valid keys are either active auth codes (temporary) or active MCP tokens
206207
orphaned_token_keys = []
207208
for mapping_key in self._token_mapping:
208-
if mapping_key.startswith("mcp_") and mapping_key not in self._auth_codes:
209+
if mapping_key not in self._auth_codes and mapping_key not in self._tokens:
209210
orphaned_token_keys.append(mapping_key)
210211

212+
# Refresh token mappings are only keyed by authorization codes; anything not in _auth_codes is orphaned
211213
orphaned_refresh_keys = []
212214
for mapping_key in self._refresh_token_mapping:
213-
if mapping_key.startswith("mcp_") and mapping_key not in self._auth_codes:
215+
if mapping_key not in self._auth_codes:
214216
orphaned_refresh_keys.append(mapping_key)
215217

216218
# Clean up orphaned mappings

0 commit comments

Comments
 (0)