|
| 1 | +# ADR-005: VS Code Dev Container Support |
| 2 | + |
| 3 | +## Status |
| 4 | + |
| 5 | +Accepted |
| 6 | + |
| 7 | +## Context |
| 8 | + |
| 9 | +New contributors to the MCP Context Forge project face significant setup friction when trying to get a development environment running. The manual setup process requires: |
| 10 | + |
| 11 | +- Installing Python 3.11 |
| 12 | +- Installing Docker/Podman |
| 13 | +- Setting up virtual environments |
| 14 | +- Installing development dependencies |
| 15 | +- Configuring environment variables |
| 16 | +- Running tests to verify setup |
| 17 | + |
| 18 | +This setup complexity can discourage contributions and slow down the onboarding process for new developers. Many contributors use VS Code or GitHub Codespaces, which support Dev Containers for standardized development environments. |
| 19 | + |
| 20 | +## Decision |
| 21 | + |
| 22 | +We will add VS Code Dev Container support to the project by implementing: |
| 23 | + |
| 24 | +1. **`.devcontainer/devcontainer.json`** - Configuration specifying: |
| 25 | + - Container build instructions |
| 26 | + - VS Code extensions (Python, Docker) |
| 27 | + - Post-creation commands |
| 28 | + - Environment variables for development mode |
| 29 | + |
| 30 | +2. **`.devcontainer/Dockerfile`** - Container definition with: |
| 31 | + - Python 3.11 slim base image |
| 32 | + - Docker CLI for container management |
| 33 | + - System dependencies (curl, git, build-essential) |
| 34 | + - Python tooling (pip, setuptools, pdm, uv) |
| 35 | + - Development environment setup |
| 36 | + |
| 37 | +3. **`.devcontainer/postCreateCommand.sh`** - Setup script that: |
| 38 | + - Copies `.env.example` to `.env` if needed |
| 39 | + - Runs `make install-dev` to install development dependencies |
| 40 | + - Runs `make test` to verify the environment |
| 41 | + |
| 42 | +4. **Documentation updates** - README.md section explaining: |
| 43 | + - How to use the devcontainer in VS Code |
| 44 | + - How to use with GitHub Codespaces |
| 45 | + - Benefits and included tools |
| 46 | + |
| 47 | +## Consequences |
| 48 | + |
| 49 | +### Positive |
| 50 | + |
| 51 | +- **Instant onboarding**: New contributors can start developing immediately with one click |
| 52 | +- **Consistent environments**: All developers use the same Python version, tools, and dependencies |
| 53 | +- **Reduced setup friction**: No need to manually install Python, Docker, or configure environments |
| 54 | +- **GitHub Codespaces support**: Cloud-based development without local setup requirements |
| 55 | +- **Automated verification**: Tests run automatically to ensure the environment is working |
| 56 | +- **Standardized tooling**: Everyone gets the same VS Code extensions and configuration |
| 57 | + |
| 58 | +### Negative |
| 59 | + |
| 60 | +- **Additional maintenance**: Need to keep devcontainer configuration in sync with project requirements |
| 61 | +- **Container build time**: Initial setup takes a few minutes for first-time users |
| 62 | +- **Docker dependency**: Requires Docker/Podman to be installed and running |
| 63 | +- **Limited to VS Code**: Only benefits developers using VS Code or Codespaces |
| 64 | + |
| 65 | +### Neutral |
| 66 | + |
| 67 | +- **File size increase**: Adds minimal files to the repository |
| 68 | +- **Learning curve**: Developers unfamiliar with Dev Containers may need to learn the workflow |
| 69 | + |
| 70 | +## Alternatives Considered |
| 71 | + |
| 72 | +1. **Manual setup instructions only** (current state) |
| 73 | + - Pros: No additional complexity |
| 74 | + - Cons: High setup friction, inconsistent environments |
| 75 | + |
| 76 | +2. **Gitpod integration** |
| 77 | + - Pros: Cloud-based development |
| 78 | + - Cons: Less VS Code-native, additional external dependency |
| 79 | + |
| 80 | +3. **Docker Compose for development** |
| 81 | + - Pros: Tool-agnostic |
| 82 | + - Cons: More complex setup, less integrated with VS Code |
| 83 | + |
| 84 | +4. **Vagrant-based development environment** |
| 85 | + - Pros: Full VM isolation |
| 86 | + - Cons: Resource-heavy, slower, less modern workflow |
| 87 | + |
| 88 | +## Implementation Details |
| 89 | + |
| 90 | +The devcontainer uses: |
| 91 | +- **Python 3.11**: As specified in the project requirements |
| 92 | +- **PDM and UV**: For package management (matching the project's tooling) |
| 93 | +- **Make targets**: Leverages existing `make install-dev` and `make test` workflows |
| 94 | +- **Environment variables**: Sets `MCPGATEWAY_DEV_MODE=true` for development |
| 95 | +- **VS Code extensions**: Includes Python and Docker extensions for optimal development experience |
| 96 | + |
| 97 | +## Verification |
| 98 | + |
| 99 | +The implementation was tested by: |
| 100 | +1. Building the devcontainer in VS Code |
| 101 | +2. Verifying that development dependencies install correctly |
| 102 | +3. Confirming that the test suite passes |
| 103 | +4. Checking that all Make targets work properly inside the container |
| 104 | + |
| 105 | +## References |
| 106 | + |
| 107 | +- [VS Code Dev Containers documentation](https://code.visualstudio.com/docs/devcontainers/containers) |
| 108 | +- [GitHub Codespaces documentation](https://docs.github.com/en/codespaces) |
| 109 | +- [Dev Container specification](https://containers.dev/) |
| 110 | +- Project issue/PR requesting devcontainer support |
0 commit comments