Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: mcp sort list

Faisal Amird922d7454de6
diff --git a/web-app/src/hooks/useMCPServers.ts b/web-app/src/hooks/useMCPServers.ts
index cd263a60d..feae29a62 100644
--- a/web-app/src/hooks/useMCPServers.ts
+++ b/web-app/src/hooks/useMCPServers.ts
@@ -52,7 +52,10 @@ export const useMCPServers = create<MCPServerStoreState>()((set, get) => ({
// Add a new MCP server or update if the key already exists
addServer: (key, config) =>
set((state) => {
- const mcpServers = { [key]: config, ...state.mcpServers }
+ // Remove the key first if it exists to maintain insertion order
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const { [key]: _, ...restServers } = state.mcpServers
+ const mcpServers = { [key]: config, ...restServers }
return { mcpServers }
}),