Running MCP Services with Docker via MCPO (DooD Strategy) #86
zhanghao-njmu
started this conversation in
Ideas
Replies: 3 comments
-
Hello, I also used docker compose to integrate the MCPO configuration, and the API/docs page appeared and was configured to openwebui. However, when using tools in openwebui, I encounter 401 or 404 errors. What could be the reason? I would like to ask for your experience Here is the discussion post I made. |
Beta Was this translation helpful? Give feedback.
0 replies
-
very nice. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can we host the MCPO and MCP Server as 2 separate services in cloud and connect ? any pointers? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Running MCP Services with Docker via MCPO (DooD Strategy)
Due to limitations where some MCP services cannot be installed using
uvx
ornpx
, or for scenarios requiring more secure isolation, it's beneficial to run these services via Docker. This guide outlines an updated Docker configuration using the Docker outside of Docker (DooD) strategy. This allows all MCP services, including those running in their own Docker containers, to be managed centrally by the mainmcpo
instance.The setup involves these main steps:
1. Create a New Docker Image with Docker CLI
Build a custom Docker image based on the official
mcpo
image, but with the Docker CLI installed. This enables themcpo
container to executedocker
commands.Dockerfile
:Build this image:
(Make sure the Dockerfile is in the current directory when running the build command)
2. Mount the Host's Docker Socket in
docker-compose.yml
Modify the
docker-compose.yml
file to mount the host machine's Docker socket (/var/run/docker.sock
) into themcpo
container. This allows the Docker CLI inside the container to communicate with the Docker daemon running on the host.docker-compose.yml
:Note: Ensure the user running the
mcpo
container (or the Docker daemon itself) has the necessary permissions to access/var/run/docker.sock
on the host. Often, this involves adding the user to thedocker
group.3. Configure Services in
config.json
Update the
mcpo
configuration file (config.json
) to define how each MCP service should be launched. For services intended to run via Docker, set thecommand
field to"docker"
and specify the Docker command arguments in theargs
array.config.json
:4. Run the Setup
You have two primary ways to run this configuration:
Option A: Using Docker Compose Directly
Navigate to the directory containing your
docker-compose.yml
andDockerfile
(or where you built the image) and run:--build
: Rebuilds themcpo-with-docker
image if theDockerfile
has changed.-d
: Runs the containers in detached mode (in the background).Option B: Creating a Systemd Service
For automatic startup on boot and easier management, create a systemd service file.
Create the service file:
Add the following content:
Important: Replace
/path/to/your/mcpo/docker/setup
with the actual path to the directory containing yourdocker-compose.yml
,config.json
, etc.Enable and start the service:
With this setup, your
mcpo
container can now launch and manage other MCP services, whether they run directly vianpx
/uvx
within themcpo
container or are launched as separate Docker containers using the host's Docker daemon. Importantly, all MCP services managed throughmcpo
this way benefit from centralized control and features like automatically generated interactive documentation.Beta Was this translation helpful? Give feedback.
All reactions