Skip to content

feat: Implement Docker runtime for MCP servers #2

@initcron

Description

@initcron

Summary

Implement Docker runtime support to spawn MCP servers as Docker containers, enabling better isolation and reproducibility.

Parent Epic

Part of #1 - Production Kubernetes & Container Support

Implementation Details

RuntimeConfig Addition

pub enum RuntimeConfig {
    LocalProcess { ... },
    RemoteSse { ... },
    Docker {
        image: String,
        command: Option<Vec<String>>,
        env: HashMap<String, String>,
        volumes: Vec<VolumeMount>,
        network: Option<String>,
        working_dir: Option<String>,
    },
}

Features Required

  • Container lifecycle management (create, start, stop, remove)
  • Volume mounting support for data persistence
  • Environment variable injection
  • Image pull handling (with authentication support)
  • Container networking configuration
  • Resource limits (CPU, memory)
  • Health check configuration

Example Catalog Entry

servers:
  - id: postgres-mcp
    runtime:
      type: docker
      image: mcp/postgres:latest
      env:
        DATABASE_URL: "${DATABASE_URL}"
      volumes:
        - /data:/app/data:ro

Acceptance Criteria

  • Can define server with type: docker in catalog.yaml
  • Gateway spawns container on first tool call
  • Container is stopped after idle timeout
  • Volumes are properly mounted
  • Environment variables are injected
  • Logs are captured and available via API

Dependencies

  • Docker Engine or compatible runtime
  • bollard crate for Docker API

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestruntimeRuntime implementationv0.2Version 0.2 features

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions