docs/netdata-ai/mcp/mcp-clients/gemini-cli.md
Configure Google's Gemini CLI to access your Netdata infrastructure through MCP for powerful AI-driven operations.
Gemini CLI supports all major MCP transport types, giving you maximum flexibility:
| Transport | Support | Netdata Version | Use Case |
|---|---|---|---|
| stdio (via nd-mcp bridge) | ✅ Fully Supported | v2.6.0+ | Local bridge to WebSocket |
| Streamable HTTP | ✅ Fully Supported | v2.7.2+ | Direct connection to Netdata's HTTP endpoint (recommended) |
| SSE (Server-Sent Events) | ✅ Fully Supported | v2.7.2+ | Direct connection to Netdata's SSE endpoint |
| WebSocket | ❌ Not Supported | - | Use nd-mcp bridge or HTTP/SSE instead |
nd-mcp bridgend-mcp bridge - The stdio-to-websocket bridge. Find its absolute path. Not needed for direct HTTP/SSE connections on v2.7.2+.[web].bearer token protection = yes. When bearer protection is disabled, it is optional and unlocks sensitive observability data (protected functions, full access to logs). Each Netdata Agent or Parent has its own unique MCP API key - Find your Netdata MCP API key# Run Gemini CLI directly from GitHub
npx https://github.com/google-gemini/gemini-cli
# Or clone and install locally
git clone https://github.com/google-gemini/gemini-cli.git
cd gemini-cli
npm install
npm run build
Gemini CLI has built-in MCP server support. For detailed MCP configuration, see the official MCP documentation.
Connect to your entire Netdata Cloud infrastructure through a single endpoint — no local setup, bridges, or firewall changes needed.
Prerequisites:
scope:mcp
(create one)# Using CLI command
gemini mcp add --transport http netdata-cloud https://app.netdata.cloud/api/v1/mcp \
--header "Authorization: Bearer YOUR_NETDATA_CLOUD_API_TOKEN"
Or configure in ~/.gemini/settings.json:
{
"mcpServers": {
"netdata-cloud": {
"httpUrl": "https://app.netdata.cloud/api/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_NETDATA_CLOUD_API_TOKEN"
},
"timeout": 30000
}
}
}
Replace YOUR_NETDATA_CLOUD_API_TOKEN with your
Netdata Cloud API token (must have scope:mcp).
For more details, see
Netdata Cloud MCP.
The following methods connect directly to a Netdata Agent or Parent on your network.
Connect directly to Netdata's HTTP endpoint without needing any bridge:
# Using CLI command
gemini mcp add --transport http netdata http://YOUR_NETDATA_IP:19999/mcp \
--header "Authorization: Bearer NETDATA_MCP_API_KEY"
# For HTTPS connections
gemini mcp add --transport http netdata https://YOUR_NETDATA_IP:19999/mcp \
--header "Authorization: Bearer NETDATA_MCP_API_KEY"
Or configure in ~/.gemini/settings.json:
{
"mcpServers": {
"netdata": {
"httpUrl": "http://YOUR_NETDATA_IP:19999/mcp",
"headers": [
"Authorization: Bearer NETDATA_MCP_API_KEY"
],
"timeout": 30000
}
}
}
Connect directly to Netdata's SSE endpoint:
# Using CLI command
gemini mcp add --transport sse netdata http://YOUR_NETDATA_IP:19999/mcp?transport=sse \
--header "Authorization: Bearer NETDATA_MCP_API_KEY"
Or configure in ~/.gemini/settings.json:
{
"mcpServers": {
"netdata": {
"url": "http://YOUR_NETDATA_IP:19999/mcp?transport=sse",
"headers": [
"Authorization: Bearer NETDATA_MCP_API_KEY"
],
"timeout": 30000
}
}
}
For environments where you prefer or need to use the bridge:
# Using CLI command
gemini mcp add netdata /usr/sbin/nd-mcp --bearer NETDATA_MCP_API_KEY \
ws://YOUR_NETDATA_IP:19999/mcp
Or configure in ~/.gemini/settings.json:
{
"mcpServers": {
"netdata": {
"command": "/usr/sbin/nd-mcp",
"args": [
"--bearer",
"NETDATA_MCP_API_KEY",
"ws://YOUR_NETDATA_IP:19999/mcp"
],
"timeout": 30000
}
}
}
If nd-mcp is not available, use the official MCP remote client (requires Netdata v2.7.2+). For detailed options and troubleshooting, see Using MCP Remote Client.
# Using CLI command with SSE
gemini mcp add netdata npx mcp-remote@latest \
--sse http://YOUR_NETDATA_IP:19999/mcp \
--allow-http \
--header "Authorization: Bearer NETDATA_MCP_API_KEY"
# Using HTTP transport
gemini mcp add netdata npx mcp-remote@latest \
--http http://YOUR_NETDATA_IP:19999/mcp \
--allow-http \
--header "Authorization: Bearer NETDATA_MCP_API_KEY"
Or configure in ~/.gemini/settings.json:
{
"mcpServers": {
"netdata": {
"command": "npx",
"args": [
"mcp-remote@latest",
"--sse",
"http://YOUR_NETDATA_IP:19999/mcp",
"--allow-http",
"--header",
"Authorization: Bearer NETDATA_MCP_API_KEY",
]
}
}
}
Gemini CLI supports environment variable expansion in settings.json:
$VAR_NAME or ${VAR_NAME} - Expands to the value of environment variableExample configuration with environment variables:
{
"mcpServers": {
"netdata": {
"httpUrl": "http://${NETDATA_HOST}:19999/mcp",
"headers": [
"Authorization: Bearer ${NETDATA_API_KEY}"
]
}
}
}
Use these commands to verify your setup:
# List all configured MCP servers
gemini mcp list
# Interactive MCP status (within Gemini session)
/mcp
# Show detailed descriptions of MCP servers and tools
/mcp desc
# Show MCP server schema details
/mcp schema
Replace in all examples:
YOUR_NETDATA_IP - IP address or hostname of your Netdata Agent/ParentNETDATA_MCP_API_KEY - Your Netdata MCP API key/usr/sbin/nd-mcp - With your actual nd-mcp path (stdio method only)Gemini CLI can leverage Netdata's observability data for infrastructure analysis and automation:
What's the current system performance across all monitored servers?
Show me any performance anomalies in the last 2 hours
Which services are consuming the most resources right now?
Analyze the database performance trends over the past week
Performance Investigation:
Investigate why our application response times increased this afternoon
Resource Optimization:
Check memory usage patterns and suggest optimization strategies
Alert Analysis:
Explain the current active alerts and their potential impact
💡 Advanced Usage: Gemini CLI can combine observability data with system automation for powerful DevOps workflows. Learn about the opportunities and security considerations in AI DevOps Copilot.
curl http://YOUR_NETDATA_IP:19999/api/v3/infoConfigure different Netdata instances for different purposes:
{
"mcpServers": {
"netdata-prod": {
"httpUrl": "https://prod-parent.company.com:19999/mcp",
"headers": [
"Authorization: Bearer ${PROD_API_KEY}"
]
},
"netdata-staging": {
"httpUrl": "https://staging-parent.company.com:19999/mcp",
"headers": [
"Authorization: Bearer ${STAGING_API_KEY}"
]
},
"netdata-local": {
"command": "/usr/sbin/nd-mcp",
"args": [
"--bearer",
"${LOCAL_API_KEY}",
"ws://localhost:19999/mcp"
]
}
}
}
Control which Netdata tools are available:
{
"mcpServers": {
"netdata": {
"httpUrl": "http://YOUR_NETDATA_IP:19999/mcp",
"headers": [
"Authorization: Bearer NETDATA_MCP_API_KEY"
],
"includeTools": ["query_metrics", "list_alerts", "list_nodes"],
"excludeTools": ["execute_function", "systemd_journal"]
}
}
}