Skip to main content
Glama
Scouter MCP Server

Scouter MCP Server

by miningyu

Scouter MCP Server

npm provenance

한국어

An MCP (Model Context Protocol) server that connects AI agents to Scouter APM, enabling natural-language queries against real-time application performance data.

Ask your AI assistant things like "What's the slowest SQL in the last hour?" or "Why is TPS dropping?" and get answers grounded in live monitoring data.

Features

  • 32 tools covering the full Scouter API surface

  • Dual protocol — connects via HTTP (REST API) or TCP (binary protocol)

  • Automatic hash resolution — SQL queries, service names, and error messages are decoded from Scouter's internal hash IDs to human-readable text

  • Executable SQL — transaction profiles include SQL with bind parameters substituted, ready for EXPLAIN ANALYZE

  • Zero external dependencies — only @modelcontextprotocol/sdk and zod

Related MCP server: mcp-kafka-observer

Quick Start

Using npx (no install needed)

npx scouter-mcp-server

Or install from source

cd scouter.mcp
npm install
npm run build

Configure

Set environment variables to point at your Scouter collector:

Variable

Description

Default

SCOUTER_API_URL

Scouter webapp REST API base URL

http://localhost:6180

SCOUTER_API_ID

API login ID

SCOUTER_API_PASSWORD

API login password

SCOUTER_TCP_HOST

TCP direct connection host

SCOUTER_TCP_PORT

TCP direct connection port

6100

SCOUTER_ENABLE_WRITE

Set to true to enable write tools

(disabled)

SCOUTER_MASK_PII

Set to false to disable PII masking in responses (IP, login, userAgent, SQL params)

true

HTTP mode (recommended) — set SCOUTER_API_URL. Supports all 32 tools (write tools require SCOUTER_ENABLE_WRITE=true). TCP mode — set SCOUTER_TCP_HOST. Lightweight, no webapp needed, but some admin tools are unavailable.

Note: By default, only read-only tools (25) are registered. To enable write tools (set_configure, set_alert_scripting, manage_kv_store, manage_shortener, control_thread, remove_inactive_objects), set SCOUTER_ENABLE_WRITE=true.

3. Add to your MCP client

Claude Desktop (claude_desktop_config.json):

HTTP mode:

{
  "mcpServers": {
    "scouter": {
      "command": "npx",
      "args": ["-y", "scouter-mcp-server"],
      "env": {
        "SCOUTER_API_URL": "http://your-scouter-server:6180",
        "SCOUTER_API_ID": "admin",
        "SCOUTER_API_PASSWORD": "your-password"
      }
    }
  }
}

TCP mode:

{
  "mcpServers": {
    "scouter": {
      "command": "npx",
      "args": ["-y", "scouter-mcp-server"],
      "env": {
        "SCOUTER_TCP_HOST": "your-scouter-server",
        "SCOUTER_TCP_PORT": "6100",
        "SCOUTER_API_ID": "admin",
        "SCOUTER_API_PASSWORD": "your-password"
      }
    }
  }
}

Claude Code (use -s user to register globally across all projects):

# HTTP mode
claude mcp add scouter -s user \
  -e SCOUTER_API_URL=http://your-scouter-server:6180 \
  -e SCOUTER_API_ID=admin \
  -e SCOUTER_API_PASSWORD=your-password \
  -- npx -y scouter-mcp-server

# TCP mode
claude mcp add scouter -s user \
  -e SCOUTER_TCP_HOST=your-scouter-server \
  -e SCOUTER_TCP_PORT=6100 \
  -e SCOUTER_API_ID=admin \
  -e SCOUTER_API_PASSWORD=your-password \
  -- npx -y scouter-mcp-server

To update the configuration later, edit ~/.claude.json directly or remove and re-add:

claude mcp remove scouter -s user
claude mcp add scouter -s user \
  -e SCOUTER_TCP_HOST=new-host \
  -e SCOUTER_TCP_PORT=6100 \
  -e SCOUTER_API_ID=admin \
  -e SCOUTER_API_PASSWORD=your-password \
  -- npx -y scouter-mcp-server

Tools

Performance Investigation

Tool

Description

get_system_overview

Real-time snapshot — TPS, response time, CPU, heap, active services, alerts

diagnose_performance

Automated multi-step diagnosis with severity-ranked findings

get_counter_trend

Historical counter values (TPS, ElapsedTime, CPU, etc.) over time

search_transactions

Find slow/error transactions by time range, service, IP, login

get_transaction_detail

Full transaction profile with executable SQL and API call traces

list_active_services

Currently running requests with thread state

SQL & Database

Tool

Description

get_sql_analysis

SQL performance ranking — count, elapsed, errors, % of total

lookup_text

Resolve hash IDs to SQL/service/error text

Error & Alert Analysis

Tool

Description

