Skip to content

How to monitor your Model Context Provider (MCP) server?

In this guide, we will show you how to monitor your remote MCP server using OpenStatus. We will use the Hugging Face MCP server for this article, but you can apply the same principles to any MCP server. You can find the code for this guide on GitHub.

Prerequisites

  • An OpenStatus account and CLI
  • An MCP server

A Model Context Provider is a component that supplies additional context, data, or capabilities to AI models during runtime through the Model Context Protocol (MCP). It acts as a bridge, allowing AI models to access external resources such as databases, APIs, file systems, or other services not included in their original training data.

The server component of the MCP protocol hosts and manages external resources, tools, or data sources that AI models can access. It handles incoming requests from MCP clients, processes them according to the protocol specifications, and returns the requested information or executes the specified actions. The MCP server serves as the backend provider, exposing capabilities like database queries, file operations, or API calls in a standardized format for AI models to interact with.

The protocol must adhere to the JSON-RPC 2.0 specification.

JSON-RPC is a remote procedure call protocol that uses JSON as its data format. It is designed to be simple and easy to implement while providing a robust and flexible way to communicate between clients and servers. The JSON-RPC protocol is transport-independent, but for MCP servers, it uses HTTP/HTTPS, making it easy to monitor with OpenStatus.

The official MCP documentation recommends implementing a health check for your MCP server. The protocol includes a mechanism to verify that the server is still responsive: the ping utility. The ping feature operates using a basic request/response mechanism.

OpenStatus allows you to monitor your MCP server by sending a ping request to your MCP server’s endpoint on a regular basis from multiple locations around the world. Making it easy to monitor your remote MCP server’s health and performance.

The OpenStatus CLI allows you to create monitor defined in a YAML configuration file. This is perfect solution if want to manage your monitors via GitOps.

Here’s an example of a monitor configuration for 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"}'

We send an HTTP POST request to the MCP server. The request body contains a JSON-RPC request with the method “ping”.

{
"jsonrpc": "2.0",
"id": "openstatus",
"method": "ping"
}

We set our headers to accept application/json and text/event-stream. We also include assertions to verify the response.

First, we check that the status code is 200.

- kind: statusCode
compare: eq
target: 200

Next, we verify that the response body is correct.

- kind: textBody
compare: eq
target: '{"result":{},"jsonrpc":"2.0","id":"openstatus"}'

Using OpenStatus CLI to Create Your Monitor

Section titled “Using OpenStatus CLI to Create Your Monitor”

To create your monitor, use the OpenStatus CLI.

Terminal window
openstatus create openstatus.yaml

This guide has shown you how to create a monitor for your MCP server using the OpenStatus CLI. You can view the monitor in the OpenStatus dashboard.

For example, here is our monitor for the HF MCP server:

https://www.openstatus.dev/public/monitors/5961