npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-hook-mcp-demo

v1.0.0

Published

Demo de la biblioteca react-hook-mcp para conectar React con Model Context Protocol

Readme

React Router v7 + LLMRestClient Demo

Este proyecto demuestra cómo usar LLMRestClient dentro de funciones action de React Router v7 para interactuar con Ollama.

🚀 Características

  • React Router v7 con funciones action
  • LLMRestClient para comunicación con Ollama
  • Formularios con manejo de estado de carga
  • Navegación entre páginas
  • Manejo de errores y respuestas
  • Conexión/desconexión al servidor LLM

📋 Requisitos

  • Node.js 18+
  • Ollama instalado y ejecutándose en http://localhost:11434
  • Al menos un modelo descargado (ej: llama3.2:3b)

🛠️ Instalación

npm install

🚀 Ejecución

1. Iniciar Ollama (si no está ejecutándose)

ollama serve

2. Ejecutar la aplicación React Router

npm run dev:react

La aplicación se abrirá automáticamente en http://localhost:3000

📖 Uso

Páginas disponibles:

  1. 🏠 Inicio - Información general del proyecto
  2. 🤖 Consulta LLM - Formulario para enviar consultas al modelo
  3. 🔗 Conexiones - Gestión de conexiones al servidor LLM

Ejemplo de uso:

  1. Ve a la página "🔗 Conexiones" y haz clic en "🔗 Conectar"
  2. Ve a "🤖 Consulta LLM" y selecciona un modelo
  3. Escribe tu consulta y haz clic en "🚀 Enviar Consulta"
  4. Ve la respuesta del modelo en tiempo real

🔧 Código de ejemplo

Función Action de React Router v7:

export async function llmAction({ request }: { request: Request }) {
  const formData = await request.formData();
  const query = formData.get("query") as string;
  const model = (formData.get("model") as string) || "llama3.2:3b";

  // Crear instancia del cliente LLM
  const client = new LLMRestClient({
    apiUrl: "http://localhost:11434/api/chat",
    model: model,
  });

  // Conectar al servidor
  await client.connect();

  // Procesar la consulta
  const respuesta = await client.processUserQuery(query);

  // Desconectar cuando termines
  await client.disconnect();

  return {
    success: true,
    query,
    response: respuesta,
    model,
  };
}

Componente con Formulario:

function LLMQueryForm() {
  const actionData = useActionData() as any;
  const navigation = useNavigation();
  const isSubmitting = navigation.state === "submitting";

  return (
    <Form method="post" action="/llm-query">
      <textarea name="query" required />
      <select name="model">
        <option value="llama3.2:3b">llama3.2:3b</option>
      </select>
      <button type="submit" disabled={isSubmitting}>
        {isSubmitting ? "🔄 Procesando..." : "🚀 Enviar"}
      </button>
    </Form>
  );
}

📁 Estructura del proyecto

src/
├── llm_rest_client.ts      # Cliente LLM para Ollama
├── react-router-example.tsx # Aplicación React Router v7
├── main.tsx                # Punto de entrada
└── index.ts                # Servidor Hono (alternativo)

🔗 Enlaces útiles

🤝 Contribuir

  1. Fork el proyecto
  2. Crea una rama para tu feature (git checkout -b feature/AmazingFeature)
  3. Commit tus cambios (git commit -m 'Add some AmazingFeature')
  4. Push a la rama (git push origin feature/AmazingFeature)
  5. Abre un Pull Request

📄 Licencia

Este proyecto está bajo la Licencia MIT - ver el archivo LICENSE para detalles.