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

mcp-analytics-middleware

v1.0.5

Published

Analytics middleware for Model Context Protocol servers

Downloads

74

Readme

MCP Analytics Middleware

npm version npm downloads

A simple way to track and visualize how your MCP server is being used. See which tools are most popular, catch errors early, and understand your server's performance.

Features

  • 🔍 Track all tool calls and resource requests
  • 📊 See performance metrics and error rates
  • 🌐 Beautiful web dashboard for live analytics
  • 💾 SQLite database for persistent storage
  • ⚡ Real-time updates every 5 seconds

Quick Start

  1. Install the package:
yarn add mcp-analytics-middleware
  1. Add it to your MCP server:
import { McpAnalytics } from 'mcp-analytics-middleware';

const analytics = new McpAnalytics('analytics.db');
server.use(analytics.middleware);
  1. View your analytics:
# Console view
yarn mcp-analytics-view --db-path=analytics.db

# Or check out the fancy web dashboard
yarn web-viewer --db-path=analytics.db

The web dashboard will open at http://localhost:5000 and show you live analytics!

Live Analytics

Want to see what's happening on your server right now? Just start the web viewer with your database path:

yarn web-viewer --db-path=analytics.db

You'll see:

  • Total tool calls and resource requests
  • Error rates and performance metrics
  • Most used tools and slowest operations
  • Daily usage patterns
  • And it all updates automatically every 5 seconds!

Running with Inspector

If you're using the MCP Inspector, just add the analytics flag:

yarn inspector --db-path=analytics.db

API Reference

McpAnalytics

The main class that handles everything.

class McpAnalytics {
  constructor(dbPath: string);
  middleware: Middleware;
  db: AnalyticsDB;
  analytics: Analytics;
}

AnalyticsDB

Handles all the database stuff.

class AnalyticsDB {
  getToolCallStats(): ToolStats;
  getResourceRequestStats(): ResourceStats;
}

Analytics

Gives you all the cool analytics calculations.

class Analytics {
  getTopTools(limit: number): ToolStats[];
  getSlowestTools(limit: number): ToolStats[];
  getErrorProneTool(limit: number): ToolStats[];
}

Development

# Install everything
yarn install

# Build the project
yarn build

# Start the development server
yarn dev

License

MIT