get_error_summary

Errors ranked by frequency with per-service error rates

get_alert_summary

Alert statistics within a time range

get_alert_scripting

Read alert rule scripts

set_alert_scripting

Create/update alert rules (HTTP only)

Service & Traffic

Tool

Description

get_service_summary

Service-level stats with external API call breakdown

get_ip_summary

Request distribution by client IP

get_user_agent_summary

Request distribution by browser/user-agent

get_visitor_stats

Unique visitor counts (realtime, daily, hourly)

get_interaction_counters

Service-to-service call relationships

Infrastructure

Tool

Description

get_thread_dump

Thread dump with stack traces

get_host_info

Host-level top processes and disk usage

get_agent_info

Agent runtime info (threads, env, sockets)

get_server_info

Collector server metadata and counter model

Distributed Tracing

Tool

Description

get_distributed_trace

Trace a transaction across services via GXID

get_realtime_xlogs

Real-time transaction stream

get_raw_xlog

Raw XLog data (5 query modes)

get_raw_profile

Raw profile steps with hash IDs

Configuration & Management

Tool

Description

get_configure

Read server/agent configuration

set_configure

Modify configuration (HTTP only)

control_thread

Suspend/resume/interrupt threads

manage_kv_store

Global, namespaced, and private key-value store

manage_shortener

URL shortener service

remove_inactive_objects

Clean up dead agents (HTTP only)

Architecture

┌─────────────────────────────┐
│  AI Agent (Claude, etc.)    │
│  "Why is the app slow?"     │
└──────────┬──────────────────┘
           │ MCP (stdio)
┌──────────▼──────────────────┐
│  Scouter MCP Server         │
│  ┌────────────────────────┐ │
│  │ Tool Hub (31 tools)    │ │
│  │ Hash Resolution Engine │ │
│  │ SQL Param Binding      │ │
│  └────────────────────────┘ │
└──────────┬──────────────────┘
           │ HTTP REST or TCP Binary
┌──────────▼──────────────────┐
│  Scouter Collector Server   │
│  + Webapp (REST API)        │
└──────────┬──────────────────┘
           │
    ┌──────▼──────┐
    │ Java Agents │
    │ Host Agents │
    └─────────────┘

Project Structure

scouter.mcp/
├── index.ts                 # Entry point — stdio transport + SIGINT handler
├── server/
│   └── index.ts             # createServer() factory → { server, cleanup }
├── tools/
│   ├── index.ts             # registerAllTools() hub — explicit imports of all tools
│   ├── shared-utils.ts      # Hash resolution, SQL param binding
│   └── ... (31 tool files)
├── client/
│   ├── index.ts             # Client facade — exports client, jsonStringify, catchWarn
│   ├── interface.ts         # ScouterClient interface + types
│   ├── http.ts              # HTTP/REST implementation
│   └── tcp.ts               # TCP binary protocol implementation
├── protocol/
│   ├── tcp-connection.ts    # TCP connection with handshake/auth
│   ├── packs.ts             # Scouter binary pack definitions
│   ├── values.ts            # Value type serialization
│   ├── data-input.ts        # Binary deserialization
│   ├── data-output.ts       # Binary serialization
│   └── constants.ts         # Protocol constants
├── time-utils.ts            # Time parsing utilities
├── __tests__/               # Vitest test suites
├── vitest.config.ts         # Test config (v8 coverage)
├── tsconfig.json            # NodeNext modules
└── package.json

Development

npm run dev          # Watch mode (tsc --watch)
npm test             # Run tests
npm run test:coverage  # Coverage report
npm run build        # Production build

Adding a New Tool

  1. Create tools/my-tool.ts exporting register(server: McpServer) with server.registerTool()

  2. Add import { register as registerMyTool } from "./my-tool.js" to tools/index.ts

  3. Call registerMyTool(server) inside registerAllTools()

  4. Use shared-utils.ts for hash resolution and SQL binding

Protocol Details

HTTP Mode

Connects to Scouter's webapp REST API (/scouter/v1/*). Supports all 32 tools including write operations (configuration, alert scripting, thread control).

Authentication: username/password login with bearer token auto-refresh on 401.

TCP Mode

Connects directly to the Scouter collector using the binary protocol (port 6100). Handshake uses NetCafe magic number (0xCAFE2001), login with SHA-256 hashed password.

Supports read-only tools. Write operations (config, alerts, KV store, URL shortener) throw UnsupportedOperationError.

Text hash resolution uses GET_TEXT_100 command with per-date caching.

Requirements

  • Node.js >= 18

  • Scouter Collector >= 2.x with webapp enabled (for HTTP mode)

License

Apache License 2.0 — same as the Scouter project.

Available Tools

25 tools
diagnose_performanceDiagnose PerformanceA
Read-onlyIdempotent

