AppInitDev
CÓDIGO FUENTE PÚBLICO

web/mcp/diagnostico/diagnostico.js

Archivo real del paquete para implementar la función. Descárgalo del ZIP para editarlo; no contiene claves privadas.

/* Diagnóstico cliente: todo por HTTPS y GET, sin datos privados ni escribir en servidor. */
(()=>{'use strict';const targets=[
 ['Inicio IA','/ia/','html'],['Catálogo IA','/ia/catalogo/','html'],['Búsqueda IA','/ia/busqueda/','html'],
 ['Identidad','/ia/identidad/','html'],['Servidor MCP','/mcp/','html'],['Tutoriales','/mcp/tutoriales/','html'],
 ['Registro oficial: guía','/mcp/registro/','html'],['Código fuente','/mcp/codigo/','html'],
 ['Apps públicas','/datos/apps.json','json'],['Conocimiento','/datos/conocimiento.json','json'],
 ['Identidad JSON','/datos/identidad.json','json'],['Índice textual','/datos/busqueda/manifest.json','json'],
 ['Cloudflare health','https://appinitdev-mcp.dev-appinitdev.workers.dev/health','json'],
 ['MCP Registry','https://registry.modelcontextprotocol.io/v0.1/servers/com.appinitdev%2Fknowledge/versions/latest','json']
 ];const button=document.getElementById('run-diagnostics'),msg=document.getElementById('diag-message'),list=document.getElementById('diag-results');
 async function run(){button.disabled=true;list.replaceChildren();let ok=0;
  for(const [label,path,type] of targets){const row=document.createElement('article');row.className='code-file';const h=document.createElement('strong');h.textContent=label;row.append(h);
   const line=document.createElement('small');row.append(line);list.append(row);
   try{const ac=new AbortController(),clock=setTimeout(()=>ac.abort(),8000);let res;
   try{res=await fetch(path,{method:'GET',mode:'cors',cache:'no-store',headers:{Accept:type==='json'?'application/json':'text/html'},signal:ac.signal})}finally{clearTimeout(clock)}
   if(!res.ok){line.textContent='HTTP '+res.status+' — '+(res.status===404?'aún no publicado o ruta distinta':'revisar la respuesta');continue;}
   if(type==='json'){const data=await res.json();if(typeof data!=='object')throw Error('JSON no reconocido');}
   ok++;line.textContent='OK · HTTP '+res.status;
   }catch(e){line.textContent='No confirmado · '+(e.name==='AbortError'?'Tiempo agotado':'Red/CORS/archivo no accesible')+' (verificar con Python)';}
  }
  msg.textContent=`Comprobaciones con respuesta legible: ${ok}/${targets.length}. Esta prueba NO ejecuta herramientas MCP ni certifica el registro.`;button.disabled=false;
 }
 button?.addEventListener('click',run);
})();