MCP Analytics Middleware
About
A lightweight TypeScript middleware for MCP SDK servers that delivers analytics. Captures request metrics, performance data, and usage patterns with minimal overhead. Features real-time monitoring, configurable data collection, and detailed reporting - all with full type safety.
Details
- Author
- Phillip-Kemper
- GitHub stars
- 4
- Downloads
- 277
- Categories
- Search
Jump to
- Track all tool calls and resource requests
- See performance metrics and error rates
- Web dashboard for live analytics
- SQLite database for persistent storage
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
MCP Analytics MiddlewareCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install via yarn add mcp-analytics-middleware, then import McpAnalytics and wrap your McpServer instance with analytics.enhance(server). You can launch the live web dashboard with npx -p mcp-analytics-middleware web-viewer --db-path analytics.db, or use the MCP Inspector flag --analytics --db-path analytics.db.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mcp analytics middleware": {
"mcp-analytics-middleware": {
"command": "npx",
"args": [
"-p",
"mcp-analytics-middleware",
"web-viewer",
"--db-path",
"analytics.db"
]
}
}
}
}
McpServers
{
"mcp-analytics-middleware": {
"command": "npx",
"args": [
"-p",
"mcp-analytics-middleware",
"web-viewer",
"--db-path",
"analytics.db"
]
}
}
MCP Analytics Middleware
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.
- Supporting Blog Post
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
2. 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.tsRunning with Inspector
If you're using the MCP Inspector, just add the analytics flag:
yarn inspector --analytics --db-path analytics.db
License
MIT
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.

