- Explore MCP Servers
- mcpo_docker_use
Mcpo Docker Use
What is Mcpo Docker Use
mcpo_docker_use is an example Docker image for mcpo, which is a tool that exposes MCP (Model Context Protocol) servers as OpenAPI-compatible HTTP endpoints for OpenWebUI. It includes pre-built components such as npm, curl, nodejs, and various MCP services like amap and baidumap.
Use cases
Use cases for mcpo_docker_use include building web applications that require location-based services, integrating search functionalities from multiple sources, and developing tools that utilize the Model Context Protocol for enhanced data handling.
How to use
To use mcpo_docker_use, clone the repository, copy and edit the sample configuration files, and then create a Docker container using ‘docker compose up -d’. Alternatively, you can run it using ‘docker run’ with the appropriate parameters.
Key features
Key features of mcpo_docker_use include pre-built MCP services, easy configuration through environment variables, health check integration, and compatibility with OpenAPI specifications for seamless integration with OpenWebUI.
Where to use
mcpo_docker_use can be used in web development projects that require integration with various MCP services, particularly in applications that leverage OpenAPI for API management and interaction.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcpo Docker Use
mcpo_docker_use is an example Docker image for mcpo, which is a tool that exposes MCP (Model Context Protocol) servers as OpenAPI-compatible HTTP endpoints for OpenWebUI. It includes pre-built components such as npm, curl, nodejs, and various MCP services like amap and baidumap.
Use cases
Use cases for mcpo_docker_use include building web applications that require location-based services, integrating search functionalities from multiple sources, and developing tools that utilize the Model Context Protocol for enhanced data handling.
How to use
To use mcpo_docker_use, clone the repository, copy and edit the sample configuration files, and then create a Docker container using ‘docker compose up -d’. Alternatively, you can run it using ‘docker run’ with the appropriate parameters.
Key features
Key features of mcpo_docker_use include pre-built MCP services, easy configuration through environment variables, health check integration, and compatibility with OpenAPI specifications for seamless integration with OpenWebUI.
Where to use
mcpo_docker_use can be used in web development projects that require integration with various MCP services, particularly in applications that leverage OpenAPI for API management and interaction.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
Docker Build and Deployment Guide (mcpo project)
Thanks to @BigUncle for the pull request
This guide systematically outlines the build, deployment, troubleshooting, and best practices for the mcpo project in Docker container environments, reflecting the project’s current state.
I. Project Overview and Architecture
This project uses Docker and Docker Compose for containerized deployment of mcpo (Model Context Protocol OpenAPI Proxy). Core design principles include:
- Dynamic Dependency Installation: At container startup, the
start.shscript readsconfig.jsonand dynamically installs required Python (uvx) and Node.js (npx) tools based on definedmcpServers. - Non-Root User Execution: The container ultimately runs as non-root user
appuserto enhance security. - Dependency and Data Persistence: Through Docker Compose volume mounts, configuration, logs, data, and cache directories for
uvandnpmare persisted to the host machine. - Flexible Source Configuration: Supports dynamic configuration of
pipsources via build argument (PIP_SOURCE), and uses Aliyun mirror by default to accelerateapt. - Environment Isolation: In
start.sh, each MCP tool installation occurs in a sub-shell to avoid environment variable conflicts.
II. Build and Deployment Process
1. Environment Preparation
-
Docker & Docker Compose: Docker 24+ and Docker Compose 2.x recommended.
-
.envFile: Create an.envfile in the project root directory for sensitive information and configuration. IncludeMCPO_API_KEY. Refer to.env.example.# .env file example # pip source used during Docker build (optional, uses default source if empty) PIP_SOURCE=https://mirrors.aliyun.com/pypi/simple/ # API Key required for mcpo runtime (required) MCPO_API_KEY=your_mcpo_api_key_here # Other API Keys that may be needed for mcp servers (according to config.json) # AMAP_MAPS_API_KEY=your_amap_key # ... other required environment variables -
config.json: Configure MCP servers to start. Refer toconfig.example.json. -
Network: Ensure access to Debian (Aliyun mirror), NodeSource, PyPI (or specified
PIP_SOURCE).
2. Directory Structure and Key Files
Dockerfile: Defines image build process.- Base image:
python:3.13-slim - Installs:
bash,curl,jq,nodejs(v22.x),git,uv(via pip) - User: Creates and runs as
appuser. - Configuration: Supports
PIP_SOURCEbuild argument.
- Base image:
start.sh: Container entrypoint script.- Sets
HOME,UV_CACHE_DIR,NPM_CONFIG_CACHE. - Creates persistence directories.
- Reads
config.jsonand dynamically installs MCP tools (usinguvxornpx). - Starts
mcpomain service.
- Sets
docker-compose.yml: Defines services, build parameters, volume mounts, environment variables.- Passes
PIP_SOURCEto Dockerfile. - Mounts
./config.json,./logs,./data,./node_modules,./.npm,./.uv_cache. - Loads
.envas runtime environment variables viaenv_file.
- Passes
readme-docker.md: This document.test_mcp_tools.sh: Basic functionality test script.
3. Building the Image
# Pass PIP_SOURCE (compose will automatically read from .env if defined)
docker-compose build [--no-cache]
--no-cache: Forces rebuild of all layers to ensure latest changes take effect.- Build process uses
PIP_SOURCEfrom.envfile (if valid) to configurepipsource.
4. Starting the Service
# Start service (run in background)
docker-compose up -d
docker-compose.ymlloads variables from.envas container runtime environment variables.start.shexecutes, dynamically installing MCP tools defined inconfig.json.mcpomain service starts.
III. Common Issues and Solutions
1. npx: command not found / git: command not found
- Cause:
npx(installed withnodejs) orgitnot installed or their paths not inappuser’sPATHenvironment variable. - Solution:
- Confirm
Dockerfile’sapt-get installincludesnodejsandgit. - Confirm
ENV PATHdirective includes/usr/bin(whereapt-installednodejsandgittypically reside). Dockerfile already includes/app/.local/bin:/usr/bin:/usr/local/bin:$PATH. - Use
docker-compose build --no-cacheto rebuild.
- Confirm
2. mkdir: cannot create directory '/root': Permission denied
- Cause: Container runs as non-root user
appuser, but scripts or dependencies attempt to write to/rootdirectory (e.g., default cache paths). - Solution:
- All cache directories (
uv,npm) redirected to/appviaENVdirectives (UV_CACHE_DIR,NPM_CONFIG_CACHE,HOME). mkdir -pinstart.shonly operates on directories under/app.- Corresponding volume mount paths in
docker-compose.ymlupdated to/app/....
- All cache directories (
3. pip not using custom source (PIP_SOURCE)
- Cause:
PIP_SOURCEnot correctly passed to Dockerfile during build. - Solution:
- Ensure
.envfile containsPIP_SOURCE=https://.... - Ensure
docker-compose.yml’sbuild.argssection includes- PIP_SOURCE=${PIP_SOURCE:-}. - Dockerfile receives with
ARG PIP_SOURCEand uses viaexport PIP_INDEX_URLinRUNlayers.
- Ensure
4. Slow/Failed Network and Dependency Installation
- Cause: Poor network connection, slow or timeout accessing official sources.
- Solution:
- Dockerfile configured to use Aliyun mirror to accelerate
apt. pipcan be configured with domestic mirrors viaPIP_SOURCEin.env.- Node.js (NodeSource) and uv (PyPI/Mirror) still depend on network; consider alternative solutions in extreme cases.
- Dockerfile configured to use Aliyun mirror to accelerate
IV. Key Considerations and Best Practices
- Non-Root User: Always run containers as
appuser. - Persistence: Explicitly mount
config.json,logs,data,node_modules,.npm,.uv_cacheto preserve state and dependencies. - Secrets: Manage API Keys and sensitive information with
.envfile, inject viaenv_file, neverCOPY.envinto the image or hardcode keys..envfile should be in.gitignore. - Dynamic Installation:
start.sh’s dynamic installation mechanism provides flexibility, but means longer startup time on first launch or afterconfig.jsonchanges. - Version Pinning: For reproducibility, recommend pinning
uvversion inDockerfile(pip install --user uv==X.Y.Z) andnpxpackage versions inconfig.json(@amap/[email protected]). - Resource Limits: In production environments, consider setting memory and CPU limits for services in
docker-compose.yml. - Logs: Logs output to mounted
./logsdirectory for easy viewing and management. - Testing: Use
test_mcp_tools.shscript for basic functionality verification.
V. Quick Reference Commands
- Build image:
docker-compose build [--no-cache] - Start service (background):
docker-compose up -d
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