Perform automated multi-step performance diagnosis. Checks system counters, active services, error patterns, slow SQL, and service hotspots. Returns a structured diagnostic report with findings ranked by severity (CRITICAL/WARNING/INFO) and suggested actions.

Inputs: obj_type, time_range_minutes.

get_agent_infoGet Agent InfoA
Read-onlyIdempotent

Get detailed agent runtime information: thread list with states and active services, environment variables, and socket connections. Thread list shows live thread states (unlike thread dump which captures stack traces). Use for deep agent-level investigation.

Inputs: obj_hash (required), include_env, include_sockets, include_threads.

get_alert_scriptingGet Alert ScriptingA
Read-onlyIdempotent

[HTTP mode only] Read alert scripting configuration for a specific counter (read-only). Shows the current alert script, threshold rules, and configuration. Use get_server_info with include_counter_model to discover available counter names.

Inputs: counter_name (required), log_loop, log_index, include_compile_log.

get_alert_summaryGet Alert SummaryA
Read-onlyIdempotent

Get aggregated alert statistics within a time range. Shows which alert types fired most frequently. Use alongside get_system_overview (which shows recent real-time alerts) for historical alert pattern analysis.

Inputs: end_time, obj_hash, obj_type, max_count, +1 more.

get_configureGet ConfigureA
Read-onlyIdempotent

[HTTP mode only] Read server or agent configuration (read-only). Without obj_hash, returns the collector server's scouter.conf. With obj_hash, returns that specific agent's configuration. Use get_system_overview to find agent hashes.

Inputs: obj_hash.

get_counter_trendGet Counter TrendA
Read-onlyIdempotent

Get historical counter values over a time range for trend analysis. Supports TPS, ElapsedTime, HeapUsed, ProcCpu, GcCount, Cpu, Mem, and more. Use latest_sec for quick recent data (e.g., last 60s), or start_time/end_time for custom ranges. Auto-selects precision: 2-second for <=2h, 5-minute for >2h. Large datasets are auto-sampled.

Inputs: counter (required), end_time, obj_type, latest_sec, +2 more.

get_distributed_traceGet Distributed TraceA
Read-onlyIdempotent

Trace a distributed transaction across multiple services using GXID, or fetch multiple transactions by txid list. Essential for MSA environments to follow a request across service boundaries. Use after finding a GXID in get_transaction_detail.

Inputs: date, gxid, txids, include_profiles.

get_error_summaryGet Error SummaryA
Read-onlyIdempotent

Analyze errors within a time range. Returns error types ranked by frequency with error messages, stack traces, and sample transaction IDs for drill-down. Also shows per-service error rates for context.

Inputs: end_time, obj_hash, obj_type, start_time.

get_host_infoGet Host InfoA
Read-onlyIdempotent

Get host-level system information: top processes (by CPU/memory) and disk usage. Requires a host agent obj_hash, or specify obj_type (e.g., 'linux') to auto-discover host agents. Use get_system_overview to find host agent hashes.

Inputs: obj_hash, obj_type, include_top, include_disk.

get_interaction_countersGet Interaction CountersA
Read-onlyIdempotent

Get real-time service-to-service call relationships. Shows which services call which other services, with call counts, error counts, and latency. Useful for understanding service dependencies and topology.

Inputs: obj_type, obj_hashes.

get_ip_summaryGet IP SummaryA
Read-onlyIdempotent

Analyze request distribution by client IP address. Shows which IPs generate the most traffic. Useful for identifying heavy users, bots, or potential DDoS sources.

Inputs: end_time, obj_hash, obj_type, max_count, +1 more.

get_raw_profileGet Raw ProfileA
Read-onlyIdempotent

Get raw (non-decoded) profile steps for a transaction. Unlike get_transaction_detail which returns decoded/human-readable profile data, this returns the raw Step objects with hash IDs. Use lookup_text to resolve hash IDs to text. Useful when you need the raw step structure for programmatic analysis.

Inputs: date (required), txid (required).

get_raw_xlogGet Raw XLogA
Read-onlyIdempotent

Get raw (non-decoded) XLog transaction data. Unlike search_transactions which returns decoded data, this returns raw XLog objects with hash IDs. Supports five modes: single lookup, GXID distributed trace, filtered search, pageable list, and real-time streaming. Use lookup_text to resolve hash IDs.

Inputs: mode (required), ip, date, gxid, +14 more.

get_realtime_xlogsGet Realtime XLogsA
Read-only

Get recent real-time transaction data (XLogs) produced since the given offsets. Returns decoded XLog entries with loop/index offsets for subsequent polling. Use offset 0/0 for the first call, then pass returned offsets to get newer data.

Inputs: obj_type, xlog_loop, obj_hashes, xlog_index.

get_server_infoGet Server InfoA
Read-onlyIdempotent

