Hi,
Has anyone tried to put grafana mcp behind nginx? I cannot connect to it through nginx (waiting for initialization). Works fine without nginx. The idea is to forward traffic to correct mcp based on org name.
Thanks in advance.
what does your ngnix config look like? are you using docker?
Hi
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-mcp-nginx-config
namespace: monitoring
data:
default.conf: |
server {
listen 8080;
# Health check
location /health {
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# Regular requests to main tribe
location /main {
proxy_pass <http://grafana-mcp-main:8000>;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# SSE streaming endpoint for main tribe
location /main/sse {
proxy_pass <http://grafana-mcp-main:8000/sse>;
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection "";
proxy_buffering off;
proxy_request_buffering off;
proxy_cache off;
proxy_read_timeout 86400;
proxy_max_temp_file_size 0;
}
# Default route - return 404 for unknown paths
location / {
return 404 "Tribe not found. Available tribes:main\n";
add_header Content-Type text/plain;
}
}```
main is a tribe name, more to be added.
```image: "nginx:1.25-alpine"```
VScode config:
```{
"servers": {
"mcp-dev-grafana": {
"type": "sse",
"url": "<https://grafana-mcp.my-domain/main/sse>",
}
}
}```
we checked tcp dumps today and saw that it tries to send POST request, which is not allowed. Then it does GET request. Then mcp gives OK reply ad connection is established. It sends data in chunks, and we saw that at some point nginx resets the connection and does not allow for OK reply to pass
so i see this in VScode:
[info] Waiting for server to respond to `initialize` request...
tried different fields in nginx config but none have helped
yeah, can’t seem to get it spinning
Something to do with nginx config, tried different options, but eesirl is the same
My other solution would be creating several dns records, but not ideal solution for me
what would you suggest or is there any chance that this will be addressed?