Skip to content

Commit 927323a

Browse files
authored
fix: default listening host to all interfaces for container compatibility (#69)
When running inside a container, binding to `localhost` only accepts connections from within the container itself. Traffic from port forwarding arrives via the bridge network interface, not loopback, causing connection resets. Changing the default to bind on all interfaces (`:port`) ensures the server is reachable out of the box in containerized deployments, with dual-stack IPv4/IPv6 support. Users can set `SYSDIG_MCP_LISTENING_HOST=127.0.0.1` for local-only access.
1 parent a2f243d commit 927323a

File tree

7 files changed

+21
-23
lines changed

7 files changed

+21
-23
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ You can also set the following variables to override the default configuration:
212212
- `SYSDIG_MCP_MOUNT_PATH`: The URL prefix for the streamable-http/sse deployment. Defaults to: `/sysdig-mcp-server`
213213
- `SYSDIG_MCP_LOGLEVEL`: Log Level of the application (`DEBUG`, `INFO`, `WARNING`, `ERROR`). Defaults to: `INFO`
214214
- `SYSDIG_MCP_LISTENING_PORT`: The port for the server when it is deployed using remote protocols (`streamable-http`, `sse`). Defaults to: `8080`
215-
- `SYSDIG_MCP_LISTENING_HOST`: The host for the server when it is deployed using remote protocols (`streamable-http`, `sse`). Defaults to: `localhost`
215+
- `SYSDIG_MCP_LISTENING_HOST`: The host for the server when it is deployed using remote protocols (`streamable-http`, `sse`). Defaults to all interfaces (`:port`). Set to `127.0.0.1` for local-only access.
216216

217217
You can find your API token in the Sysdig Secure UI under **Settings > Sysdig Secure API**. Make sure to copy the token as it will not be shown again.
218218

@@ -242,7 +242,7 @@ SYSDIG_MCP_TRANSPORT=streamable-http
242242
# SYSDIG_MCP_API_HOST=https://us2.app.sysdig.com
243243
# SYSDIG_MCP_API_TOKEN=your-api-token-here
244244
SYSDIG_MCP_LISTENING_PORT=8080
245-
SYSDIG_MCP_LISTENING_HOST=localhost
245+
SYSDIG_MCP_LISTENING_HOST=
246246
SYSDIG_MCP_MOUNT_PATH=/sysdig-mcp-server
247247
```
248248

@@ -354,8 +354,6 @@ spec:
354354
env:
355355
- name: SYSDIG_MCP_TRANSPORT
356356
value: "streamable-http"
357-
- name: SYSDIG_MCP_LISTENING_HOST
358-
value: "0.0.0.0"
359357
envFrom:
360358
- secretRef:
361359
name: mcp-server-secrets

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/sysdiglabs/sysdig-mcp-server
33
go 1.26.0
44

55
require (
6-
github.com/mark3labs/mcp-go v0.44.0
7-
github.com/oapi-codegen/runtime v1.1.2
6+
github.com/mark3labs/mcp-go v0.44.1
7+
github.com/oapi-codegen/runtime v1.2.0
88
github.com/onsi/ginkgo/v2 v2.28.1
99
github.com/onsi/gomega v1.39.1
1010
github.com/spf13/cobra v1.10.2
@@ -20,7 +20,7 @@ require (
2020
github.com/go-logr/logr v1.4.3 // indirect
2121
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
2222
github.com/google/go-cmp v0.7.0 // indirect
23-
github.com/google/pprof v0.0.0-20260202012954-cb029daf43ef // indirect
23+
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc // indirect
2424
github.com/google/uuid v1.6.0 // indirect
2525
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2626
github.com/invopop/jsonschema v0.13.0 // indirect
@@ -32,7 +32,7 @@ require (
3232
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
3333
go.yaml.in/yaml/v3 v3.0.4 // indirect
3434
golang.org/x/mod v0.33.0 // indirect
35-
golang.org/x/net v0.50.0 // indirect
35+
golang.org/x/net v0.51.0 // indirect
3636
golang.org/x/sync v0.19.0 // indirect
3737
golang.org/x/sys v0.41.0 // indirect
3838
golang.org/x/text v0.34.0 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
2828
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
2929
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
3030
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
31-
github.com/google/pprof v0.0.0-20260202012954-cb029daf43ef h1:xpF9fUHpoIrrjX24DURVKiwHcFpw19ndIs+FwTSMbno=
32-
github.com/google/pprof v0.0.0-20260202012954-cb029daf43ef/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
31+
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc h1:VBbFa1lDYWEeV5FZKUiYKYT0VxCp9twUmmaq9eb8sXw=
32+
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
3333
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
3434
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
3535
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@@ -45,14 +45,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
4545
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
4646
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
4747
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
48-
github.com/mark3labs/mcp-go v0.44.0 h1:OlYfcVviAnwNN40QZUrrzU0QZjq3En7rCU5X09a/B7I=
49-
github.com/mark3labs/mcp-go v0.44.0/go.mod h1:YnJfOL382MIWDx1kMY+2zsRHU/q78dBg9aFb8W6Thdw=
48+
github.com/mark3labs/mcp-go v0.44.1 h1:2PKppYlT9X2fXnE8SNYQLAX4hNjfPB0oNLqQVcN6mE8=
49+
github.com/mark3labs/mcp-go v0.44.1/go.mod h1:YnJfOL382MIWDx1kMY+2zsRHU/q78dBg9aFb8W6Thdw=
5050
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
5151
github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg=
5252
github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE=
5353
github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A=
54-
github.com/oapi-codegen/runtime v1.1.2 h1:P2+CubHq8fO4Q6fV1tqDBZHCwpVpvPg7oKiYzQgXIyI=
55-
github.com/oapi-codegen/runtime v1.1.2/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg=
54+
github.com/oapi-codegen/runtime v1.2.0 h1:RvKc1CVS1QeKSNzO97FBQbSMZyQ8s6rZd+LpmzwHMP4=
55+
github.com/oapi-codegen/runtime v1.2.0/go.mod h1:Y7ZhmmlE8ikZOmuHRRndiIm7nf3xcVv+YMweKgG1DT0=
5656
github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI=
5757
github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE=
5858
github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28=
@@ -92,8 +92,8 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
9292
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
9393
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
9494
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
95-
golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60=
96-
golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM=
95+
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
96+
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
9797
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
9898
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
9999
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Load() (*Config, error) {
3434
APIToken: getEnv("SYSDIG_MCP_API_TOKEN", ""),
3535
SkipTLSVerification: getEnv("SYSDIG_MCP_API_SKIP_TLS_VERIFICATION", false),
3636
Transport: getEnv("SYSDIG_MCP_TRANSPORT", "stdio"),
37-
ListeningHost: getEnv("SYSDIG_MCP_LISTENING_HOST", "localhost"),
37+
ListeningHost: getEnv("SYSDIG_MCP_LISTENING_HOST", ""),
3838
ListeningPort: getEnv("SYSDIG_MCP_LISTENING_PORT", "8080"),
3939
MountPath: getEnv("SYSDIG_MCP_MOUNT_PATH", "/sysdig-mcp-server"),
4040
LogLevel: getEnv("SYSDIG_MCP_LOGLEVEL", "INFO"),

internal/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var _ = Describe("Config", func() {
7878
cfg, err := config.Load()
7979
Expect(err).NotTo(HaveOccurred())
8080
Expect(cfg.Transport).To(Equal("stdio"))
81-
Expect(cfg.ListeningHost).To(Equal("localhost"))
81+
Expect(cfg.ListeningHost).To(BeEmpty())
8282
Expect(cfg.ListeningPort).To(Equal("8080"))
8383
Expect(cfg.MountPath).To(Equal("/sysdig-mcp-server"))
8484
Expect(cfg.LogLevel).To(Equal("INFO"))
@@ -96,7 +96,7 @@ var _ = Describe("Config", func() {
9696
cfg, err := config.Load()
9797
Expect(err).NotTo(HaveOccurred())
9898
Expect(cfg.Transport).To(Equal("streamable-http"))
99-
Expect(cfg.ListeningHost).To(Equal("localhost"))
99+
Expect(cfg.ListeningHost).To(BeEmpty())
100100
Expect(cfg.ListeningPort).To(Equal("8080"))
101101
Expect(cfg.MountPath).To(Equal("/sysdig-mcp-server"))
102102
Expect(cfg.LogLevel).To(Equal("INFO"))

package.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildGo126Module (finalAttrs: {
44
version = "1.0.3";
55
src = ./.;
66
# This hash is automatically re-calculated with `just rehash-package-nix`. This is automatically called as well by `just update`.
7-
vendorHash = "sha256-7UtPcgvKrpSIUGEgIOTH/BBG9PacBeVtSEsrfBtgWxs=";
7+
vendorHash = "sha256-IjVs+Mm9kV9pXoEOE3En2u+/jd/ITXZi0kp2+L92Mso=";
88

99
subPackages = [
1010
"cmd/server"

0 commit comments

Comments
 (0)