Skip to main content
Glama
MCP Observatory Server

MCP Observatory Server

by LuKrlier

MCP Observatory

CI MCP Server npm SDK npm MCP Server License: MIT TypeScript pnpm Node.js

The New Relic for MCP Servers - Now Open Source!

Real-time observability, monitoring, and cost tracking platform for Model Context Protocol servers with conversational monitoring via Claude.

๐ŸŽฏ Vision

Monitor your MCP servers by simply asking Claude:

  • "Is my server healthy?"

  • "Which tools are running slow?"

  • "Show me the recent errors"

Claude uses the MCP Observatory tools to answer in natural language with actionable insights.

Related MCP server: Anthropic Analytics MCP Server

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                 โ”‚
โ”‚  Your MCP Server                                                โ”‚
โ”‚  โ”œโ”€ Instrumented with @lukrlier/mcp-observatory-sdk           โ”‚
โ”‚  โ””โ”€ Events โ†’ FileReporter โ†’ metrics.ndjson                     โ”‚
โ”‚                                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                 โ”‚
โ”‚  MCP Observatory Server                                         โ”‚
โ”‚  โ”œโ”€ FileDataSource reads metrics.ndjson                        โ”‚
โ”‚  โ””โ”€ Exposes 5 MCP tools for querying metrics                   โ”‚
โ”‚                                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                                 โ”‚
โ”‚  Claude Desktop                                                 โ”‚
โ”‚  โ”œโ”€ User asks: "What are my server metrics?"                   โ”‚
โ”‚  โ”œโ”€ Claude calls get_server_metrics tool                       โ”‚
โ”‚  โ””โ”€ Claude responds with natural language insights             โ”‚
โ”‚                                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Features

โœ… 100% Open Source & Self-Hosted

  • All code is open source (SDK + MCP Server)

  • Data stays 100% local (NDJSON files)

  • No external dependencies required

  • Optional cloud service for teams

๐Ÿ“Š Comprehensive Metrics

  • Tool call statistics (count, duration, success rate)

  • Performance analysis (P50, P95, P99 latencies)

  • Error tracking and debugging

  • Cost estimation

  • Health scoring and recommendations

๐Ÿ”Œ Plugin Architecture

  • SDK Reporters: File, Console, Cloud

  • MCP DataSources: File, PostgreSQL, Cloud

  • Easy to extend with custom implementations

๐Ÿค– Conversational Monitoring

Query metrics via natural language through Claude:

  • "Show me slow tools"

  • "What errors occurred today?"

  • "How much will this cost?"

๐Ÿš€ Quick Start (5 minutes)

1. Install SDK

npm install @lukrlier/mcp-observatory-sdk

2. Instrument Your MCP Server

import { createObservatory } from '@lukrlier/mcp-observatory-sdk';

const observatory = createObservatory({
  reporter: 'file',
  filePath: './metrics.ndjson',
});

// Track tool calls
server.onToolCall(async (toolName, params) => {
  const start = Date.now();
  try {
    const result = await executeTool(toolName, params);
    observatory.trackToolCall({
      toolName,
      parameters: params,
      duration: Date.now() - start,
      success: true,
    });
    return result;
  } catch (error) {
    observatory.trackError({
      errorType: error.name,
      message: error.message,
      stack: error.stack,
    });
    throw error;
  }
});

3. Install MCP Observatory Server

npm install -g @lukrlier/mcp-observatory-server

4. Configure Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-observatory": {
      "command": "mcp-observatory-server",
      "args": ["--file", "/path/to/your/metrics.ndjson"]
    }
  }
}

5. Ask Claude

Restart Claude Desktop and ask:

  • "What are the metrics for my MCP server?"

  • "Are there any performance issues?"

๐Ÿ“ฆ Project Structure

mcp-observatory/
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ sdk/                # @lukrlier/mcp-observatory-sdk
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ reporters/  # FileReporter, ConsoleReporter, CloudReporter
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ factory.ts  # createObservatory()
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ types.ts    # Type definitions
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ mcp-server/         # @lukrlier/mcp-observatory-server
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ datasources/ # FileDataSource, PostgresDataSource, CloudDataSource
โ”‚       โ”‚   โ”œโ”€โ”€ index.ts     # MCP Server implementation
โ”‚       โ”‚   โ””โ”€โ”€ types.ts     # Type definitions
โ”‚       โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ examples/
โ”‚   โ””โ”€โ”€ basic-file-reporter/  # Complete example with SDK + MCP Server

๐ŸŽ“ Examples

Basic File Reporter

Complete standalone example: examples/basic-file-reporter

cd examples/basic-file-reporter
pnpm install
pnpm start    # Generate sample metrics
pnpm test     # Test MCP Server reads them correctly

See examples/basic-file-reporter/README.md for detailed walkthrough.

๐Ÿ”ง Reporter Options

createObservatory({
  reporter: 'file',
  filePath: './metrics.ndjson',
  batchSize: 50,
  batchTimeout: 5000,
  sampling: 1.0, // 100%
});

Console Reporter (Debugging)

createObservatory({
  reporter: 'console',
  debug: true,
});

Cloud Reporter (Optional hosted service) (coming soon)

