Skip to main content

MCP Server with Docker, Redis, and TimescaleDB

Project description

๐Ÿš€ MCP Server with Docker, Redis, and TimescaleDB

This repository sets up a Model Context Protocol (MCP) Server using Docker, integrating Redis and TimescaleDB for efficient data management.

๐Ÿ› ๏ธ Features

  • FastAPI: Serves as the web framework for the MCP server.
  • Redis: Provides caching mechanisms.
  • TimescaleDB: A time-series database built on PostgreSQL.
  • Docker Compose: Orchestrates multi-container Docker applications.
  • Environment Variables: Configurable via .env file.
  • Systemd Service: Ensures the server auto-starts on reboot.

๐Ÿ“‹ Prerequisites

  • Docker and Docker Compose installed on your system.
  • Git for version control.
  • Zsh with Oh-My-Zsh (optional, for enhanced shell experience).

๐Ÿ“‚ Repository Structure

mcp-server-docker/
โ”œโ”€โ”€ app/
โ”‚   โ””โ”€โ”€ app.py
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ bootstrap-mcp.sh
โ”‚   โ”œโ”€โ”€ full-bootstrap-mcp.sh
โ”‚   โ”œโ”€โ”€ init-repo.sh
โ”‚   โ”œโ”€โ”€ push-repo.sh
โ”‚   โ””โ”€โ”€ setup-mcpserver.sh
โ””โ”€โ”€ README.md

๐Ÿš€ Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/chuckwilliams37/mcp-server-docker.git
    cd mcp-server-docker
    
  2. Configure Environment Variables:

    cp .env.example .env
    

    Modify .env as needed.

  3. Build and Start the Containers:

    docker compose build
    docker compose up -d
    
  4. Access the MCP Server:

    http://localhost:8080
    

๐Ÿ”„ Auto-Restart on Reboot

Create a systemd service to keep your app alive:

sudo nano /etc/systemd/system/mcp-docker.service

Paste:

[Unit]
Description=MCP Docker Compose App
Requires=docker.service
After=docker.service

[Service]
WorkingDirectory=/home/youruser/mcp-server-docker
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
Restart=always
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

Enable it:

sudo systemctl daemon-reload
sudo systemctl enable mcp-docker
sudo systemctl start mcp-docker

๐Ÿงช Scripts

The scripts/ directory contains utility scripts to automate infrastructure tasks.


๐Ÿ› ๏ธ scripts/full-bootstrap-mcp.sh

๐Ÿ’ก Use this on a fresh Ubuntu VM to fully prepare it for MCP deployment. It:

  • Installs system dependencies (Docker, Git, Zsh, UFW, Fail2Ban, etc.)
  • Sets up oh-my-zsh with the jonathan theme
  • Configures Remote Desktop with XFCE + XRDP
  • Clones the MCP repo
  • Builds and launches the app with docker compose
  • Adds a systemd service to relaunch containers on reboot
chmod +x scripts/full-bootstrap-mcp.sh
./scripts/full-bootstrap-mcp.sh

๐Ÿ“œ scripts/init-repo.sh

Initializes a new local Git repository and commits the current directory:

chmod +x scripts/init-repo.sh
./scripts/init-repo.sh

๐Ÿ“ค scripts/push-repo.sh

Pushes your local repo to a remote (update URL first):

chmod +x scripts/push-repo.sh
./scripts/push-repo.sh

๐Ÿง  scripts/setup-mcpserver.sh

Configures your local SSH environment to access a remote MCP server:

  • Pushes your public key
  • Adds an SSH alias
  • Prints a sample A-record
chmod +x scripts/setup-mcpserver.sh
./scripts/setup-mcpserver.sh

โš ๏ธ Edit placeholder values (e.g., IPs, usernames, repo URLs) before executing.


๐Ÿค Contributions

Feel free to fork this repository, submit issues, or create pull requests.

๐Ÿ“„ License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41eda31137bf438f67f8ae1c7e14d000f371ec20e14d0e4eb73954f06912bdd5
MD5 c9bce85593f15252e78aaad23195eea4
BLAKE2b-256 a561771e99eb9615ad13c74b591ff8ceeff76552ffcb2db04a10cf0f845bf170

See more details on using hashes here.

File details

Details for the file iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_chuckwilliams37_mcp_server_docker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 146f2b2a4ec24891441663fc9390139d98606985f643aca8314a88bb569a0ebd
MD5 12fb1380518e256f513a15d1a242b60f
BLAKE2b-256 7152fbae1c68024e8b0efb2ad3b4229656738147bed4535db6d1bfa6583eeba9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page