Sponsored by Deepsite.site

MCP Docker Compose Setup

Created By
guanghuang7 months ago
Docker Compose setup for multiple MCP servers (Oracle, PostgreSQL, Jira, etc.) with Nginx proxy, enabling AI assistants to access databases and services via SSE interface.
Content

MCP Docker Compose Setup

This repository contains a Docker Compose configuration for running multiple MCP (Multi-Channel Provider) sse services locally.

Getting Started

Follow these steps to set up and run the MCP Docker Compose environment:

1. Clone the Repository

git clone https://github.com/guanghuang/mcp-docker-compose.git
cd mcp-docker-compose

2. Create Configuration Files from Templates

Copy the sample configuration files to create your own local versions:

# Copy Docker Compose configuration
cp docker-compose.yml.sample docker-compose.yml

3. Configure DNS

Set up DNS resolution for the MCP services as described in the DNS Configuration section. The router-level DNS configuration is recommended for simplicity.

4. Customize Configuration Files

Edit the configuration files in the mcp-configs directory to add your credentials and connection details:

# Example: Edit database connection details
nano mcp-configs/postgres.config

5. Customize docker-compose.yml (Optional)

If you need to:

  • Add additional MCP services
  • Remove services you don't need
  • Change port mappings
  • Add environment variables

Edit the docker-compose.yml file:

nano docker-compose.yml

6. Start the Services

Start all the MCP services:

docker-compose up -d

7. Verify Services

Check that all services are running:

docker-compose ps

8. Access Services

Access the services via their respective URLs:

Using with AI Assistants

MCP Servers Configuration

This setup can be used with Cursor, Windsurf, and other AI coding assistants that support the Model Context Protocol with SSE (Server-Sent Events). The repository includes a sample mcp-servers.json file with the necessary configuration.

Note: This setup uses the SSE (Server-Sent Events) interface of MCP servers. Tools that only support STDIO interface (like current versions of Claude Desktop) are not compatible with this setup.

For Cursor and other AI code editors that support SSE:

  • Copy the content from the sample configuration below into your editor's MCP configuration
  • Modify the URLs if you've changed any hostnames or ports

The MCP configuration for all services looks like:

{
  "mcpServers": {
    "oracle": {
      "url": "http://oracle-mcp.localhost:8088/mcp/sse"
    },
    "postgres": {
      "url": "http://postgres-mcp.localhost:8088/mcp/sse"
    },
    "sqlserver": {
      "url": "http://sqlserver-mcp.localhost:8088/mcp/sse"
    },
    "azure-devops": {
      "url": "http://azure-devops-mcp.localhost:8088/mcp/sse"
    },
    "jira": {
      "url": "http://jira-mcp.localhost:8088/mcp/sse"
    },
    "confluence": {
      "url": "http://confluence-mcp.localhost:8088/mcp/sse"
    },
    "figma": {
      "url": "http://figma-mcp.localhost:8088/mcp/sse"
    },
    "opensearch": {
      "url": "http://opensearch-mcp.localhost:8088/mcp/sse"
    }
  }
}

Simply customize these settings for your environment and add them to your AI assistant's configuration. Each tool has a different location for MCP configuration - check your tool's documentation for details.

Services

The following services are included:

MCP Docker Images

All MCP services are available as Docker images:

Prerequisites

  • Docker and Docker Compose installed
  • DNS configuration that resolves *-mcp.localhost to 127.0.0.1

DNS Configuration

For this setup to work properly, you must configure your DNS to resolve all *-mcp.localhost hostnames to 127.0.0.1. This can be done in several ways:

Recommendation: Using router-level DNS configuration is the preferred approach as it's the simplest and most effective solution. It automatically works for all devices on your network without individual configuration and requires just a one-time setup. If you manage your own router/DNS server, configure this option first.

Router DNS (e.g., pfSense)

If you're using pfSense or another router with DNS resolver capabilities:

  1. Access your router's admin interface
  2. Navigate to the DNS Resolver settings
  3. Add the following to the Custom options section:
