MCP -docker-guide
Complete guide to setting up Model Context Protocol (MCP) servers with Docker on Linux. Step-by-step tutorial for Claude Desktop, Cursor, and Windsurf integration.
claude mcp add --transport stdio yugp31-mcp-server-docker-guide docker run -i --rm --mount type=bind,src=/path/to/your/repo,dst=/repo git --repository /repo
How to use
This MCP server collection runs as Docker containers, each exposing a specific capability in the MCP standard. The common pattern is to launch a container with docker run and pass arguments that mount your workspace or data, along with any required environment variables (for example API keys). Tools available include a filesystem explorer (filesystem), a Git client (git), Brave Search integration (brave-search), a lightweight SQLite data store (sqlite), a generic fetch tool (fetch), a memory/persistence tool (memory), a headless browser/tooling suite (puppeteer), and a Google Maps integration (google-maps). Clients connect to these servers via the MCP protocol using STDIO, so your MCP client application should forward I/O streams to the corresponding docker run commands. This setup keeps runtimes isolated and portable, ideal for local tool access by AI assistants.
How to install
Prerequisites:
- Docker installed and running
- Git installed
- An MCP-compatible client (e.g., Claude Desktop, Cursor, Windsurf)
-
Install Docker and Git
- Follow your OS-specific install guides (Docker: https://docs.docker.com/get-docker/; Git: https://git-scm.com/)
-
Clone the official MCP servers repo
- git clone https://github.com/modelcontextprotocol/servers.git
- cd servers
-
Build MCP server images (optional if prebuilt images are available)
- Create a build script as shown in the repository and run: chmod +x build_servers.sh ./build_servers.sh
- This will build the container images used by the MCP servers (filesystem, git, brave-search, sqlite, fetch, memory, puppeteer, google-maps, etc.).
-
Run MCP servers via Docker (example commands)
- For each server, run the docker run commands shown in the mcp_config section of this doc. Adjust paths and environment variables to your system: docker run -i --rm --mount type=bind,src=/home/YOUR_USERNAME/mcp-workspace,dst=/workspace,readonly --memory 512m --cpus 0.5 filesystem /workspace docker run -i --rm --mount type=bind,src=/path/to/your/repo,dst=/repo git --repository /repo docker run -i --rm -e BRAVE_API_KEY=YOUR_KEY brave-search docker run -i --rm --mount type=bind,src=/home/YOUR_USERNAME/databases,dst=/data sqlite docker run -i --rm fetch docker run -i --rm memory docker run -i --rm --init --cap-drop=ALL --security-opt=no-new-privileges -e DOCKER_CONTAINER=true puppeteer docker run -i --rm -e GOOGLE_MAPS_API_KEY=YOUR_KEY google-maps
-
Configure your MCP client
- Point each server entry in your client configuration to the corresponding docker-based command/args. Example: the filesystem server uses docker with the filesystem image, and maps your workspace read-only for safety.
Additional notes
Tips and notes:
- Always review the server source code before running containers, especially when using Docker images from third parties.
- Prefer read-only mounts (:ro) when possible to limit writable access.
- Do not expose MCP containers directly to the internet; use a controlled network.
- Manage API keys through environment variables, not in config files.
- Keep Docker images updated to pick up security fixes.
- If you modify host paths, ensure they exist and have appropriate permissions for the container user.
- For the Brave Search tool, provide your BRAVE_API_KEY as an environment variable; similarly provide GOOGLE_MAPS_API_KEY for google-maps.
- When using the Puppeteer server, security settings (capabilities and no-new-privileges) are applied to minimize risk.
Related MCP Servers
minima
On-premises conversational RAG with configurable containers
DeepMCPAgent
Model-agnostic plug-n-play LangChain/LangGraph agents powered entirely by MCP tools over HTTP/SSE.
c4-genai-suite
c4 GenAI Suite
sugar
🍰 Sugar - The autonomous layer for AI coding agents
chromadb-remote
Remote MCP server for ChromaDB
mcp-claude-hackernews
An integration that allows Claude Desktop to interact with Hacker News using the Model Context Protocol (MCP).