master
md 406 lines 10.6 KB
Rendered Raw
1 # VS Code
2
3 Configure Visual Studio Code extensions to access your Netdata infrastructure through MCP.
4
5 ## Available Extensions
6
7 ### Continue (Recommended)
8
9 The most popular open-source AI code assistant with MCP support.
10
11 ### Cline
12
13 Autonomous coding agent that can use MCP tools.
14
15 ## Transport Support
16
17 VS Code extensions typically support stdio-based MCP servers:
18
19 | Transport | Support | Netdata Version | Use Case |
20 |-----------|---------|-----------------|----------|
21 | **stdio** (via nd-mcp bridge) | ✅ Fully Supported | v2.6.0+ | Local bridge to WebSocket |
22 | **stdio** (via npx mcp-remote) | ✅ Fully Supported | v2.7.2+ | Alternative bridge with HTTP/SSE support |
23 | **Streamable HTTP** | ⚠️ Varies by Extension | v2.7.2+ | Check extension documentation |
24 | **SSE** (Server-Sent Events) | ⚠️ Varies by Extension | v2.7.2+ | Check extension documentation |
25 | **WebSocket** | ❌ Not Supported | - | Use nd-mcp bridge |
26
27 > **Note:** Most VS Code extensions support stdio-based MCP servers. For HTTP/SSE connections to Netdata v2.7.2+, you can use npx mcp-remote bridge. For older Netdata versions (v2.6.0 - v2.7.1), use the nd-mcp bridge with WebSocket.
28
29 ## Prerequisites
30
31 1. **VS Code installed** - [Download VS Code](https://code.visualstudio.com)
32 2. **MCP-compatible extension** - Install from VS Code Marketplace
33 3. **Netdata v2.6.0 or later** with MCP support - Prefer a Netdata Parent to get infrastructure level visibility. Your AI Client (running on your desktop or laptop) needs to have direct network access to the Netdata IP and port (usually 19999).
34 - **v2.6.0 - v2.7.1**: Only WebSocket transport available, requires `nd-mcp` bridge
35 - **v2.7.2+**: Can use `npx mcp-remote` bridge for HTTP/SSE support
36 4. **Bridge required: Choose one:**
37 - `nd-mcp` bridge - The stdio-to-websocket bridge for all Netdata versions. [Find its absolute path](/docs/netdata-ai/mcp/README.md#finding-the-nd-mcp-bridge)
38 - `npx mcp-remote@latest` - Official MCP remote client supporting HTTP/SSE (requires Netdata v2.7.2+)
39 5. **Netdata MCP API key exported before launching VS Code** - keep secrets out of config files by setting:
40 ```bash
41 export ND_MCP_BEARER_TOKEN="$(cat /var/lib/netdata/mcp_dev_preview_api_key)"
42 ```
43 Each Netdata Agent or Parent has its own unique API key for MCP - [Find your Netdata MCP API key](/docs/netdata-ai/mcp/README.md#finding-your-api-key)
44
45 ## Netdata Cloud MCP
46
47 Connect to your entire Netdata Cloud infrastructure
48 through a single endpoint — no local setup, bridges,
49 or firewall changes needed.
50
51 **Prerequisites:**
52
53 - Netdata Cloud account with a Paid plan
54 - Nodes claimed to Netdata Cloud
55 - API token with `scope:mcp`
56 ([create one](/docs/netdata-cloud/authentication-and-authorization/api-tokens.md))
57
58 ### Continue Extension
59
60 Add to `.continue/mcpServers/netdata-cloud.yaml`:
61
62 ```yaml
63 name: Netdata Cloud
64 version: 0.0.1
65 schema: v1
66 mcpServers:
67 - name: netdata-cloud
68 type: streamable-http
69 url: https://app.netdata.cloud/api/v1/mcp
70 requestOptions:
71 headers:
72 Authorization: Bearer YOUR_NETDATA_CLOUD_API_TOKEN
73 ```
74
75 ### Cline Extension
76
77 Cline only supports stdio and SSE transports.
78 Since Netdata Cloud MCP uses Streamable HTTP,
79 you need the `mcp-remote` bridge to convert
80 stdio to HTTP:
81
82 ```json
83 {
84 "mcpServers": {
85 "netdata-cloud": {
86 "command": "npx",
87 "args": [
88 "mcp-remote@latest",
89 "https://app.netdata.cloud/api/v1/mcp",
90 "--header",
91 "Authorization: Bearer YOUR_NETDATA_CLOUD_API_TOKEN"
92 ],
93 "alwaysAllow": [],
94 "disabled": false
95 }
96 }
97 }
98 ```
99
100 Replace `YOUR_NETDATA_CLOUD_API_TOKEN` with your
101 Netdata Cloud API token (must have `scope:mcp`).
102 For more details, see
103 [Netdata Cloud MCP](/docs/netdata-ai/mcp/README.md#netdata-cloud-mcp).
104
105 ## Local Agent or Parent
106
107 The following methods connect directly to a Netdata Agent or Parent on your network.
108
109 ### Continue Extension
110
111 #### Installation
112
113 1. Open VS Code
114 2. Go to Extensions (Ctrl+Shift+X)
115 3. Search for "Continue"
116 4. Install the Continue extension
117 5. Reload VS Code
118
119 #### Configuration
120
121 ##### Step 1: Add Claude Model
122
123 1. Click "**Select model**" dropdown at the bottom (next to Chat dropdown)
124 2. Click "**+ Add Chat model**"
125 3. In the configuration screen:
126 - **Provider**: Change to "Anthropic"
127 - **Model**: Select `Claude-3.5-Sonnet`
128 - **API key**: Enter your Anthropic API key
129 - Click "**Connect**"
130
131 ##### Step 2: Add Netdata MCP Server
132
133 Continue stores MCP definitions as YAML or JSON blocks. The recommended flow is:
134
135 1. Click "**MCP**" in the Continue toolbar
136 2. Click "**+ Add MCP Servers**" to scaffold `.continue/mcpServers/<name>.yaml`
137 3. Replace the contents with one of the configurations below
138
139 > Continue's reference guide documents the `type`
140 > field (`stdio`, `sse`, or `streamable-http`)
141 > and block syntax
142 > (https://docs.continue.dev/customize/deep-dives/mcp).
143
144 **Method 1: stdio launcher (all Netdata versions)**
145
146 ```yaml
147 name: Netdata (nd-mcp)
148 version: 0.0.1
149 schema: v1
150 mcpServers:
151 - name: netdata
152 type: stdio
153 command: /usr/sbin/nd-mcp
154 args:
155 - ws://YOUR_NETDATA_IP:19999/mcp
156 ```
157
158 Export `ND_MCP_BEARER_TOKEN` before launching Continue so `nd-mcp` can authenticate without embedding secrets in YAML.
159
160 **Method 2: Direct SSE (Netdata v2.7.2+)**
161
162 ```yaml
163 name: Netdata (SSE)
164 version: 0.0.1
165 schema: v1
166 mcpServers:
167 - name: netdata
168 type: sse
169 url: https://YOUR_NETDATA_IP:19999/mcp
170 requestOptions:
171 headers:
172 Authorization: Bearer ${NETDATA_MCP_API_KEY}
173 ```
174
175 **Method 3: Streamable HTTP (Netdata v2.7.2+)**
176
177 ```yaml
178 name: Netdata (HTTP)
179 version: 0.0.1
180 schema: v1
181 mcpServers:
182 - name: netdata
183 type: streamable-http
184 url: https://YOUR_NETDATA_IP:19999/mcp
185 requestOptions:
186 headers:
187 Authorization: Bearer ${NETDATA_MCP_API_KEY}
188 ```
189
190 Continue expands environment placeholders such as `${NETDATA_MCP_API_KEY}` so you can keep API keys out of source control. After saving, reload the window to pick up the new server.
191
192 #### Usage
193
194 Press `Ctrl+L` to open Continue chat, then:
195
196 ```
197 @netdata what's the current CPU usage?
198 @netdata show me memory trends for the last hour
199 @netdata are there any anomalies in the database servers?
200 ```
201
202 ### Cline Extension
203
204 #### Installation
205
206 1. Search for "Cline" in Extensions
207 2. Install and reload VS Code
208
209 #### Configuration
210
211 Cline's official docs describe two workflows
212 (<https://docs.cline.bot/mcp/configuring-mcp-servers>):
213
214 - **UI configuration** – Click the MCP Servers icon → Configure tab → add/update servers, restart, toggle, and set timeouts.
215 - **JSON configuration** – Click **Configure MCP Servers** to open `cline_mcp_settings.json` and edit the underlying JSON.
216
217 ##### JSON examples
218
219 **Stdio (`nd-mcp`)**
220
221 ```json
222 {
223 "mcpServers": {
224 "netdata": {
225 "command": "/usr/sbin/nd-mcp",
226 "args": [
227 "ws://YOUR_NETDATA_IP:19999/mcp"
228 ],
229 "alwaysAllow": [],
230 "disabled": false
231 }
232 }
233 }
234 ```
235
236 **SSE for Netdata v2.7.2+**
237
238 ```json
239 {
240 "mcpServers": {
241 "netdata": {
242 "url": "https://YOUR_NETDATA_IP:19999/mcp",
243 "headers": {
244 "Authorization": "Bearer NETDATA_MCP_API_KEY"
245 },
246 "alwaysAllow": [],
247 "disabled": false
248 }
249 }
250 }
251 ```
252
253 > Optional fields such as `networkTimeout`,
254 > `alwaysAllow`, and `env` map directly to
255 > Cline's UI controls. SSE and stdio are the
256 > two transports Cline supports today; pick
257 > the one that matches your Netdata deployment.
258
259 #### Usage
260
261 1. Open Cline (Ctrl+Shift+P → "Cline: Open Chat")
262 2. Cline can autonomously:
263 - Analyze performance issues
264 - Create monitoring scripts
265 - Debug based on metrics
266
267 Example:
268
269 ```
270 Create a Python script that checks Netdata for high CPU usage and sends an alert
271 ```
272
273 ## Multiple Environments
274
275 ### Workspace-Specific Configuration
276
277 Create a YAML file in your project's `.continue/mcpServers/` directory (e.g., `netdata-prod.yaml`):
278
279 ```yaml
280 name: Netdata Production
281 version: 0.0.1
282 schema: v1
283 mcpServers:
284 - name: netdata-prod
285 type: stdio
286 command: /usr/sbin/nd-mcp
287 args:
288 - ws://prod-parent:19999/mcp
289 ```
290
291 ### Environment Switching
292
293 Different projects can have different Netdata connections:
294
295 - `~/projects/frontend/.continue/mcpServers/netdata.yaml` → Frontend servers
296 - `~/projects/backend/.continue/mcpServers/netdata.yaml` → Backend servers
297 - `~/projects/infrastructure/.continue/mcpServers/netdata.yaml` → All servers
298
299 > ℹ️ Export `ND_MCP_BEARER_TOKEN` with the appropriate key before opening VS Code so the bridge picks up credentials without storing them in the YAML files.
300
301 ## Advanced Usage
302
303 ### Custom Commands
304
305 Create custom VS Code commands that query Netdata:
306
307 ```json
308 {
309 "commands": [
310 {
311 "command": "netdata.checkHealth",
312 "title": "Netdata: Check System Health"
313 }
314 ]
315 }
316 ```
317
318 ### Task Integration
319
320 Add Netdata checks to tasks.json:
321
322 ```json
323 {
324 "version": "2.0.0",
325 "tasks": [
326 {
327 "label": "Check Production Metrics",
328 "type": "shell",
329 "command": "continue",
330 "args": [
331 "--ask",
332 "@netdata show current system status"
333 ]
334 }
335 ]
336 }
337 ```
338
339 ### Snippets with Metrics
340
341 Create snippets that include metric checks:
342
343 ```json
344 {
345 "Check Performance": {
346 "prefix": "perf",
347 "body": [
348 "// @netdata: Current ${1:CPU} usage?",
349 "$0"
350 ]
351 }
352 }
353 ```
354
355 ## Extension Comparison
356
357 | Feature | Continue | Cline | Codeium | Copilot Chat |
358 |--------------------|----------|--------|---------|--------------|
359 | MCP Support | ✅ Full | ✅ Full | ❓ Check | ❓ Future |
360 | Autonomous Actions | ❌ | ✅ | ❌ | ❌ |
361 | Multiple Models | ✅ | ✅ | ❌ | ❌ |
362 | Free Tier | ❌ | ❌ | ✅ | ❌ |
363 | Open Source | ✅ | ✅ | ❌ | ❌ |
364
365 ## Troubleshooting
366
367 ### Extension Not Finding MCP
368
369 - Restart VS Code after configuration
370 - Check extension logs (Output → Continue/Cline)
371 - Verify JSON syntax in settings
372
373 ### Connection Issues
374
375 - Test Netdata: `curl http://YOUR_NETDATA_IP:19999/api/v3/info`
376 - Check bridge is executable
377 - Verify network access from VS Code
378
379 ### No Netdata Option
380
381 - Ensure `@netdata` is typed correctly
382 - Check MCP server is configured
383 - Try reloading the window (Ctrl+R)
384
385 ### Performance Problems
386
387 - Use local Netdata Parent for faster response
388 - Check extension memory usage
389 - Disable unused extensions
390
391 ## Best Practices
392
393 ### Development Workflow
394
395 1. Start coding with infrastructure context
396 2. Check metrics before optimization
397 3. Validate changes against production data
398 4. Monitor impact of deployments
399
400 ### Team Collaboration
401
402 Share Netdata configurations:
403
404 - Commit `.vscode/settings.json` for project-specific configs
405 - Document which Netdata Parent to use
406 - Create team snippets for common queries