server:
local-zone: "localhost" redirect
local-data: "*.localhost 86400 IN A 127.0.0.1"
  1. Apply the changes and restart the DNS resolver service

For OPNsense, add similar configuration to the Unbound DNS resolver.

Hosts File

macOS/Linux

Edit /etc/hosts:

sudo nano /etc/hosts

Add the following entries:

127.0.0.1 oracle-mcp.localhost
127.0.0.1 postgres-mcp.localhost
127.0.0.1 sqlserver-mcp.localhost
127.0.0.1 azure-devops-mcp.localhost
127.0.0.1 jira-mcp.localhost
127.0.0.1 confluence-mcp.localhost
127.0.0.1 figma-mcp.localhost
127.0.0.1 opensearch-mcp.localhost

Windows

Edit C:\Windows\System32\drivers\etc\hosts (requires administrator privileges) and add the same entries as above.

Local DNS Servers

If you prefer using a local DNS server for better control and flexibility:

Windows

  1. Acrylic DNS Proxy:

    • Download and install from Acrylic DNS website
    • Add the following to the hosts file (%ProgramFiles%\Acrylic DNS Proxy\AcrylicHosts.txt):
    127.0.0.1 *.localhost
    
    • Restart the Acrylic DNS service
  2. Simple DNS Plus:

    • Install Simple DNS Plus
    • Add a wildcard DNS record for *.localhost pointing to 127.0.0.1

macOS

  1. dnsmasq:

    • Install via Homebrew: brew install dnsmasq
    • Create or edit /usr/local/etc/dnsmasq.conf:
    address=/.localhost/127.0.0.1
    
    • Start the service: sudo brew services start dnsmasq
    • Configure macOS to use this local DNS server (System Preferences → Network → Advanced → DNS)
  2. MicroDNS:

    • Simple GUI-based DNS server for macOS

Linux

  1. dnsmasq:

    • Install via package manager: sudo apt install dnsmasq (Ubuntu/Debian) or sudo yum install dnsmasq (CentOS/RHEL)
    • Add to /etc/dnsmasq.conf:
    address=/.localhost/127.0.0.1
    
    • Restart the service: sudo systemctl restart dnsmasq
  2. Bind9:

    • For more advanced configurations, install Bind9 DNS server
    • Add a wildcard zone for localhost in your configuration

Using /etc/hosts with a Wildcard (macOS/Linux only)

For macOS and Linux, with additional tools you can enable wildcard support in the hosts file:

  1. Install libnss-myhostname:

    # On Ubuntu/Debian
    sudo apt-get install libnss-myhostname
    
  2. Edit /etc/nsswitch.conf to include:

    hosts: files myhostname dns
    

This approach requires additional configuration and may not work on all systems.

Configuration

Service Configuration

Each service has a corresponding configuration file in the mcp-configs directory. Customize these files with your actual credentials and connection details before starting the services:

  • oracle.config: Oracle database connection parameters
  • postgres.config: PostgreSQL database connection parameters
  • sqlserver.config: SQL Server database connection parameters
  • azure-devops.config: Azure DevOps API connection parameters
  • atlassian.config: Jira and Confluence API connection parameters
  • figma.config: Figma API connection parameters
  • opensearch.config: OpenSearch connection parameters

Nginx Configuration

The setup includes two Nginx configuration files:

  • nginx.conf: Main Nginx configuration that sets up virtual hosts for each service
  • mcp-proxy.conf: Proxy settings for proper forwarding of requests to backend services

The Nginx configuration automatically routes requests based on the subdomain pattern: {service-name}-mcp.localhost:8088http://{service-name}:8080 (where {service-name} is resolved through Docker's internal DNS to the appropriate container)

Usage

To start all services:

docker-compose up -d

To view logs:

docker-compose logs -f

To stop all services:

docker-compose down

Updating MCP Images

When new versions of the MCP Docker images are released, you should update your local setup to get the latest features and security updates:

  1. Pull the latest images:
docker-compose pull
  1. Restart the services with the new images:
docker-compose down
docker-compose up -d

For a single service update:

# Pull just one image
docker pull guang1/jdbc-mcp:latest

# Restart just one service
docker-compose up -d --no-deps oracle

To check which images are outdated:

docker images | grep guang1

Accessing Services

Services are exposed through Nginx on port 8088. The default URLs are:

Troubleshooting

  • If you can't access the services, ensure your DNS configuration is correctly set up
  • Check Docker logs for any service-specific errors
  • Verify that all required configuration files are properly set up in the mcp-configs directory

Security Best Practices

When using MCP servers, keep the following security considerations in mind:

  • Use read-only mode: For database MCP servers, set enable.write.sql=false unless you specifically need write access
  • Use dedicated accounts: Create service-specific accounts with limited permissions for each MCP server
  • Network isolation: Whenever possible, run these services in an isolated network environment
  • Secure credentials: Never commit real credentials to version control; use environment files that are excluded from git
  • Regular updates: Keep your MCP docker images updated to receive security patches

Acknowledgements

These MCP servers are based on the Quarkiverse MCP Servers project with enhancements for containerized deployment. The Model Context Protocol (MCP) enables AI assistants to interface with various services and databases.

Customizing MCP Services

Removing MCP Services

If you don't need all the included MCP services, you can easily remove them from your setup:

  1. Edit the docker-compose.yml file and remove the service section you don't need
  2. Update your DNS or hosts file to remove the corresponding entries
  3. If needed, remove the related configuration file from the mcp-configs directory

Example: To remove the Figma MCP, delete the following section from docker-compose.yml:

figma:
  image: guang1/figma-mcp:latest
  env_file:
    - ./mcp-configs/figma.config

Adding New MCP Services

To add a new MCP service to the setup:

  1. Add the service definition to docker-compose.yml following the existing pattern
  2. Create a configuration file in the mcp-configs directory for the new service
  3. Update your DNS or hosts file to add the corresponding entry

Example: Adding MySQL Database MCP

Since MySQL uses the same JDBC MCP server as the other databases, you can add it as follows:

  1. Add to docker-compose.yml:
mysql:
  image: guang1/jdbc-mcp:latest
  env_file:
    - ./mcp-configs/mysql.config
  environment:
    - enable.write.sql=false
  1. Create mcp-configs/mysql.config:
jdbc.user=mysql_user
jdbc.password=mysql_password
jdbc.url=jdbc:mysql://host:3306/database
  1. Add to your hosts file: 127.0.0.1 mysql-mcp.localhost

The MySQL MCP will be available at http://mysql-mcp.localhost:8088 after restarting Docker Compose.

Example: Adding a Modified MCP Service

If you've created a modified version of an existing MCP with custom functionality:

  1. Add to docker-compose.yml:
custom-opensearch:
  image: yourname/custom-opensearch-mcp:latest
  env_file:
    - ./mcp-configs/custom-opensearch.config
  volumes:
    - ./custom-plugins:/app/plugins  # If your custom MCP needs additional files
  1. Create mcp-configs/custom-opensearch.config:
opensearch.url=https://your-custom-opensearch:9200
opensearch.user=your-username
opensearch.password=your-password
custom.feature.enabled=true
  1. Add to your hosts file: 127.0.0.1 custom-opensearch-mcp.localhost

  2. Build your custom Docker image (example Dockerfile):

FROM guang1/opensearch-mcp:latest
COPY custom-code/ /app/custom-code/
ENV CUSTOM_FEATURE=enabled

The custom OpenSearch MCP will be available at http://custom-opensearch-mcp.localhost:8088 after building your image and restarting Docker Compose.

Contributing

Contributions to improve the MCP Docker Compose setup are welcome. Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the Apache License 2.0 - see the individual MCP repositories for more details.

The MCP Docker Compose configuration is maintained by Guang Huang.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
ChatWiseThe second fastest AI chatbot™
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.