
Netdata 模型上下文协议
STDIOOfficial基础设施监控集成,使AI助手访问指标、日志和系统数据
基础设施监控集成,使AI助手访问指标、日志和系统数据
Netdata Agents (and soon Netdata Cloud) provide a Model Context Protocol (MCP) server that enables AI assistants like Claude or Cursos to interact with your infrastructure monitoring data. This integration allows AI assistants to access metrics, logs, alerts, and live system information (processes, services, containers, VMs, network connections, etc), acting as a capable DevOps/SRE/SysAdmin assistant.
The AI assistants have different visibility on your infrastructure, depending on where in a Netdata hierarchy they are connected:
You can use Netdata with the following AI assistants:
Probably more: Check the MCP documentation for a full list of supported AI assistants.
All these AI assistants need local access to the MCP servers. This means that the application you run locally on your computer (Claude Desktop, Cursor, etc) needs to be able to connect to the Netdata using stdio
communication. However, since your Netdata runs remotely on a server, you need a bridge to convert the stdio
communication to WebSocket
communication. Netdata provides bridges in multiple languages (Node.js, Python, Go) to facilitate this.
Once MCP is integrated into Netdata Cloud, Web-based AI assistants will also be supported. For Web-based AI assistants, the backend of the assistant connects to a publicly accessible MCP server (i.e. Netdata Cloud) to access infrastructure observability data, without needing a bridge.
The MCP server is built into Netdata and requires no additional installation. Just ensure you have a recent version of Netdata installed.
To use the MCP integration of Netdata with AI clients, you need to configure them and bridge them to the Netdata MCP server.
The configuration of most AI assistants is done via a configuration file, which is almost identical for all of them.
{ "mcpServers": { "netdata": { "command": "/usr/bin/nd-mcp", "args": [ "ws://IP_OF_YOUR_NETDATA:19999/mcp?api_key=YOUR_API_KEY" ] } } }
The program nd-mcp
is the bridge program that converts stdio
communication to WebSocket
communication. This program is part of all Netdata installations, so by installing Netdata on your personal computer (Linux, MacOS, Windows) you will have it available.
There may be different paths for it, depending on how you installed Netdata:
/usr/bin/nd-mcp
: Linux native packages/opt/netdata/usr/bin/nd-mcp
: Linux static Netdata installations/usr/local/netdata/usr/bin/nd-mcp
: MacOS installations from sourceC:\\Program Files\\Netdata\\usr\\bin\\nd-mcp.exe
: Windows installationsYou will also need:
IP_OF_YOUR_NETDATA
, is the IP address or hostname of the Netdata instance you want to connect to. This will eventually be replaced by the Netdata Cloud URL. For this dev preview, use any Netdata, preferably one of your parent nodes. Remember that the AI assistant will "see" only the nodes that are connected to that Netdata instance.
YOUR_API_KEY
is the API key that allows the AI assistant to access sensitive functions like logs and live system information. Just start Netdata and it will automatically generate a random UUID for you. You can find it at:
/var/lib/netdata/mcp_dev_preview_api_key
or, if you installed a static Netdata package, it may be located at:
/opt/netdata/var/lib/netdata/mcp_dev_preview_api_key
To view your API key:
sudo cat /var/lib/netdata/mcp_dev_preview_api_key
or
sudo cat /opt/netdata/var/lib/netdata/mcp_dev_preview_api_key
To add Netdata MCP to Claude Desktop:
Linux Users: Claude Desktop is available via a community project (https://github.com/fsoft72/claude-desktop-to-appimage). It works best with https://github.com/TheAssassin/AppImageLauncher.
Once configured correctly, you will need to restart Claude Desktop. Once restarted, you should see "netdata" appear in Claude Desktop:
For Claude Code, add to your project's root, the file .mcp.json
, with the contents given above. This file will be automatically detected by Claude Code the next time it starts in that directory.
Once configured correctly, issue the command /mcp
to your Claude Code. It should show you the available MCP servers, including "netdata".
For Cursor, add the configuration to the MCP settings.
stdio
to websocket
BridgesWe provide 3 different bridges for you to choose the one that best fits your environment:
src/web/mcp/bridges/stdio-golang/
src/web/mcp/bridges/stdio-nodejs/
src/web/mcp/bridges/stdio-python/
All these bridges should provide exactly the same functionality, so you can choose the one that best fits your environment.
Each of these directories includes build.sh
script to install dependencies and prepare the bridge.
The Go bridge provides also a build.bat
script for Windows users.
The MCP integration provides AI assistants with access to:
The integration provides access to all metrics categories collected by Netdata including:
Once configured, you can ask questions like:
Q: Can I use MCP with other AI assistants?
Q: Do I need to run a bridge on my local machine?
A: Yes, the bridge converts stdio
communication to WebSocket
for remote access to Netdata. The bridge is run on your local machine (personal computer) to connect to the Netdata instance.
Q: How do I find my API key?
/var/lib/netdata/mcp_dev_preview_api_key
or /opt/netdata/var/lib/netdata/mcp_dev_preview_api_key
on the Netdata Agent you will connect to. Use sudo cat
to view it.Q: Can I use MCP with Netdata Cloud?
Q: What data can I access with MCP?
Q: Can I use MCP with my existing Netdata installation?
Q: Is MCP secure?
Q: Will my observability data be exposed to AI companies?
Q: Are the responses of AI assistants accurate?
Sometimes, when you ask generic questions about your infrastructure, AI assistants do a simple sampling on a few nodes of the infrastructure, instead of querying all nodes. In Netdata we have provided the tools to properly do that, but AI assistants may not use them.
Examples:
Q: "which are the top processes/containers/VMs/services running on my servers?"
The AI assistant may respond with a list of processes/containers/VMs/services from a few nodes, instead of querying all nodes.
The proper way in Netdata is to query:
app.*
charts/contexts for processes
, which will return the processes running on all nodes grouped by category.systemd.*
to get the services running on all nodes.cgroup.*
to get the all the containers and VMs on all nodes.For all such queries, Netdata responses return cardinality information (much like the NIDL charts on your Netdata dashboard), so the AI assistant could get a much better picture instead of sampling data. When you notice that, you could ask the AI assistant to find the answer using more generic queries.
Sometimes you ask AI assistants about features that have been recently added to Netdata (eg logs, or windows capabilities), and the AI assistant instead of checking what is available via their MCP connection, they say that Netdata does not support that feature. Answering "check your MCP tools, features, functions" is usually enough for the AI assistant to check the available features and start using them.
Sometimes you need instruct them to use their MCP connection. So instead of saying "check the performance of my production db", you can say "use netdata to check the performance of my production db". This way, the AI assistant will use its MCP connection to query the Netdata instance and provide you with the relevant information.
Our advice is to use AI assistants to do "your laundry": Give them specific tasks, check the queries they did to get that information, and when possible ask them to cross-check their answers using a different tool/source. AI assistants usually rush to make conclusions, so challenge them and they will go deeper and correct themselves. Remember that you always need to verify their answers, especially for critical tasks.
If you need to configure multiple MCP servers, you can add them under the mcpServers
section with different names. Example:
{ "mcpServers": { "netdata-production": { "command": "/usr/bin/nd-mcp", "args": [ "ws://IP_OF_YOUR_NETDATA:19999/mcp?api_key=YOUR_API_KEY" ] }, "netdata-testing": { "command": "/usr/bin/nd-mcp", "args": [ "ws://IP_OF_YOUR_NETDATA:19999/mcp?api_key=YOUR_API_KEY" ] } } }
However, when multiple netdata MCP servers are configured, all AI assistants have difficulties to determine which one to use:
.mcp.json
file in each project directory (the current directory from which you run it), so you can have different configurations for each project/directory. Since Claude Code also supports a Claude.md
file with default instructions to the AI assistant, you can have different directories with different instructions and configurations, so you can use multiple Netdata MCP servers by spawning multiple Claude Code instances in different directories.For more information about Netdata, visit netdata.cloud