feat(mcp): enhance MCP installation with status tracking and custom configs

- Add /mcp-servers/ to .gitignore for MCP server installations
- Extend mcp_installations table with status, logs, and validation fields
- Refactor MCP install route to support custom configs, enable logs, and async installation
- Improve MCPSyncService with promise-based syncing to prevent concurrent operations

This update improves MCP management by adding robust installation tracking, custom configuration support, and better error handling for a more reliable user experience.
This commit is contained in:
Evandro Fonseca Junior committed 2025-10-28 21:59:00 -03:00
1 parent 1042f2136b
commit f19bf10ef3
35 files changed
+4743 -429

No files matched your search

+30 -18
View File
@@ -58,24 +58,36 @@ export async function GET(request: Request) {
console.log(`Found ${cachedMcps.length} MCPs in cache`);
// Os dados já estão no formato interno após transformação no saveBatch
const mcps = cachedMcps.map((item) => ({
id: item.id,
name: item.content_name,
author: item.publisher_id,
description: item.description || "",
version: "1.0.0",
category: item.category as MCPProvider["category"],
tags: item.content_tag_list ? item.content_tag_list.split(",") : [],
rating: item.rating,
totalRatings: item.review_cnt,
repository: item.detail_url || "",
homepage: item.website || "",
installed: false, // Será definido abaixo
subfield: item.subfield || "",
field: item.field || "",
config: [],
tools: [],
}));
const mcps = cachedMcps.map((item) => {
// Construir ID no formato owner/repo a partir dos campos do cache
// Se owner estiver vazio, usar apenas o repo
const correctId =
item.owner && item.owner.trim() !== ""
? `${item.owner}/${item.repo}`
: item.repo;
return {
id: correctId, // Usar owner/repo como ID principal ou apenas repo se owner vazio
originalId: item.id, // Manter ID original para referência
owner: item.owner || "",
repo: item.repo,
name: item.content_name,
author: item.publisher_id,
description: item.description || "",
version: "1.0.0",
category: item.category as MCPProvider["category"],
tags: item.content_tag_list ? item.content_tag_list.split(",") : [],
rating: item.rating,
totalRatings: item.review_cnt,
repository: item.detail_url || "",
homepage: item.website || "",
installed: false, // Será definido abaixo
subfield: item.subfield || "",
field: item.field || "",
config: [],
tools: [],
};
});
// Adicionar status de instalação
const installedMCPs = MCPRepository.listInstalled();