Skip to content

Conversation

@papagala
Copy link
Collaborator

@papagala papagala commented Nov 9, 2025

Add Kubernetes Deployment Support and Build Automation

Summary

This PR adds Kubernetes/Docker deployment capabilities to M3, enabling the MCP server to run in containerized environments with HTTP transport. It also includes build automation via Makefile and comprehensive documentation for AI agent integration.

Changes

🐳 Dockerfile Enhancements

  • Added HTTP transport configuration for lite and bigquery stages:
    • MCP_TRANSPORT=http - enables HTTP mode instead of STDIO
    • MCP_HOST=0.0.0.0 - binds to all interfaces for container networking
    • MCP_PORT=3000 - exposes MCP server on port 3000
    • MCP_PATH=/sse - configures server-sent events endpoint
  • Exposed port 3000 for intra-cluster and external access

🔧 MCP Server Transport Flexibility (src/m3/mcp_server.py)

  • Added transport mode detection via MCP_TRANSPORT environment variable
  • HTTP/SSE mode support using FastMCP's streamable-http transport for Kubernetes
  • Configurable network settings via environment variables (host, port, path)
  • Backward compatibility - defaults to STDIO mode for desktop clients

📦 Build Automation (New Makefile)

  • Interactive Docker registry prompt - prompts for registry/username if not set
  • Flexible container runtime - supports both Docker (default) and Podman via optional DOCKER variable
  • Complete build workflow:
    • download-db - downloads MIMIC-IV demo database using uv
    • build / build-bigquery - builds lite and BigQuery Docker images
    • push / push-bigquery - pushes images to registry
    • test-image - validates built image
    • clean - removes downloaded database files
  • Version management - configurable IMAGE_TAG (default: 0.0.3)
  • Non-interactive support - allows registry override via CLI or env var

📚 Documentation (README.md)

  • New Kubernetes Deployment section:
    • Build and push instructions with Makefile
    • Service endpoint format for MCP clients
    • Note about external Helm charts repository
  • New AI Agent Integration section:
    • Core workflow best practices for querying MIMIC-IV
    • Key tables reference with column names
    • Query patterns and best practices
    • Sample questions organized by complexity level
    • Emphasis on schema verification to avoid column name errors

Usage Examples

Build and Deploy

# Interactive (will prompt for registry, uses Docker by default)
make all

# With Podman (optional)
make all DOCKER=podman

# Non-interactive with custom registry
make all DOCKER_REGISTRY=myusername

# Combining options (Podman + custom registry)
make all DOCKER_REGISTRY=myusername DOCKER=podman

# Using environment variable
export DOCKER_REGISTRY=myusername
make all

Copy link
Collaborator

@simonprovost simonprovost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much @papagala ! Here are some preliminary comments prior @rafiattrach more important review 🫡

Cheers!

Copy link
Owner

@rafiattrach rafiattrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs a rebase first, and the other big PR should get merged faster since it's nearly done. I can test and review this after that merges and after the rebase. Thanks for the addition and contribution!

@papagala
Copy link
Collaborator Author

Thanks for the comments! I was on holiday so it took me longer to reply

@rafiattrach rafiattrach merged commit 7c561b1 into rafiattrach:main Dec 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants