Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(minikube): authorize MongoDB MCP network binding

Alfredo Lopez8d6956520127
diff --git a/deploy/overlays/minikube/instances-e2e/mongodb-mcp-stack.yaml b/deploy/overlays/minikube/instances-e2e/mongodb-mcp-stack.yaml
index 87131bb86..b1cccfd5b 100644
--- a/deploy/overlays/minikube/instances-e2e/mongodb-mcp-stack.yaml
+++ b/deploy/overlays/minikube/instances-e2e/mongodb-mcp-stack.yaml
@@ -63,9 +63,13 @@ spec:
value: '0.0.0.0'
- name: MDB_MCP_HTTP_PORT
value: '3000'
- - name: MDB_MCP_HEALTH_CHECK_HOST
+ # This workload is intentionally served through a cluster Service and
+ # restricted by the generated NetworkPolicies.
+ - name: MDB_MCP_DANGEROUS_HOST_BINDING
+ value: 'true'
+ - name: MDB_MCP_MONITORING_SERVER_HOST
value: '0.0.0.0'
- - name: MDB_MCP_HEALTH_CHECK_PORT
+ - name: MDB_MCP_MONITORING_SERVER_PORT
value: '3001'
- name: MDB_MCP_READ_ONLY
value: 'false'
diff --git a/deploy/overlays/minikube/instances-e2e/mongodb-server.yaml b/deploy/overlays/minikube/instances-e2e/mongodb-server.yaml
index 1f6c54522..6cf5a32e8 100644
--- a/deploy/overlays/minikube/instances-e2e/mongodb-server.yaml
+++ b/deploy/overlays/minikube/instances-e2e/mongodb-server.yaml
@@ -19,8 +19,8 @@ spec:
transport: MDB_MCP_TRANSPORT
httpHost: MDB_MCP_HTTP_HOST
httpPort: MDB_MCP_HTTP_PORT
- healthCheckHost: MDB_MCP_HEALTH_CHECK_HOST
- healthCheckPort: MDB_MCP_HEALTH_CHECK_PORT
+ healthCheckHost: MDB_MCP_MONITORING_SERVER_HOST
+ healthCheckPort: MDB_MCP_MONITORING_SERVER_PORT
readOnly: MDB_MCP_READ_ONLY
loggers: MDB_MCP_LOGGERS
telemetry: MDB_MCP_TELEMETRY
@@ -35,6 +35,11 @@ spec:
readOnly: false
loggers: stderr
telemetry: disabled
+ env:
+ # This workload is intentionally served through a cluster Service and
+ # restricted by the reconciled NetworkPolicies.
+ - name: MDB_MCP_DANGEROUS_HOST_BINDING
+ value: 'true'
resources:
requests:
memory: "128Mi"
diff --git a/scripts/tests/test-minikube-t2-contract.sh b/scripts/tests/test-minikube-t2-contract.sh
index 332d09747..a500c4c26 100755
--- a/scripts/tests/test-minikube-t2-contract.sh
+++ b/scripts/tests/test-minikube-t2-contract.sh
@@ -769,4 +769,5 @@ bash "$ROOT/scripts/tests/test-minikube-build-section-headers.sh"
bash "$ROOT/scripts/tests/test-minikube-pre-gate-shadow.sh"
bash "$ROOT/scripts/tests/test-minikube-image-capability-fixture.sh"
+bash "$ROOT/scripts/tests/test-mongodb-mcp-network-binding.sh"
printf 'PASS: local Minikube T0/T1/T2 contract checks\n'
diff --git a/scripts/tests/test-mongodb-mcp-network-binding.sh b/scripts/tests/test-mongodb-mcp-network-binding.sh
new file mode 100755
index 000000000..7781a8381
--- /dev/null
+++ b/scripts/tests/test-mongodb-mcp-network-binding.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd -P)"
+
+ruby -ryaml - "$ROOT" <<'RUBY'
+root = ARGV.fetch(0)
+
+def load_yaml(path)
+ YAML.safe_load(File.read(path), permitted_classes: [], permitted_symbols: [], aliases: false)
+end
+
+def env_map(entries)
+ Array(entries).to_h { |entry| [entry.fetch('name'), entry.fetch('value')] }
+end
+
+static = load_yaml(File.join(root, 'deploy/overlays/minikube/instances-e2e/mongodb-server.yaml'))
+static_env = env_map(static.dig('spec', 'env'))
+raise 'static MongoDB MCP server lacks explicit non-loopback binding authority' unless
+ static_env['MDB_MCP_DANGEROUS_HOST_BINDING'] == 'true'
+mapping = static.dig('spec', 'envMapping') || {}
+raise 'static MongoDB MCP server uses deprecated monitoring host variable' unless
+ mapping['healthCheckHost'] == 'MDB_MCP_MONITORING_SERVER_HOST'
+raise 'static MongoDB MCP server uses deprecated monitoring port variable' unless
+ mapping['healthCheckPort'] == 'MDB_MCP_MONITORING_SERVER_PORT'
+
+recipe = load_yaml(File.join(root, 'deploy/overlays/minikube/instances-e2e/mongodb-mcp-stack.yaml'))
+workload = Array(recipe.dig('spec', 'workloads')).find { |item| item['id'] == 'mongodb-mcp-server' }
+raise 'MongoDB MCP recipe workload is missing' unless workload
+recipe_env = env_map(workload['env'])
+raise 'recipe MongoDB MCP server lacks explicit non-loopback binding authority' unless
+ recipe_env['MDB_MCP_DANGEROUS_HOST_BINDING'] == 'true'
+raise 'recipe MongoDB MCP server uses deprecated monitoring host variable' unless
+ recipe_env.key?('MDB_MCP_MONITORING_SERVER_HOST') &&
+ !recipe_env.key?('MDB_MCP_HEALTH_CHECK_HOST')
+raise 'recipe MongoDB MCP server uses deprecated monitoring port variable' unless
+ recipe_env.key?('MDB_MCP_MONITORING_SERVER_PORT') &&
+ !recipe_env.key?('MDB_MCP_HEALTH_CHECK_PORT')
+RUBY
+
+printf 'PASS: MongoDB MCP fixtures explicitly authorize network binding and use current monitoring variables\n'