createObservatory({
  reporter: 'cloud',
  apiKey: 'sk_xxx',
  endpoint: 'https://api.mcp-observatory.dev/v1/ingest',
});

๐Ÿ› ๏ธ MCP Server Options

File DataSource (Standalone)

mcp-observatory-server --file ./metrics.ndjson --debug

PostgreSQL DataSource (Production) (coming soon)

mcp-observatory-server --postgres "postgresql://localhost:5432/mcp"

Cloud DataSource (Hosted) (coming soon)

mcp-observatory-server --cloud sk_xxx

๐Ÿ“Š Available MCP Tools

The MCP Server exposes 5 tools that Claude can use:

  1. get_server_metrics - Overall server health and performance

    • Optional server_id - if omitted, returns aggregated metrics for all servers

  2. get_tool_stats - Detailed statistics for a specific tool

    • Optional server_id - if omitted, returns stats across all servers

  3. get_error_logs - Recent errors for debugging

    • Optional server_id - if omitted, returns errors from all servers

  4. get_cost_estimate - Estimated API costs

    • Optional server_id - if omitted, returns costs for all servers

  5. analyze_performance - AI-powered performance insights

    • Optional server_id - if omitted, analyzes all servers

Note: All tools support querying without server_id to get aggregated metrics across all your MCP servers.

๐Ÿงช Development Status

โœ… Completed:

  • SDK with plugin architecture (FileReporter, ConsoleReporter, CloudReporter)

  • MCP Server with FileDataSource

  • Complete end-to-end example

  • Tests passing (SDK: 12/12)

  • Documentation

๐Ÿšง In Progress:

  • PostgreSQL DataSource

  • Cloud DataSource

  • Additional examples

  • Integration tests

๐Ÿ“… Planned:

  • Dashboard (optional cloud service)

  • Alerting

  • Multi-server monitoring

  • Team collaboration

โ“ FAQ

Does this send data to external servers?

No! By default, all data stays 100% local using the FileReporter. Metrics are stored in NDJSON files on your machine. The cloud reporter is optional and disabled by default.

What's the performance overhead?

Minimal. The SDK uses:

  • Async event batching (default: 50 events or 5s timeout)

  • Sampling support (optional: track only X% of calls)

  • Non-blocking writes

Typical overhead: <1ms per tool call.

Can I use this in production?

Yes! The file-based approach is production-ready for most use cases. For high-volume scenarios (>1000 req/s), consider:

  • Using the PostgreSQL DataSource (coming soon)

  • Adjusting batch sizes

  • Enabling sampling (e.g., 10% of calls)

What's the difference between SDK and MCP Server?

  • SDK (@lukrlier/mcp-observatory-sdk): Instrument your MCP server to collect metrics

  • MCP Server (@lukrlier/mcp-observatory-server): Query metrics through Claude Desktop

You need both: SDK collects data โ†’ MCP Server lets Claude query it.

How often are metrics written to disk?

Metrics are batched and written:

  • Every 50 events (configurable via batchSize)

  • Every 5 seconds (configurable via batchTimeout)

  • On shutdown (graceful flush)

Can I create custom reporters?

Yes! Implement the Reporter interface:

interface Reporter {
  reportToolCall(event: ToolCallEvent): Promise<void>;
  reportError(event: ErrorEvent): Promise<void>;
  shutdown(): Promise<void>;
}

See packages/sdk/src/reporters/ for examples.

What data is collected?

The SDK collects:

  • Tool name, parameters, duration, success/error status

  • Timestamps, server ID

  • Error types, messages, stack traces (opt-in)

  • Custom metadata (optional)

No sensitive data is collected unless you explicitly include it in parameters or metadata.

Is there a size limit for metrics files?

No hard limit, but:

  • NDJSON files grow linearly with events

  • Recommended: rotate files daily or weekly

  • Use log rotation tools (e.g., logrotate) for production

  • Consider PostgreSQL DataSource for long-term storage

How do I test my instrumentation?

Run the basic example:

cd examples/basic-file-reporter
pnpm install
pnpm start  # Generates sample metrics
pnpm test   # Verifies MCP Server reads them

Or use the ConsoleReporter for debugging:

createObservatory({ reporter: 'console', debug: true });

Can I monitor multiple MCP servers?

Yes! Each server should:

  1. Write to a unique metrics file (e.g., server1.ndjson, server2.ndjson)

  2. Have a unique serverId in the SDK configuration

  3. Be configured separately in claude_desktop_config.json

New in v1.0.1: You can now query metrics across all servers without specifying a server_id:

User: "What are my overall server metrics?"
Claude: Calls get_server_metrics() without server_id
        Returns aggregated metrics for all servers

This is useful for:

  • Getting an overview of all your MCP servers at once

  • Comparing performance across servers

  • Identifying which server has issues

๐Ÿค Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

๐Ÿ“œ License

MIT - See LICENSE for details.

๐Ÿ™ Credits

Built with:


Questions? Open an issue

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Exposes analytics from Claude Code transcripts as MCP tools, enabling cost, audit, safety, and efficiency queries through natural language.
      4
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A read-only MCP server that exposes tools to query Datadog monitors and logs, and AWS CloudWatch Logs, and to group recurring errors by fingerprint. Designed for use with Claude Code to diagnose issues and propose fixes.
      MIT