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

opencode-lazy-load

v1.0.0

Published

OpenCode plugin that reduces MCP tool token overhead by 88-90% through HTTP body interception and on-demand tool loading

Readme

opencode-lazy-load

Plugin de OpenCode que reduce el overhead de tokens de herramientas MCP en 88-90% mediante interceptación de cuerpo HTTP y carga bajo demanda.

Problema

9 servidores MCP × ~250 definiciones de herramientas = ~40-70k tokens consumidos por conversación antes del primer mensaje del usuario. Esto desperdicia la ventana de contexto y aumenta los costos de API.

Solución

Este plugin intercepta globalThis.fetch para eliminar TODAS las definiciones de herramientas de las solicitudes HTTP al LLM. El LLM solo ve load_tool como herramienta llamable más 7 herramientas ALWAYS_VISIBLE. Cuando el LLM necesita una herramienta, llama a load_tool({name: "toolname"}) para obtener instrucciones completas, luego llama a la herramienta real directamente.

Resultados

| Métrica | Antes | Después | |---------|-------|---------| | Herramientas visibles para LLM | ~113 (13 integradas + ~100 MCP) | 20 (load_tool + 7 ALWAYS_VISIBLE + 12 integradas) | | Overhead de tokens | ~40-70k | ~6-8k | | Ahorro | - | ~88-90% | | Servidores MCP conectados | 9 | 9 (siguen activos) |

Arquitectura: Defensa de 3 Capas

Capa 1: Interceptación de Cuerpo HTTP (mecánico)
- Elimina todas las herramientas excepto load_tool + 7 ALWAYS_VISIBLE
- Confiabilidad: 100%

Capa 2: Transformación SSE (mecánico)
- Redirige llamadas MCP directas → load_tool
- Confiabilidad: 100%

Capa 3: Lista de Punteros (semi-mecánico)
- La descripción de load_tool lista todas las herramientas disponibles
- Confiabilidad: ~90% (depende del LLM)

Herramientas ALWAYS_VISIBLE

7 herramientas core que NUNCA se eliminan del cuerpo HTTP:

bash, read, edit, write, task, glob, grep

Estas funcionan directamente sin load_tool. Todas las demás requieren load_tool.

Instalación

  1. Copiar index.ts a .opencode/plugins/lazy-load/
  2. Agregar a la configuración global ~/.config/opencode/opencode.jsonc:
{
  "plugin": ["C:\\path\\to\\opencode-lazy-load"]
}
  1. Reiniciar OpenCode Desktop

Uso

// Cargar instrucciones de una herramienta
load_tool({name: "supabase_list_tables"})

// Listar todas las herramientas disponibles
load_tool({name: "__list__"})

Herramientas Disponibles

Después de cargar, estas herramientas son accesibles via load_tool:

Integradas (siempre visibles, no necesitan carga): bash, read, edit, write, task, glob, grep

Herramientas MCP (cargar con load_tool): supabase_, memory_, context7_, playwright_, chrome-devtools_, sequential-thinking_

Comparación

| Característica | opencode-lazy-load | omarwaly-ai/opencode-lazy-loading | keybrdist/opencode-lazy-loader | |----------------|-------------------|-----------------------------------|-------------------------------| | ALWAYS_VISIBLE | ✅ 7 herramientas | ❌ | N/A | | Comando list | ✅ | ❌ | N/A | | Defensa de 3 capas | ✅ | ❌ (2 capas) | ❌ | | Proxy MCP | ✅ Completo | ⚠️ Parcial | ✅ Propósito diferente | | Ahorro de tokens | 88-90% | 95-98% | N/A | | Dependencias | 1 | 0 | 3 |

Cómo Funciona

  1. Interceptación de Solicitudes: Elimina todas las definiciones de herramientas del cuerpo HTTP excepto load_tool y herramientas ALWAYS_VISIBLE
  2. Lista de Punteros: Agrega nombres de herramientas disponibles a la descripción de load_tool
  3. Transformación SSE: Intercepta respuestas del LLM y redirige llamadas directas a herramientas hacia load_tool cuando aún no se han cargado
  4. Seguimiento de Turnos: Rastrea qué herramientas se han cargado por turno, se limpia al completar la conversación

Limitaciones Conocidas

  • Coerción de tipos de argumentos: Arrays/booleans pueden llegar como strings a servidores MCP (bug de OpenCode #34652)
  • Comportamiento del LLM: ~10% de llamadas omiten load_tool primero (la transformación SSE las atrapa)
  • Herramientas MCP evitan el hook tool.definition: Bug de OpenCode #31670 (PR #31671 pendiente)

Licencia

MIT

Construido con

Desarrollo asistido por IA (OpenCode + Mimo v2.5).