Adding the awesome copilot MCP server to our plugin and showing that in the rendered page

This commit is contained in:
Aaron Powell
2026-07-14 14:54:47 +10:00
parent b2ce1b2a65
commit 6574b3c89a
4 changed files with 45 additions and 4 deletions
+27 -2
View File
@@ -500,7 +500,7 @@ function resolvePluginItem(item, resourceIndex) {
return {
...item,
title: match?.title || candidateId || item.path,
title: match?.title || item.title || candidateId || item.path,
detailUrl: match?.url || null,
};
}
@@ -614,12 +614,37 @@ function generatePluginsData(gitDates, resourceIndex = {}) {
];
});
// Build items list from spec fields (agents, commands, skills)
// Parse mcpServers: supports a path to a .mcp.json file or an inline object
const mcpItems = [];
if (data.mcpServers) {
let mcpServersObj = null;
if (typeof data.mcpServers === "string") {
const mcpJsonPath = path.join(pluginDir, data.mcpServers.replace(/^\.\//, ""));
if (fs.existsSync(mcpJsonPath)) {
try {
const mcpJson = JSON.parse(fs.readFileSync(mcpJsonPath, "utf-8"));
mcpServersObj = mcpJson.mcpServers || mcpJson;
} catch {
// ignore parse errors
}
}
} else if (typeof data.mcpServers === "object") {
mcpServersObj = data.mcpServers;
}
if (mcpServersObj) {
for (const serverName of Object.keys(mcpServersObj)) {
mcpItems.push({ kind: "mcp", path: serverName, title: serverName });
}
}
}
// Build items list from spec fields (agents, commands, skills, mcpServers)
const items = [
...agentItems,
...(data.commands || []).map((p) => ({ kind: "prompt", path: p })),
...(data.skills || []).map((p) => ({ kind: "skill", path: p })),
...extensionItems,
...mcpItems,
].map((item) => resolvePluginItem(item, resourceIndex));
const tags = data.keywords || data.tags || [];