Implement auth token persistence and MCP connection improvements

- Add OpenRouter API key persistence to localStorage with auto-restore
- Add automatic provider restoration on app startup for seamless login
- Fix MCP OAuth token persistence by preserving connection IDs across refreshes
- Add manual reconnect button for failed/disconnected MCP servers
- Add auto-reconnect for MCP servers on app startup
- Maintain backward compatibility with old connection storage format

Resolves auth token loss on page refresh for both inference and MCP providers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jerome 2025-06-12 13:38:20 +01:00
commit 2038ea5957
No known key found for this signature in database

View file

@ -4,7 +4,7 @@ import React from 'react';
import { useMCP } from '@/contexts/MCPContext';
export function MCPStatus() {
const { connections, getAllTools } = useMCP();
const { connections, getAllTools, reconnectServer } = useMCP();
const connectedServers = connections.filter(conn => conn.status === 'connected');
const allTools = getAllTools();
@ -89,6 +89,16 @@ export function MCPStatus() {
</p>
)}
</div>
{(connection.status === 'failed' || connection.status === 'disconnected') && (
<button
onClick={() => reconnectServer(connection.id)}
className="ml-2 px-2 py-1 text-xs bg-blue-100 dark:bg-blue-900/50 text-blue-800 dark:text-blue-200 rounded hover:bg-blue-200 dark:hover:bg-blue-800"
title="Reconnect server"
>
Reconnect
</button>
)}
</div>
{connection.tools.length > 0 && (