Hi there,
Thank you for this project!
I found a small bug in the Dockerfile that prevents the container from starting correctly.
What is the bug?
When building and running the container using the provided Dockerfile, the container fails to start.
How to reproduce
docker build -t mssql-mcp .
docker run mssql-mcp
Error
The container exits immediately with a ModuleNotFoundError:
/usr/local/bin/python: No module named mssql_mcp_server
Analysis (The "Why")
This happens because:
- The
WORKDIR is set to /app.
- The
COPY . . command copies the project structure, so the main module is at /app/src/mssql_mcp_server.py.
- The
CMD is written as ["python", "-m", "mssql_mcp_server"].
When this CMD runs, Python looks for mssql_mcp_server inside the /app directory, but it can't find it (it's one level deeper, inside src).
Suggested Fix
The root cause is that the CMD instruction doesn't account for the module being inside the src directory. Here are two possible fixes:
Option 1: Update CMD (Simpler)
Directly update the CMD to use the full module path from the WORKDIR (/app).
Change this:
CMD ["python", "-m", "mssql_mcp_server"]
To this:
CMD ["python", "-m", "src.mssql_mcp_server"]
This ensures Python (using the -m flag) correctly searches from /app, finds the src package, and then the mssql_mcp_server module inside it.
Option 2: Use PYTHONPATH Environment Variable
Alternatively, add the src directory to Python's module search path using an environment variable.
Add this line before the CMD:
The Dockerfile end would look like this:
WORKDIR /app
ENV PYTHONPATH=/app/src
CMD ["python", "-m", "mssql_mcp_server"]
This tells Python to also look inside /app/src when searching for modules, so it can find mssql_mcp_server directly.
I hope this helps!
Hi there,
Thank you for this project!
I found a small bug in the
Dockerfilethat prevents the container from starting correctly.What is the bug?
When building and running the container using the provided
Dockerfile, the container fails to start.How to reproduce
docker build -t mssql-mcp .docker run mssql-mcpError
The container exits immediately with a
ModuleNotFoundError:/usr/local/bin/python: No module named mssql_mcp_serverAnalysis (The "Why")
This happens because:
WORKDIRis set to/app.COPY . .command copies the project structure, so the main module is at/app/src/mssql_mcp_server.py.CMDis written as["python", "-m", "mssql_mcp_server"].When this
CMDruns, Python looks formssql_mcp_serverinside the/appdirectory, but it can't find it (it's one level deeper, insidesrc).Suggested Fix
The root cause is that the
CMDinstruction doesn't account for the module being inside thesrcdirectory. Here are two possible fixes:Option 1: Update CMD (Simpler)
Directly update the
CMDto use the full module path from theWORKDIR(/app).Change this:
To this:
This ensures Python (using the
-mflag) correctly searches from/app, finds thesrcpackage, and then themssql_mcp_servermodule inside it.Option 2: Use PYTHONPATH Environment Variable
Alternatively, add the
srcdirectory to Python's module search path using an environment variable.Add this line before the
CMD:ENV PYTHONPATH=/app/srcThe
Dockerfileend would look like this:This tells Python to also look inside
/app/srcwhen searching for modules, so it can findmssql_mcp_serverdirectly.I hope this helps!