You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add support for https when using streamable-http transport (#270)
mcp-go v0.39.0 adds support for https when using the streamable-http
transport. This commit adds support for configuring the server to
serve https using custom certificates via the CLI.
Fixes#244.
**Server TLS Configuration (streamable-http transport only):**
236
+
-`--server.tls-cert-file`: Path to TLS certificate file for server HTTPS
237
+
-`--server.tls-key-file`: Path to TLS private key file for server HTTPS
238
+
200
239
## Usage
201
240
202
241
This MCP server works with both local Grafana instances and Grafana Cloud. For Grafana Cloud, use your instance URL (e.g., `https://myinstance.grafana.net`) instead of `http://localhost:3000` in the configuration examples below.
@@ -235,6 +274,21 @@ This MCP server works with both local Grafana instances and Grafana Cloud. For G
235
274
docker run --rm -p 8000:8000 -e GRAFANA_URL=http://localhost:3000 -e GRAFANA_API_KEY=<your service account token> mcp/grafana -t streamable-http
236
275
```
237
276
277
+
For HTTPS streamable HTTP mode with server TLS certificates:
278
+
279
+
```bash
280
+
docker pull mcp/grafana
281
+
docker run --rm -p 8443:8443 \
282
+
-v /path/to/certs:/certs:ro \
283
+
-e GRAFANA_URL=http://localhost:3000 \
284
+
-e GRAFANA_API_KEY=<your service account token> \
285
+
mcp/grafana \
286
+
-t streamable-http \
287
+
-addr :8443 \
288
+
--server.tls-cert-file /certs/server.crt \
289
+
--server.tls-key-file /certs/server.key
290
+
```
291
+
238
292
- **Download binary**: Download the latest release of `mcp-grafana` from the [releases page](https://github.com/grafana/mcp-grafana/releases) and place it in your `$PATH`.
239
293
240
294
- **Build from source**: If you have a Go toolchain installed you can also build and install it from source, using the `GOBIN` environment variable
@@ -324,6 +378,19 @@ If you're using VSCode and running the MCP server in SSE mode (which is the defa
324
378
}
325
379
```
326
380
381
+
For HTTPS streamable HTTP mode with server TLS certificates:
382
+
383
+
```json
384
+
"mcp": {
385
+
"servers": {
386
+
"grafana": {
387
+
"type": "sse",
388
+
"url": "https://localhost:8443/sse"
389
+
}
390
+
}
391
+
}
392
+
```
393
+
327
394
### Debug Mode
328
395
329
396
You can enable debug mode for the Grafana transport by adding the `-debug` flag to the command. This will provide detailed logging of HTTP requests and responses between the MCP server and the Grafana API, which can be helpful for troubleshooting.
### Server TLS Configuration (Streamable HTTP Transport Only)
581
+
582
+
When using the streamable HTTP transport (`-t streamable-http`), you can configure the MCP server to serve HTTPS instead of HTTP. This is useful when you need to secure the connection between your MCP client and the server itself.
583
+
584
+
The server supports the following TLS configuration options for the streamable HTTP transport:
585
+
586
+
- `--server.tls-cert-file`: Path to TLS certificate file for server HTTPS (required for TLS)
587
+
- `--server.tls-key-file`: Path to TLS private key file for server HTTPS (required for TLS)
588
+
589
+
**Note**: These flags are completely separate from the client TLS flags documented above. The client TLS flags configure how the MCP server connects to Grafana, while these server TLS flags configure how clients connect to the MCP server when using streamable HTTP transport.
590
+
591
+
**Example with HTTPS streamable HTTP server:**
592
+
593
+
```bash
594
+
./mcp-grafana \
595
+
-t streamable-http \
596
+
--server.tls-cert-file /path/to/server.crt \
597
+
--server.tls-key-file /path/to/server.key \
598
+
-addr :8443
599
+
```
600
+
601
+
This would start the MCP server on HTTPS port 8443. Clients would then connect to `https://localhost:8443/` instead of `http://localhost:8000/`.
0 commit comments