Setting Up and Utilizing Model Context Protocol (MCP) Servers for Observability with Prometheus, Grafana, Tempo, and Loki via GitHub CoPilot

Bhoopesh Sharma

Summary:

This video demonstrates how to configure and use Model Context Protocol (MCP) servers to enable observability for the LGTM stack (Loki, Grafana, Tempo, Prometheus) on a remote EC2 instance using GitHub CoPilot. The speaker initiates by setting up an AWS EC2 instance with Grafana, Prometheus, and Loki, verifying their operational status and data sources. He then details the configuration of local MCP servers for Grafana, Loki, and Prometheus, emphasizing the need for API keys and cloning specific GitHub repositories. The core demonstration involves using GitHub CoPilot as an agentic AI to interact with these MCP servers. CoPilot is successfully used to create and update Grafana dashboards for node exporter metrics, logs, top 10 Prometheus metrics, and EC2 memory observability. The video also shows CoPilot querying Grafana to list users and data sources, highlighting its capability to simplify complex observability tasks through natural language commands without manual query writing. The process streamlines the management and visualization of monitoring data, showcasing the power of AI in DevOps.

List of Grafana Dashboards created by CoPilot
List of Grafana Dashboards created by CoPilot [ 00:11:35 ]

Introduction to Model Context Protocol (MCP) Servers [0:00]

The video introduces an extended session on Model Context Protocol (MCP) servers, focusing on enabling communication from a local laptop to a Grafana instance and the entire LGTM (Loki, Grafana, Tempo, Prometheus) stack installed elsewhere, specifically on an EC2 instance. The main goal is to demonstrate how GitHub CoPilot can act as an agentic AI to pass commands to these observability tools via MCP servers.

Environment Setup and Verification [1:27]

The first step involves preparing the remote environment where the observability tools are hosted.

Grafana server status on EC2 instance.
Grafana server status on EC2 instance. [ 00:02:34 ]
* Prometheus is running on port 9090, with node exporter configured to capture infrastructure metrics.
Prometheus service status on EC2 instance.
Prometheus service status on EC2 instance. [ 00:02:53 ]
* Loki is running on port 3100.
Loki service status on EC2 instance.
Loki service status on EC2 instance. [ 00:01:36 ]
* Data Source Confirmation in Grafana: * Prometheus and Loki are added as data sources in Grafana.
Prometheus targets page showing node exporter and Prometheus endpoints.
Prometheus targets page showing node exporter and Prometheus endpoints. [ 00:03:20 ]
Grafana welcome screen with basic setup steps.
Grafana welcome screen with basic setup steps. [ 00:03:30 ]
* Logs from Loki are confirmed to be flowing into Grafana.
Grafana Explore page for Loki data source.
Grafana Explore page for Loki data source. [ 00:03:57 ]
* Metrics from Prometheus (including node exporter) are also confirmed to be present. * Existing Dashboards: A node exporter full dashboard is shown to be already available.
Grafana Node Exporter Full Dashboard displaying system metrics.
Grafana Node Exporter Full Dashboard displaying system metrics. [ 00:04:40 ]

Configuring Local MCP Servers [4:44]

To enable communication between GitHub CoPilot on the local machine and the remote observability stack, individual MCP servers for each tool need to be set up locally.

Automating Observability with GitHub CoPilot [8:10]

The most significant part of the demonstration involves using GitHub CoPilot to automate various observability tasks by sending natural language commands.

GitHub CoPilot chat history in VS Code, showing interactions with MCP servers.
GitHub CoPilot chat history in VS Code, showing interactions with MCP servers. [ 00:08:24 ]

Conclusion and Future Potential [15:08]

The video concludes by emphasizing the power of this setup for simplifying complex observability tasks.