make mcp "prodution ready"
All checks were successful
Build and Push Agent Docker Image / build (push) Successful in 2m11s
All checks were successful
Build and Push Agent Docker Image / build (push) Successful in 2m11s
This commit is contained in:
28
mcp/Dockerfile
Normal file
28
mcp/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Install uv
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
# Copy dependency files
|
||||
COPY pyproject.toml uv.lock ./
|
||||
|
||||
# Install dependencies
|
||||
RUN uv sync --frozen --no-dev
|
||||
|
||||
# Copy application code
|
||||
COPY server.py ./
|
||||
|
||||
# Create non-root user
|
||||
RUN useradd --create-home --shell /bin/bash mcp
|
||||
USER mcp
|
||||
|
||||
EXPOSE 8021
|
||||
|
||||
ENV PORT=8021
|
||||
ENV HOST="0.0.0.0"
|
||||
|
||||
CMD ["uv", "run", "uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8021"]
|
||||
@@ -10,4 +10,5 @@ dependencies = [
|
||||
"dotenv>=0.9.9",
|
||||
"fastmcp>=2.13.3",
|
||||
"psycopg[binary]>=3.3.2",
|
||||
"uvicorn>=0.38.0",
|
||||
]
|
||||
|
||||
@@ -106,5 +106,14 @@ def get_user_info() -> dict:
|
||||
"roles": roles,
|
||||
}
|
||||
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.routing import Route
|
||||
|
||||
async def health(request):
|
||||
return JSONResponse({"status": "ok"})
|
||||
|
||||
app = mcp.http_app()
|
||||
app.routes.append(Route("/health", health))
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport='http', host='::1', port=9031)
|
||||
|
||||
2
mcp/uv.lock
generated
2
mcp/uv.lock
generated
@@ -82,6 +82,7 @@ dependencies = [
|
||||
{ name = "dotenv" },
|
||||
{ name = "fastmcp" },
|
||||
{ name = "psycopg", extra = ["binary"] },
|
||||
{ name = "uvicorn" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
@@ -91,6 +92,7 @@ requires-dist = [
|
||||
{ name = "dotenv", specifier = ">=0.9.9" },
|
||||
{ name = "fastmcp", specifier = ">=2.13.3" },
|
||||
{ name = "psycopg", extras = ["binary"], specifier = ">=3.3.2" },
|
||||
{ name = "uvicorn", specifier = ">=0.38.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
Reference in New Issue
Block a user