Move MCP marketplace catalog from global state to disk cache (#5835)

* Move MCP marketplace catalog from global state to disk cache

* add cleanup function to remove catalog from vs code storage

* type fixes

* move disk related functions to disk file

* add try/catch around file/json operations

* fix weird tab formatting
This commit is contained in:
celestial-vault authored and GitHub committed 2025-10-08 11:11:33 -07:00
1 parent 4469a4fea4
commit 8be46f9cfe
7 files changed
+57 -13

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
import { McpMarketplaceCatalog } from "@shared/mcp"
import { Empty, EmptyRequest } from "@shared/proto/cline/common"
import { OpenRouterCompatibleModelInfo } from "@shared/proto/cline/models"
import { readMcpMarketplaceCatalogFromCache } from "@/core/storage/disk"
import { telemetryService } from "@/services/telemetry"
import type { Controller } from "../index"
import { sendMcpMarketplaceCatalogEvent } from "../mcp/subscribeToMcpMarketplaceCatalog"
@@ -213,10 +213,10 @@ export async function initializeWebview(controller: Controller, _request: EmptyR
// Prefetch marketplace and OpenRouter models
// Send stored MCP marketplace catalog if available
const mcpMarketplaceCatalog = controller.stateManager.getGlobalStateKey("mcpMarketplaceCatalog")
const mcpMarketplaceCatalog = await readMcpMarketplaceCatalogFromCache()
if (mcpMarketplaceCatalog) {
sendMcpMarketplaceCatalogEvent(mcpMarketplaceCatalog as McpMarketplaceCatalog)
sendMcpMarketplaceCatalogEvent(mcpMarketplaceCatalog)
}
// Silently refresh MCP marketplace catalog