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

@whaapy/data-gateway-mcp

v0.1.0

Published

Streamable HTTP MCP server for Data Gateway tools (Whaapy-compatible)

Readme

@whaapy/data-gateway-mcp

Servidor MCP de referencia para el Data Gateway. Consume el manifest REST (GET /tools) y ejecuta tools vía POST /tools/:name/invoke.

Requisitos

  • API key de workspace con scopes tools:read y tools:invoke (o *)
  • Fuentes en estado agent_ready

Variables de entorno

| Variable | Descripción | | --- | --- | | GATEWAY_URL | URL base de la API (ej. http://localhost:3000) | | GATEWAY_API_KEY | API key del workspace (requerida en stdio; opcional en HTTP multi-tenant) | | MCP_PORT / PORT | Puerto HTTP (default 3100; Railway inyecta PORT) |

stdio (Claude Desktop / Cursor)

pnpm --filter @data-gateway/mcp-server build
GATEWAY_URL=http://localhost:3000 GATEWAY_API_KEY=dgw_... pnpm --filter @data-gateway/mcp-server start:stdio

Ejemplo de configuración MCP:

{
  "mcpServers": {
    "data-gateway": {
      "command": "node",
      "args": ["/ruta/al/repo/packages/mcp-server/dist/stdio.js"],
      "env": {
        "GATEWAY_URL": "http://localhost:3000",
        "GATEWAY_API_KEY": "dgw_..."
      }
    }
  }
}

Streamable HTTP

GATEWAY_URL=http://localhost:3000 GATEWAY_API_KEY=dgw_... pnpm --filter @whaapy/data-gateway-mcp start:http

Endpoint MCP: http://0.0.0.0:3100/mcp.

Si GATEWAY_API_KEY no está configurada, el servidor corre en modo multi-tenant: cada request MCP debe traer Authorization: Bearer <workspace_api_key> o X-API-Key: <workspace_api_key>.

Conectar a Whaapy

Opción A: MCP hosteado por Data Gateway

Configura en Whaapy:

  • URL: https://mcp.data.whaapy.com/mcp
  • Transporte: Streamable HTTP
  • Auth: bearer
  • Token: API key del workspace (dgw_...) con scopes tools:read y tools:invoke

Whaapy hará initialize, tools/list y tools/call. Las respuestas usan un envelope JSON dentro de content[0].text:

{
  "ok": true,
  "status": "success",
  "data": {},
  "toolName": "search_product",
  "safety": "read_only",
  "durationMs": 419
}

Opción B: MCP propio del cliente

El cliente puede hostear este paquete y extenderlo con tools propias. Mantén GATEWAY_API_KEY como env si la instancia es de un solo workspace; omítela si quieres pasar la key por header.

Checklist de compatibilidad Whaapy:

  • Endpoint POST /mcp y DELETE /mcp
  • Header Accept: application/json, text/event-stream
  • MCP-Protocol-Version: 2025-06-18
  • inputSchema.type = "object" y additionalProperties: false
  • tools/call responde content: [{ "type": "text", "text": "<JSON parseable>" }]
  • Operaciones lentas deben responder antes de 30s o devolver status: "queued"

Extender con tools propias

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
import { GatewayClient } from '@whaapy/data-gateway-mcp/dist/client.js';
import { createGatewayMcpServer } from '@whaapy/data-gateway-mcp/dist/server.js';

const client = new GatewayClient({
  gatewayUrl: process.env.GATEWAY_URL!,
  apiKey: process.env.GATEWAY_API_KEY!,
});

const server = await createGatewayMcpServer(client);

server.registerTool(
  'my_custom_tool',
  {
    description:
      'Tool adicional del cliente. When to use: cuando el agente necesite ejecutar la accion propia. Never use for: casos sin datos suficientes. Success criteria: ok=true con data verificable. Fallback: pedir mas datos o transferir a humano.',
    inputSchema: { message: z.string() },
  },
  async ({ message }) => ({
    content: [
      {
        type: 'text',
        text: JSON.stringify({
          ok: true,
          status: 'success',
          data: { message },
          toolName: 'my_custom_tool',
          safety: 'read_only',
        }),
      },
    ],
  }),
);

await server.connect(new StdioServerTransport());

Nota sobre rutas

El plan original menciona GET /workspaces/:id/tools, pero el manifest vive en GET /tools autenticado con API key de workspace (el workspace se infiere de la key). Esto permite que el MCP server funcione sin ADMIN_API_KEY.