This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch mcp_service_max_dev
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6d7467bafd6ff1364ad18132c067c3e537295138
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Wed Jul 30 18:59:27 2025 -0700

    feat: add devcontainer profiles for MCP development
    
    - Split devcontainer config into base + profile structure
      - default: Standard Superset development (port 9001)
      - with-mcp: Superset + MCP service (ports 9001, 5008)
    - Add MCP service to docker-compose-light.yml as optional profile
    - Update start-superset.sh to conditionally start MCP when ENABLE_MCP=true
    - Add MCP case to docker-bootstrap.sh for starting MCP service
    - Preserve original devcontainer.json as .old for migration reference
    
    This allows developers to choose their development environment:
    - Use default profile for standard Superset development
    - Use with-mcp profile for MCP/LLM agent development
    - MCP service runs on port 5008 when enabled via profile
    
    ๐Ÿค– Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <[email protected]>
---
 .devcontainer/default/devcontainer.json            | 19 +++++++++++
 .../{devcontainer.json => devcontainer-base.json}  | 13 --------
 .../{devcontainer.json => devcontainer.json.old}   |  0
 .devcontainer/start-superset.sh                    | 14 ++++++--
 .devcontainer/with-mcp/devcontainer.json           | 29 +++++++++++++++++
 docker-compose-light.yml                           | 37 ++++++++++++++++++++++
 docker/docker-bootstrap.sh                         |  4 +++
 7 files changed, 101 insertions(+), 15 deletions(-)

diff --git a/.devcontainer/default/devcontainer.json 
b/.devcontainer/default/devcontainer.json
new file mode 100644
index 0000000000..d098836794
--- /dev/null
+++ b/.devcontainer/default/devcontainer.json
@@ -0,0 +1,19 @@
+{
+  // Extend the base configuration
+  "extends": "../devcontainer-base.json",
+
+  "name": "Apache Superset Development (Default)",
+
+  // Forward ports for development
+  "forwardPorts": [9001],
+  "portsAttributes": {
+    "9001": {
+      "label": "Superset (via Webpack Dev Server)",
+      "onAutoForward": "notify",
+      "visibility": "public"
+    }
+  },
+
+  // Auto-start Superset on Codespace resume
+  "postStartCommand": ".devcontainer/start-superset.sh"
+}
diff --git a/.devcontainer/devcontainer.json 
b/.devcontainer/devcontainer-base.json
similarity index 76%
copy from .devcontainer/devcontainer.json
copy to .devcontainer/devcontainer-base.json
index c73a69e6c4..59ed6ee1d2 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer-base.json
@@ -21,22 +21,9 @@
     }
   },
 
-  // Forward ports for development
-  "forwardPorts": [9001],
-  "portsAttributes": {
-    "9001": {
-      "label": "Superset (via Webpack Dev Server)",
-      "onAutoForward": "notify",
-      "visibility": "public"
-    }
-  },
-
   // Run commands after container is created
   "postCreateCommand": "chmod +x .devcontainer/setup-dev.sh && 
.devcontainer/setup-dev.sh",
 
