openstatus logoDashboard

How to Monitor Your Model Context Provider (MCP) Server

Problem

Running a Model Context Provider (MCP) server is critical for your AI applications, but traditional HTTP monitoring often falls short. MCP servers communicate using the JSON-RPC 2.0 protocol, requiring specific request/response patterns that standard health checks don't cover. How can you confidently ensure your MCP server is healthy and responsive at all times, without custom scripts or complex setups?

Solution

openstatus monitors MCP servers by sending JSON-RPC ping requests to your endpoint from multiple global locations. This verifies not only network reachability but also the correct functioning of your server's JSON-RPC interface. This guide walks you through setting up comprehensive monitoring for any MCP server using the openstatus CLI.

Prerequisites

Step-by-step guide

1. Create your openstatus.yaml file

openstatus allows you to define and manage your monitors using a YAML configuration file, which is ideal for GitOps workflows. This approach ensures your monitoring setup is version-controlled, auditable, and easily deployable.

Create a file named openstatus.yaml and add the following configuration, adapting it for your own MCP endpoint. This example targets a Hugging Face MCP server.

# yaml-language-server: $schema=https://www.openstatus.dev/schema.json

mcp-server:
  name: "HF MCP Server"
  description: "Hugging Face MCP server monitoring"
  frequency: "1m"
  active: true
  regions: ["iad", "ams", "lax"]
  retry: 3
  kind: http
  request:
    url: https://hf.co/mcp
    method: POST
    body: >
      {
        "jsonrpc": "2.0",
        "id": "openstatus",
        "method": "ping"
      }
    headers:
      User-Agent: openstatus
      Accept: application/json, text/event-stream
      Content-Type: application/json
  assertions:
    - kind: statusCode
      compare: eq
      target: 200
    - kind: textBody
      compare: eq
      target: '{"result":{},"jsonrpc":"2.0","id":"openstatus"}'

2. Understand the configuration

The key fields in this YAML configuration:

  • name and description — human-readable name and explanation for your monitor.
  • frequency — how often openstatus runs the check (e.g., 1m, 5m, 10m).
  • regions — an array of geographic regions from which to perform checks (e.g., ["iad", "ams", "lax"]). Monitoring from multiple regions helps detect localised issues.
  • retry — the number of times to retry a failed check before marking it as down.
  • kind — must be http for MCP servers.
  • request:
    • url — the full URL of your MCP server's JSON-RPC endpoint.
    • method — must be POST for JSON-RPC requests.
    • body — the JSON-RPC ping request payload.
    • headers — standard HTTP headers for JSON-RPC communication.
  • assertions — rules to validate the server's response.
    • statusCode — ensures the HTTP response is 200 OK.
    • textBody — verifies that the response payload exactly matches the expected JSON-RPC ping result.

3. Test your MCP server (optional)

Before deploying your monitor, you can manually test your MCP server's ping endpoint with curl to confirm it responds as expected. This helps verify the target value for your textBody assertion.

curl -X POST \\
  -H "Content-Type: application/json" \\
  -d '{"jsonrpc": "2.0", "id": "openstatus", "method": "ping"}' \\
  https://hf.co/mcp # Replace with your MCP server URL

A healthy server should return a JSON response like {"result":{},"jsonrpc":"2.0","id":"openstatus"}.

4. Deploy your monitor

Once your openstatus.yaml file is ready, use the openstatus CLI to create the monitor:

openstatus create openstatus.yaml

This command uploads your configuration, and monitoring will begin immediately.

What you've accomplished

  • Configured a JSON-RPC based monitor for your MCP server
  • Implemented precise assertions to validate ping responses
  • Set up global monitoring to detect localised or widespread issues
  • Automated monitor deployment using a version-controlled YAML configuration

What's next

Learn more