Skip to main content
Glama
gemini2026

Documentation Search MCP Server

by gemini2026

manage_dev_environment

Set up local development environments using Docker Compose for services like databases and caches within project directories.

Instructions

Manages local development environments using Docker Compose.

Args:
    service: The service to set up (e.g., 'postgres', 'redis').
    project_path: The path to the project directory.

Returns:
    A confirmation message with the next steps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYes
project_pathNo.

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers the 'manage_dev_environment' tool and implements its core logic by generating Docker Compose files for development services.
    async def manage_dev_environment(service: str, project_path: str = "."):
        """
        Manages local development environments using Docker Compose.
    
        Args:
            service: The service to set up (e.g., 'postgres', 'redis').
            project_path: The path to the project directory.
    
        Returns:
            A confirmation message with the next steps.
        """
        from .docker_manager import create_docker_compose, TEMPLATES
    
        try:
            if service not in TEMPLATES:
                return {
                    "error": f"Service '{service}' not supported.",
                    "available_services": list(TEMPLATES.keys()),
                }
    
            compose_file = create_docker_compose(service, project_path)
    
            return {
                "status": "success",
                "message": f"✅ Successfully created 'docker-compose.yml' for '{service}' in '{project_path}'.",
                "next_steps": [
                    f"1. Review the generated file: {compose_file}",
                    "2. Run the service: docker-compose up -d",
                    "3. To stop the service: docker-compose down",
                ],
                "service_details": TEMPLATES[service]["services"],
            }
    
        except (ValueError, FileExistsError) as e:
            return {"error": str(e)}
        except Exception as e:
            return {"error": f"An unexpected error occurred: {str(e)}"}
  • The helper function 'create_docker_compose' that generates the docker-compose.yml file using predefined service templates (TEMPLATES dict). This is the core utility called by the tool handler.
    def create_docker_compose(service: str, path: str = ".") -> str:
        """
        Creates a docker-compose.yml file for a given service in the specified path.
    
        Args:
            service: The name of the service (e.g., 'postgres').
            path: The directory where the file will be created.
    
        Returns:
            The full path to the created docker-compose.yml file.
        """
        if service not in TEMPLATES:
            raise ValueError(
                f"Service '{service}' not supported. Available services: {list(TEMPLATES.keys())}"
            )
    
        compose_path = os.path.join(path, "docker-compose.yml")
    
        if os.path.exists(compose_path):
            # We can decide whether to overwrite, merge, or fail.
            # For now, we'll fail to avoid accidental data loss.
            raise FileExistsError(
                f"A 'docker-compose.yml' already exists at {path}. Please remove it first."
            )
    
        with open(compose_path, "w") as f:
            yaml.dump(TEMPLATES[service], f, default_flow_style=False, sort_keys=False)
    
        return compose_path
  • Predefined Docker Compose templates for services like postgres, redis, rabbitmq, used by create_docker_compose to generate environment-specific docker-compose.yml files.
    TEMPLATES: Dict[str, Dict] = {
        "postgres": {
            "version": "3.8",
            "services": {
                "db": {
                    "image": "postgres:15-alpine",
                    "restart": "always",
                    "environment": {
                        "POSTGRES_USER": "myuser",
                        "POSTGRES_PASSWORD": "mypassword",
                        "POSTGRES_DB": "mydatabase",
                    },
                    "ports": ["5432:5432"],
                    "volumes": ["postgres_data:/var/lib/postgresql/data/"],
                }
            },
            "volumes": {"postgres_data": {}},
        },
        "redis": {
            "version": "3.8",
            "services": {
                "redis": {
                    "image": "redis:7-alpine",
                    "restart": "always",
                    "ports": ["6379:6379"],
                    "volumes": ["redis_data:/data"],
                }
            },
            "volumes": {"redis_data": {}},
        },
        "rabbitmq": {
            "version": "3.8",
            "services": {
                "rabbitmq": {
                    "image": "rabbitmq:3-management-alpine",
                    "restart": "always",
                    "ports": ["5672:5672", "15672:15672"],
                    "environment": {
                        "RABBITMQ_DEFAULT_USER": "myuser",
                        "RABBITA_DEFAULT_PASS": "mypassword",
                    },
                    "volumes": ["rabbitmq_data:/var/lib/rabbitmq/"],
                }
            },
            "volumes": {"rabbitmq_data": {}},
        },
    }
  • The @mcp.tool() decorator registers the manage_dev_environment function as an MCP tool.
    async def manage_dev_environment(service: str, project_path: str = "."):

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gemini2026/documentation-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server