How to Create a Docker MCP Server in Python

Documenting what I’ve learned creating a Dockerized MCP Server in Python ๐Ÿ‘

In this article I give the links and show the syntax to build the server inside a Docker image ready for you to provide to users of Claude, Cursor and all clients capable of using an MCP server.

Create Model Context Protocol (MCP) server


Before we get into the Docker side of things, you can use this template to create a Model Context Protocol (MCP) server projects with no build configuration:

๐Ÿ”— https://github.com/modelcontextprotocol/create-python-server

"You don't need to install or configure any dependencies manually. The tool will set up everything you need to create an MCP server."

AI MCP Playlist (2025) : https://www.youtube.com/playlist?list=PLKMY3XNPiQ7sKO_mxMK8PL_lxJij-yWX-

Check out the code here on my GitHub repo:
๐Ÿ”— https://github.com/RGGH/python360 โœ…โœ…

Docker

Note! – you do need to create the Dockerfile from scratch, and have Docker installed**
๐Ÿ”— https://docs.docker.com/get-started/
๐Ÿ”— https://docs.docker.com/get-started/docker_cheatsheet.pdf

Dockerfile

๐Ÿ”— https://github.com/modelcontextprotocol/create-python-server?tab=readme-ov-file#mcp-create-server

I used the MCP Sqlite server for reference:
๐Ÿ”— https://github.com/modelcontextprotocol/servers/blob/main/src/sqlite/Dockerfile

docker build --no-cache -t mcp-360 .
npx @modelcontextprotocol/inspector docker run -i --rm --init -e DOCKER_CONTAINER=true mcp-360

(Where mcp-360 is the name of my build)

โฏ tree -L 3
.
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ src
โ”‚ โ””โ”€โ”€ python360
โ”‚ โ”œโ”€โ”€ init.py
โ”‚ โ”œโ”€โ”€ pycache
โ”‚ โ””โ”€โ”€ server.py
โ””โ”€โ”€ uv.lock

Deploy an MCP Server with Docker

How to