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

@reaatech/mcp-server-tools

v1.1.0

Published

MCP tool registry, discovery, and built-in tools (echo, health-check)

Readme

@reaatech/mcp-server-tools

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

MCP tool registry, discovery, and built-in tools for the MCP server framework. Provides a type-safe defineTool() helper, an in-memory registry, filesystem auto-discovery of .tool.ts files, and built-in echo and health-check tools.

Installation

npm install @reaatech/mcp-server-tools
# or
pnpm add @reaatech/mcp-server-tools

Feature Overview

  • Type-safe tool definitionsdefineTool() with Zod input schemas and typed handlers
  • In-memory registry — Register, query, and clear tools at runtime
  • Auto-discovery — Scans directories for .tool.ts files and registers them at startup
  • Built-in toolsecho (connectivity test) and health-check (server diagnostics) ship by default
  • Tool context — Handlers receive ToolContext with request metadata and session data

Quick Start

Creating a Tool

import { defineTool } from '@reaatech/mcp-server-tools';
import { z } from 'zod';
import { textContent } from '@reaatech/mcp-server-core';

export default defineTool({
  name: 'my-tool',
  description: 'Does something useful for the LLM',
  inputSchema: z.object({
    query: z.string().describe('The search query'),
    limit: z.number().optional().describe('Max results'),
  }),
  handler: async ({ query, limit }, context) => {
    // context.request.requestId, context.request.sessionId, etc.
    const result = await search(query, limit ?? 10);
    return {
      content: [textContent(JSON.stringify(result))],
    };
  },
});

Registering Tools

import { registerTool, getTools, getTool, discoverTools, clearTools } from '@reaatech/mcp-server-tools';

// Manual registration
registerTool(myTool);

// Look up tools
const allTools = getTools();
const specificTool = getTool('my-tool');

// Auto-discovery (scans for *.tool.ts files)
const discovered = await discoverTools();

// Clean up (for testing)
clearTools();

API Reference

ToolDefinition

interface ToolDefinition {
  name: string;                                              // Unique tool identifier
  description: string;                                       // Human-readable for the LLM
  inputSchema: z.ZodObject<z.ZodRawShape>;                   // Zod schema for input validation
  handler: (args: Record<string, unknown>, context: ToolContext) => Promise<ToolResponse>;
}

defineTool(def: ToolDefinition): ToolDefinition

Type-safe helper for defining a tool. Returns the definition unchanged — useful for the export default auto-discovery pattern.

export default defineTool({
  name: 'my-tool',
  description: '...',
  inputSchema: z.object({ ... }),
  handler: async (args) => { ... },
});

registerTool(tool: ToolDefinition): void

Add a tool to the in-memory registry. Throws if a tool with the same name is already registered.

getTools(): ToolDefinition[]

Returns a copy of all registered tools.

getTool(name: string): ToolDefinition | undefined

Look up a specific tool by name. Returns undefined if not found.

discoverTools(): Promise<ToolDefinition[]>

Auto-discovers tools from the filesystem and registers them. Searches these directories:

  1. src/tools/ — source tree
  2. dist/src/tools/ — build output (first candidate)
  3. dist/tools/ — build output (second candidate)

Matches files matching /\.tool\.(ts|js)$/ (excluding .d.ts). Built-in echo and health-check tools are loaded from the package itself — they do not require filesystem discovery.

clearTools(): void

Clears the registry. Primarily for testing.

Built-in Tools

echo

Returns the input message back to the caller. Useful for testing MCP connectivity.

// Input schema: { message: string }
// Returns: { content: [{ type: "text", text: "<message>" }] }

health-check

Returns server health diagnostics: uptime, version, environment, timestamp, and memory usage.

// Input schema: {} (no parameters)
// Returns: { content: [{ type: "text", text: "<json diagnostics>" }] }

Integration with the Server

import { createApp } from '@reaatech/mcp-server-engine';
// discoverTools() is called automatically inside createApp()

const app = await createApp();
// echo and health-check tools are available
app.listen(8080);

Related Packages

License

MIT