Get Scouter collector server metadata: version, ID, connection status. Optionally includes counter model (all available performance counter definitions with display names and units). Use this to discover what counters exist before querying get_counter_trend. Counter model requires HTTP mode.

Inputs: include_counter_model.

get_service_summaryGet Service SummaryA
Read-onlyIdempotent

Get aggregated service-level performance statistics. Shows which services are called most, have highest error rates, or consume most resources. Includes external API call summary for dependency analysis.

Inputs: sort_by, end_time, obj_hash, obj_type, +3 more.

get_sql_analysisGet SQL AnalysisA
Read-onlyIdempotent

Analyze SQL performance within a time range. Returns SQL statements ranked by total elapsed time, showing execution counts, error counts, and average execution time. Use when investigating database-related performance issues.

Inputs: sort_by, end_time, obj_hash, obj_type, +2 more.

get_system_overviewGet System OverviewA
Read-onlyIdempotent

Get a comprehensive snapshot of current system status: agents, real-time counters (TPS, response time, heap, CPU), active service counts, and recent alerts. Use this as the starting point for any investigation.

Inputs: obj_type.

get_thread_dumpGet Thread DumpA
Read-onlyIdempotent

Capture a thread dump from a specific JVM agent. Use for diagnosing deadlocks, thread contention, or understanding thread activity. Optionally includes heap histogram for memory analysis. Stack traces require HTTP mode; TCP mode returns thread states only.

Inputs: obj_hash (required), include_heap_histogram.

get_transaction_detailGet Transaction DetailA
Read-onlyIdempotent

Get full detail of a specific transaction including execution profile (SQL queries with bind params, API calls, method traces). Use after identifying a problematic transaction from search_transactions or list_active_services.

Inputs: txid (required), date, max_steps.

get_user_agent_summaryGet User Agent SummaryA
Read-onlyIdempotent

Analyze request distribution by browser/user-agent. Shows which clients (browsers, bots, mobile apps) generate the most traffic. Useful for understanding client demographics and detecting crawlers.

Inputs: end_time, obj_hash, obj_type, max_count, +1 more.

get_visitor_statsGet Visitor StatsA
Read-onlyIdempotent

Get unique visitor (user) statistics. Supports real-time current visitor count, daily totals, or hourly breakdown. Useful for understanding traffic patterns and user activity.

Inputs: date, mode, end_time, obj_hash, +3 more.

list_active_servicesList Active ServicesA
Read-onlyIdempotent

Show all currently executing requests (in-flight transactions). Use when investigating hangs, slow conditions, or asking 'what is running right now'. Returns active services sorted by elapsed time descending.

Inputs: obj_hash, obj_type, thread_id, min_elapsed_ms.

lookup_textLookup TextA
Read-onlyIdempotent

Resolve hash IDs to their original text values. Scouter stores SQL queries, service names, error messages, etc. as integer hashes for efficiency. Use this to get the actual text for a hash ID seen in other tool outputs.

Inputs: type (required), hashes (required), date.

search_transactionsSearch TransactionsA
Read-onlyIdempotent

Search for transactions (XLogs) within a time range. Find slow transactions, error transactions, or filter by service name/IP/login. Returns list sorted by elapsed time descending with summary statistics. Primary tool for 'why is it slow?' investigations.

Inputs: ip, date, login, service, +4 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, but a few pairs like get_realtime_xlogs vs get_raw_xlog and get_agent_info vs get_thread_dump could be confused at first glance. Descriptions are detailed enough to separate them, but the boundaries are not perfectly crisp.

    Naming Consistency4/5

    The vast majority of tools follow a get_<noun> pattern (e.g., get_system_overview, get_transaction_detail). Two tools deviate: diagnose_performance and lookup_text. This is a minor inconsistency, but the overall naming is predictable and readable.

    Tool Count4/5

    25 tools is on the heavier side, but the server covers a broad APM domain: transactions, services, SQL, errors, alerts, configuration, and raw data access. Each tool addresses a legitimate need, so the count feels justified rather than bloated.

    Completeness5/5

    The tool surface is remarkably complete for a performance monitoring server. It covers system overview, automated diagnosis, counter trends, transaction search and detail, distributed tracing, service analysis, SQL analysis, error analysis, visitor statistics, alerts, configuration reading, host/agent info, thread dumps, and raw data access. There are no obvious dead ends or missing core operations.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that bridges AI assistants with SQL databases, enabling natural language querying across multiple database types with built-in optimization and security.
      3
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives AI agents real-time observability into Apache Kafka clusters, enabling natural language queries for broker health, consumer lag, and diagnostics.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that enables AI assistants to query and manage Microsoft SQL Server databases using natural language.
      117 npm
      5
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that gives AI assistants direct access to SAP HANA performance data — query plans, execution stats, memory usage.
      MIT