DevContainer MCP Server
Manage DevContainer environments using natural language prompts in any MCP-compatible editor.
DevContainer MCP Server
A comprehensive Model Context Protocol (MCP) server that enables AI-powered DevContainer management. This server allows developers to create, configure, build, test, and modify DevContainer environments using natural language prompts through VS Code, Cursor, or any MCP-compatible editor.
๐ Features
- Natural Language Processing: Convert plain English descriptions into valid
devcontainer.json
configurations - Template System: 11+ pre-built templates for popular development stacks (Node.js, Python, Go, Rust, Java, etc.)
- Container Management: Build, test, start, stop, and monitor DevContainers using DevContainer CLI
- Live Modification: Update existing configurations based on natural language requests
- Status Monitoring: Real-time container health and configuration status
- Multi-Editor Support: Compatible with VS Code, Cursor, Claude Desktop, and other MCP clients
- CLI Tool: Standalone command-line interface for direct usage
๐ Table of Contents
- Installation
- Configuration
- Usage Examples
- Available Tools
- Templates
- CLI Tool
- Troubleshooting
- API Reference
- Contributing
๐ Installation
Prerequisites
- Node.js 18+
- Docker or Podman
- DevContainer CLI:
npm install -g @devcontainers/cli
Install Package
npm install -g devcontainer-mcp-server
Development Installation
git clone https://github.com/Siddhant-K-code/mcp-devcontainer.git
cd mcp-devcontainer
npm install
npm run build
โ๏ธ Configuration
VS Code Setup
Add to your VS Code settings.json
:
{
"mcp.servers": {
"devcontainer": {
"command": "devcontainer-mcp-server",
"args": [],
"env": {}
}
}
}
Cursor Setup
Add to your Cursor configuration:
{
"mcp": {
"servers": {
"devcontainer": {
"command": "devcontainer-mcp-server"
}
}
}
}
Claude Desktop Setup
Add to ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or equivalent:
{
"mcpServers": {
"devcontainer": {
"command": "devcontainer-mcp-server",
"args": []
}
}
}
๐ Usage Examples
Natural Language Prompts
Generate a React TypeScript project:
"Create a React TypeScript project with Tailwind CSS on port 3000"
Python Django with PostgreSQL:
"Python Django web application with PostgreSQL database and Redis cache"
Go microservice:
"Go API server with Gin framework, PostgreSQL database, and Docker support on port 8080"
Full-stack MEAN application:
"MEAN stack development environment with MongoDB, Express, Angular, and Node.js"
Expected Outputs
The system automatically detects technologies and generates appropriate configurations:
- Languages: JavaScript, TypeScript, Python, Go, Rust, Java, PHP, Ruby
- Frameworks: React, Angular, Vue, Express, Django, Flask, Spring, Rails
- Databases: PostgreSQL, MySQL, MongoDB, Redis, SQLite, Elasticsearch
- Tools: Docker, Git, development tools, VS Code extensions
- Ports: Automatic port detection and forwarding
๐ ๏ธ Available Tools
1. generate_devcontainer
Generate DevContainer configuration from natural language.
Parameters:
prompt
(required): Natural language descriptionworkspaceRoot
(optional): Workspace path (default: ".")baseTemplate
(optional): Template to start from
2. build_devcontainer
Build container from configuration.
Parameters:
workspaceRoot
(optional): Workspace path (default: ".")configPath
(optional): Custom config pathrebuild
(optional): Force rebuild (default: false)
3. test_devcontainer
Test container functionality.
Parameters:
workspaceRoot
(optional): Workspace path (default: ".")testCommands
(optional): Custom test commands array
4. list_templates
Show available templates.
Parameters:
category
(optional): Filter by category
5. modify_devcontainer
Modify existing configuration.
Parameters:
workspaceRoot
(optional): Workspace path (default: ".")modifications
(required): Desired changes description
6. get_devcontainer_status
Check container status.
Parameters:
workspaceRoot
(optional): Workspace path (default: ".")
๐ฆ Templates
Backend Templates
- nodejs-typescript: Node.js with TypeScript support
- python: Python with common packages and debugging
- go: Go development with standard tooling
- rust: Rust environment with Cargo and debugging
- java: Java with Maven/Gradle support
- php: PHP with Composer and debugging
- ruby: Ruby with Rails support
Frontend Templates
- react: Modern React development stack with TypeScript and Vite
Full-Stack Templates
- mean-stack: MongoDB, Express, Angular, Node.js
- docker-compose: Multi-service development
Universal Templates
- universal: Multi-language development environment
Template Features
Each template includes:
- Appropriate base image and runtime
- Language-specific tools and debuggers
- Recommended VS Code extensions
- Common port forwarding
- Package manager setup commands
๐ฅ๏ธ CLI Tool
The package includes a standalone CLI tool for direct usage:
Generate Configuration
devcontainer-mcp-cli generate "React TypeScript app with Tailwind CSS"
Build Container
devcontainer-mcp-cli build --workspace . --rebuild
Test Container
devcontainer-mcp-cli test --command "npm test" --command "npm run lint"
List Templates
devcontainer-mcp-cli templates --category backend
Check Status
devcontainer-mcp-cli status --workspace .
Modify Configuration
devcontainer-mcp-cli modify "add Redis support and port 6379"
๐ Troubleshooting
Common Issues
DevContainer CLI not found:
npm install -g @devcontainers/cli
Docker not running:
- Ensure Docker Desktop is running
- Check Docker daemon status:
docker info
Build failures:
- Check devcontainer.json syntax
- Verify base image availability
- Review build logs for specific errors
Permission issues:
- Ensure Docker has proper permissions
- Check file system permissions for workspace
Error Messages
"No suitable template found":
- Try with a more specific prompt
- Use
list_templates
to see available options - Specify a base template explicitly
"DevContainer configuration not found":
- Generate configuration first with
generate_devcontainer
- Check
.devcontainer/devcontainer.json
exists
"Build timeout":
- Check internet connection for image downloads
- Consider using lighter base images
- Increase timeout if needed for large images
๐ API Reference
MCP Protocol Compliance
The server implements the Model Context Protocol specification:
- Tool registration with complete schemas
- Proper request/response handling
- Error responses in MCP format
- Text content responses
Response Format
All tools return structured responses with:
- Success/failure status
- Detailed output and error messages
- Reasoning for configuration choices
- Generated configurations in JSON format
Error Handling
Comprehensive error handling for:
- Invalid configurations
- Build failures
- CLI availability issues
- File system errors
- Network timeouts
๐งช Testing
Run the test suite:
npm test
Run with coverage:
npm run test:coverage
Test specific components:
npm test -- config-generator.test.ts
npm test -- template-manager.test.ts
npm test -- devcontainer-manager.test.ts
๐๏ธ Development
Project Structure
src/
โโโ index.ts # Main MCP server
โโโ config-generator.ts # Natural language processing
โโโ devcontainer-manager.ts # Container operations
โโโ template-manager.ts # Template management
โโโ cli.ts # CLI tool
โโโ __tests__/ # Test suite
Build and Run
npm run build # Compile TypeScript
npm run dev # Development mode
npm run start # Production mode
npm run lint # Code linting
Adding New Templates
- Edit
src/template-manager.ts
- Add template configuration to the templates array
- Include appropriate metadata (languages, frameworks, category)
- Add tests for the new template
- Update documentation
Adding Language Support
- Update language patterns in
config-generator.ts
- Add framework detection patterns
- Map to appropriate VS Code extensions
- Create or update templates as needed
- Add test cases
๐ค Contributing
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Ensure all tests pass
- Submit a pull request
Development Workflow
- Install dependencies:
npm install
- Run tests:
npm test
- Build project:
npm run build
- Test CLI:
npm run cli -- --help
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- DevContainer CLI for container management
- Model Context Protocol for the protocol specification
- VS Code DevContainers for the container standards
Related Servers
MCP Time Server
Provides tools for getting the current time and date, and formatting timestamps in various formats and timezones.
iOS Device Control
An MCP server to control iOS simulators and real devices, enabling AI assistant integration on macOS.
ECharts MCP Server
A server for generating various types of charts using the ECharts library.
MCP Proxy
A thin proxy that allows clients to connect to MCP servers over HTTP without streaming transport.
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
Micromanage
A server for managing sequential development tasks with configurable rules using external .mdc files.
Enrichr MCP Server
Performs gene set enrichment analysis using the Enrichr API, supporting all available gene set libraries.
Local MCP Test
A test server for local MCP development and setup.
Google Apps Script MCP Server
Manage Google Apps Script projects, including creation, editing, deployment, and execution. Requires Google Cloud credentials for authentication.
Image Generation
Generate images from text using the Stable Diffusion WebUI API (ForgeUI/AUTOMATIC-1111).