mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
Fix MCP Manager panel - 13 critical issues resolved
Issues fixed: 1. API endpoint mismatch (/api/mcp-add-global-server) 2. Undefined function reference (installMcpToProject → copyMcpServerToProject) 3. Inline onclick handler scope issues (converted to data-action) 4. querySelector only finding first element (use querySelectorAll) 5. Path normalization causing wrong MCP badge count 6. Lucide icons destroying event listeners (reordered execution) 7. Codex button JSON serialization syntax error 8. Codex API routes 404 (add /api/codex-mcp route matching) 9. False warning suppression for conditional buttons 10. HTML syntax error from JSON in onclick attributes 11. CSS z-index issue - ::before pseudo-element blocking clicks 12. Navigation badge path matching (try both slash formats) 13. Remove deprecated codex_lens tool (merged into smart_search) Key changes: - server.ts: Add /api/codex-mcp route matching - 15-mcp-manager.css: Add pointer-events:none to ::before, z-index for buttons - components/mcp-manager.js: Fix updateMcpBadge path matching, global exports - views/mcp-manager.js: Convert onclick to data-action, add event listeners, update CCW_MCP_TOOLS list, fix JSON escaping in HTML attributes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -395,14 +395,19 @@ async function removeGlobalMcpServer(serverName) {
|
||||
function updateMcpBadge() {
|
||||
const badge = document.getElementById('badgeMcpServers');
|
||||
if (badge) {
|
||||
const currentPath = projectPath; // Keep original format (forward slash)
|
||||
const projectData = mcpAllProjects[currentPath];
|
||||
// Try both path formats to find the matching key
|
||||
const forwardSlashPath = projectPath.replace(/\\/g, '/');
|
||||
const backSlashPath = projectPath.replace(/\//g, '\\');
|
||||
|
||||
// Find matching project data using either path format
|
||||
const projectData = mcpAllProjects[forwardSlashPath] || mcpAllProjects[backSlashPath] || mcpAllProjects[projectPath];
|
||||
const servers = projectData?.mcpServers || {};
|
||||
const disabledServers = projectData?.disabledMcpServers || [];
|
||||
|
||||
const totalServers = Object.keys(servers).length;
|
||||
const enabledServers = totalServers - disabledServers.length;
|
||||
|
||||
console.log('[MCP Badge]', { projectPath, forwardSlashPath, backSlashPath, totalServers, enabledServers });
|
||||
badge.textContent = `${enabledServers}/${totalServers}`;
|
||||
}
|
||||
}
|
||||
@@ -957,7 +962,7 @@ async function installCcwToolsMcp(scope = 'workspace') {
|
||||
|
||||
if (scope === 'global') {
|
||||
// Install to global (~/.claude.json mcpServers)
|
||||
const response = await fetch('/api/mcp-add-global', {
|
||||
const response = await fetch('/api/mcp-add-global-server', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
@@ -1021,7 +1026,7 @@ async function updateCcwToolsMcp(scope = 'workspace') {
|
||||
|
||||
if (scope === 'global') {
|
||||
// Update global (~/.claude.json mcpServers)
|
||||
const response = await fetch('/api/mcp-add-global', {
|
||||
const response = await fetch('/api/mcp-add-global-server', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
@@ -1124,3 +1129,11 @@ async function installCcwToolsMcpToCodex() {
|
||||
showRefreshToast(`Failed to install CCW Tools MCP to Codex: ${err.message}`, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Global Exports for onclick handlers ==========
|
||||
// Expose functions to global scope to support inline onclick handlers
|
||||
window.setCliMode = setCliMode;
|
||||
window.getCliMode = getCliMode;
|
||||
window.selectCcwTools = selectCcwTools;
|
||||
window.selectCcwToolsCodex = selectCcwToolsCodex;
|
||||
window.openMcpCreateModal = openMcpCreateModal;
|
||||
|
||||
Reference in New Issue
Block a user