mcpField
M
MCP Analytics Middleware

MCP Analytics Middleware

Local
github.com/Phillip-KemperData & Analytics4Updated 82w ago

About MCP Analytics Middleware

MCP Analytics Middleware is TypeScript middleware for monitoring MCP servers. It records tool and resource activity, performance, and errors, with a web dashboard and SQLite persistence.

Key features

  1. 01Track tool calls and resource requests
  2. 02Measure performance and error rates
  3. 03View live analytics in a web dashboard
  4. 04Persist data in SQLite

Use cases

  1. 01Finding the most-used tools
  2. 02Spotting server errors
  3. 03Reviewing slow operations
  4. 04Monitoring live server activity

MCP support

It integrates into TypeScript MCP SDK servers to collect analytics on tool calls and resource requests. A web viewer displays the stored metrics.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"analytics-middleware": {
"command": "npx",
"args": [
"-y",
"mcp-analytics-middleware"
]
}
}
}
Run commandnpx -y mcp-analytics-middleware

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp-analytics-middleware

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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
  • 🌐 Web dashboard for live analytics
  • 💾 SQLite database for persistent storage

Quick Start

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

let server = new McpServer({ 
name: 'Sample MCP Server with Analytics',
version: '1.0.0'
});

const analytics = new McpAnalytics('analytics.db');

server = analytics.enhance(server); // override tool and resource function implementation to record usage in sqlite

Live Analytics

Want to see a dashboard for a Tyescript SDK MCP Server making use of this middleware? You can directly provide a live dashboard using

npx -p mcp-analytics-middleware web-viewer --db-path analytics.db

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

You'll see:

  • Total tool calls and resource requests
  • Error rates and performance metrics
  • Most used tools and slowest operations

Example Implementations

Example implementatinos of the analytics middleware can be found.

  1. Dummy Caluclator Server Example src/server.ts
  2. Ethereum RPC MCP Server with Analytics server/index.ts_
  3. Forked Verision of the Google Maps MCP Server with additional Analytics Middleware src/google-maps/index.ts

Running with Inspector

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

yarn inspector --analytics --db-path analytics.db

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.