-  // Auto-start Superset on Codespace resume
-  "postStartCommand": ".devcontainer/start-superset.sh",
-
   // VS Code customizations
   "customizations": {
     "vscode": {
diff --git a/.devcontainer/devcontainer.json 
b/.devcontainer/devcontainer.json.old
similarity index 100%
rename from .devcontainer/devcontainer.json
rename to .devcontainer/devcontainer.json.old
diff --git a/.devcontainer/start-superset.sh b/.devcontainer/start-superset.sh
index db41aceecf..b480b04aac 100755
--- a/.devcontainer/start-superset.sh
+++ b/.devcontainer/start-superset.sh
@@ -4,6 +4,11 @@
 echo "๐Ÿš€ Starting Superset in Codespaces..."
 echo "๐ŸŒ Frontend will be available at port 9001"
 
+# Check if MCP is enabled
+if [ "$ENABLE_MCP" = "true" ]; then
+    echo "๐Ÿค– MCP Service will be available at port 5008"
+fi
+
 # Find the workspace directory (Codespaces clones as 'superset', not 
'superset-2')
 WORKSPACE_DIR=$(find /workspaces -maxdepth 1 -name "superset*" -type d | head 
-1)
 if [ -n "$WORKSPACE_DIR" ]; then
@@ -21,7 +26,7 @@ fi
 
 # Clean up any existing containers
 echo "๐Ÿงน Cleaning up existing containers..."
-docker-compose -f docker-compose-light.yml down
+docker-compose -f docker-compose-light.yml --profile mcp down
 
 # Start services
 echo "๐Ÿ—๏ธ  Building and starting services..."
@@ -33,7 +38,12 @@ echo ""
 echo "๐Ÿ“‹ Running in foreground with live logs (Ctrl+C to stop)..."
 
 # Run docker-compose and capture exit code
-docker-compose -f docker-compose-light.yml up
+if [ "$ENABLE_MCP" = "true" ]; then
+    echo "๐Ÿค– Starting with MCP Service enabled..."
+    docker-compose -f docker-compose-light.yml --profile mcp up
+else
+    docker-compose -f docker-compose-light.yml up
+fi
 EXIT_CODE=$?
 
 # If it failed, provide helpful instructions
diff --git a/.devcontainer/with-mcp/devcontainer.json 
b/.devcontainer/with-mcp/devcontainer.json
new file mode 100644
index 0000000000..c3f8b654eb
--- /dev/null
+++ b/.devcontainer/with-mcp/devcontainer.json
@@ -0,0 +1,29 @@
+{
+  // Extend the base configuration
+  "extends": "../devcontainer-base.json",
+
+  "name": "Apache Superset Development with MCP",
+
+  // Forward ports for development
+  "forwardPorts": [9001, 5008],
+  "portsAttributes": {
+    "9001": {
+      "label": "Superset (via Webpack Dev Server)",
+      "onAutoForward": "notify",
+      "visibility": "public"
+    },
+    "5008": {
+      "label": "MCP Service (Model Context Protocol)",
+      "onAutoForward": "notify",
+      "visibility": "private"
+    }
+  },
+
+  // Auto-start Superset with MCP on Codespace resume
+  "postStartCommand": "ENABLE_MCP=true .devcontainer/start-superset.sh",
+
+  // Environment variables
+  "containerEnv": {
+    "ENABLE_MCP": "true"
+  }
+}
diff --git a/docker-compose-light.yml b/docker-compose-light.yml
index a15b789812..49c02f61b5 100644
--- a/docker-compose-light.yml
+++ b/docker-compose-light.yml
@@ -25,6 +25,12 @@
 # - Volumes are isolated by project name (e.g., project1_db_home_light, 
project2_db_home_light)
 # - Database name is intentionally different (superset_light) to prevent 
accidental cross-connections
 #
+# MCP Service (Model Context Protocol):
+# - Optional service for LLM agent integration, available under 'mcp' profile
+# - To include MCP: docker-compose -f docker-compose-light.yml --profile mcp up
+# - MCP runs on port 5008 by default (customize with MCP_PORT=5009)
+# - Enable SQL debugging with MCP_SQL_DEBUG=true
+#
 # For verbose logging during development:
 # - Set SUPERSET_LOG_LEVEL=debug in docker/.env-local for detailed Superset 
logs
 # -----------------------------------------------------------------------
@@ -150,6 +156,37 @@ services:
         required: false
     volumes: *superset-volumes
 
+  superset-mcp-light:
+    profiles:
+      - mcp
+    build:
+      <<: *common-build
+    command: ["/app/docker/docker-bootstrap.sh", "mcp"]
+    restart: unless-stopped
+    ports:
+      - "127.0.0.1:${MCP_PORT:-5008}:5008"  # Parameterized port
+    extra_hosts:
+      - "host.docker.internal:host-gateway"
+    user: *superset-user
+    depends_on:
+      superset-init-light:
+        condition: service_completed_successfully
+    volumes: *superset-volumes
+    env_file:
+      - path: docker/.env # default
+        required: true
+      - path: docker/.env-local # optional override
+        required: false
+    environment:
+      # Override DB connection for light service
+      DATABASE_HOST: db-light
+      DATABASE_DB: superset_light
+      POSTGRES_DB: superset_light
+      # Use light-specific config that disables Redis
+      SUPERSET_CONFIG_PATH: 
/app/docker/pythonpath_dev/superset_config_docker_light.py
+      # Enable SQL debugging for MCP if needed
+      SQLALCHEMY_DEBUG: ${MCP_SQL_DEBUG:-false}
+
 volumes:
   superset_home_light:
     external: false
diff --git a/docker/docker-bootstrap.sh b/docker/docker-bootstrap.sh
index fd017622a1..ce839a2db7 100755
--- a/docker/docker-bootstrap.sh
+++ b/docker/docker-bootstrap.sh
@@ -78,6 +78,10 @@ case "${1}" in
     echo "Starting web app..."
     /usr/bin/run-server.sh
     ;;
+  mcp)
+    echo "Starting MCP service..."
+    superset mcp run --host 0.0.0.0 --port ${MCP_PORT:-5008} --debug
+    ;;
   *)
     echo "Unknown Operation!!!"
     ;;

Reply via email to