A modern Docker container management service that provides both HTTP API and MCP (Model Context Protocol) server for seamless AI agent integration.
- 🐳 Docker Container Management: Create, run, and manage Docker containers with workspace isolation
- 🤖 AI Agent Ready: Built-in MCP server support for AI agents and assistants like Claude
- 🔒 Workspace Isolation: Each workspace gets its own Docker volume for security
- 📡 Dual Interface: Both HTTP REST API and MCP protocol support
- 🚀 Lightweight: Minimal overhead with clean, focused functionality
- 🔧 Developer Friendly: Simple CLI interface with sensible defaults
- 🌐 Network Isolation: Dedicated Docker network for forge containers
- AI-powered development environments
- Isolated code execution for AI assistants
- Container-based CI/CD workflows
- Secure multi-tenant development platforms
- Interactive programming sessions with AI agents
go install github.com/flarexio/forge/cmd/forge@latest
go install github.com/flarexio/forge/cmd/forge_mcp@latest
Start the HTTP API server:
forge --port 8080 --path /path/to/workspace
The server will be available at http://localhost:8080
Start the MCP server for AI agent integration:
forge_mcp --path /path/to/workspace
- Run Once: Execute a command in a container and remove it
- Run Interactive: Start a persistent container with shell access
- Execute Commands: Run commands in existing containers
- Send Input: Send input to container stdin (supports Ctrl+C, Ctrl+Z)
- Read Logs: Retrieve container logs with optional filters
- Remove Containers: Clean up containers individually or all at once
- List Images: Browse available Docker images
- Pull Images: Download images from registries
- Image Description: Get detailed information about images from Docker Hub
- Workspace Isolation: Each workspace ID gets its own Docker volume
- Volume Mounting: Optional mounting of workspace to container paths
- Network Isolation: Containers run in dedicated
forge
network
curl "http://localhost:8080/docker/images?page=1&pageSize=10"
curl "http://localhost:8080/docker/images/alpine/pull"
curl -X POST "http://localhost:8080/workspaces/my-project/containers/run_once" \
-H "Content-Type: application/json" \
-d '{
"image": "node:18",
"mountPath": "/workspace",
"workDir": "/workspace",
"cmd": ["npm", "install"]
}'
curl -X POST "http://localhost:8080/workspaces/my-project/containers/run" \
-H "Content-Type: application/json" \
-d '{
"image": "python:3.9",
"mountPath": "/app",
"workDir": "/app",
"cmd": ["python3"]
}'
curl -X POST "http://localhost:8080/workspaces/my-project/containers/{container-id}/send" \
-H "Content-Type: application/json" \
-d '{
"input": "print(\"Hello World\")"
}'
curl -X POST "http://localhost:8080/workspaces/my-project/containers/{container-id}/exec" \
-H "Content-Type: application/json" \
-d '{
"cmd": ["ls", "-la"]
}'
Forge provides native MCP (Model Context Protocol) support for AI agents. The MCP server exposes all container management capabilities as tools that AI agents can use:
ImageDescription
- Get Docker image information from Docker HubListImages
- Browse available Docker images with paginationPullImage
- Download Docker images from registriesListContainers
- Show all containers in the current workspaceRunContainerOnce
- Execute one-time commands in containers and remove themRunContainer
- Start persistent interactive containersSendToContainer
- Send input to running containers (supports Ctrl+C, Ctrl+Z)LogsContainer
- Retrieve container logs with timestamp filteringExecCommand
- Execute commands in existing running containersWait
- Add configurable delays between operationsSendAndRead
- Send input to containers and read the outputRemoveContainer
- Remove specific containers by IDRemoveAllContainers
- Clean up all containers in the workspace
Each tool requires appropriate parameters and context:
- Context: Most tools require
workspace_id
in the context - Container Operations: Tools like
RunContainer
andSendToContainer
need container configuration - Image Operations: Tools like
PullImage
andImageDescription
work with image names - Timing: Tools like
Wait
andSendAndRead
support duration parameters
forge [options]
Options:
--path string Specifies the working directory (default: ~/.flarex/forge)
--port int HTTP server port (default: 8080)
forge_mcp [options]
Options:
--path string Specifies the working directory (default: ~/.flarex/forge)
~/.flarex/forge/
└── workspaces/
├── project-1/
├── project-2/
└── my-workspace/
Each workspace directory is automatically mounted as a Docker volume for container access.
- Service Layer: Core business logic for container management
- Transport Layer: HTTP and MCP protocol handlers
- Docker Integration: Direct Docker API communication
- Workspace Management: Isolated workspace volumes
- Network Management: Dedicated container networking
- Workspace ID Validation: Prevents directory traversal attacks
- Container Isolation: Each workspace uses separate Docker volumes
- Network Isolation: Containers run in dedicated Docker network
- Label-based Access Control: Containers are tagged with workspace labels
- Go 1.21+
- Docker Engine
- Docker daemon running
git clone https://github.com/flarexio/forge.git
cd forge
# Build HTTP server
go build -o bin/forge cmd/forge/main.go
# Build MCP server
go build -o bin/forge_mcp cmd/forge_mcp/main.go
go test ./...
- Docker Engine 20.10+
- Docker API version 1.41+
- Sufficient permissions to create containers, volumes, and networks
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Docker Engine API
- MCP support via mcp-go
- HTTP server with Gin
- CLI with urfave/cli