Skip to content

Commit 75f6584

Browse files
authored
feat: enhance auth module and add stdio guide (not tested) (#2)
* feat: add Docker setup and authentication validation for MCP MetricFlow server * feat: add tests for API key authentication and rate limiting in app lifespan
1 parent c7560b7 commit 75f6584

File tree

9 files changed

+942
-54
lines changed

9 files changed

+942
-54
lines changed

.env.template

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ DBT_PROFILES_DIR=~/.dbt
99
# Path to the MetricFlow executable (optional, defaults to 'mf')
1010
MF_PATH=mf
1111

12-
# Path to temporary directory for query results (optional, defaults to ~/.dbt/metricflow)
13-
MF_TMP_DIR=~/.dbt/metricflow
12+
# Path to temporary directory for query results (optional, defaults to /tmp)
13+
MF_TMP_DIR=/tmp
1414

15+
# SSE Server Configuration (only needed for SSE mode)
1516
# Host to bind to for SSE mode (optional, defaults to '0.0.0.0')
1617
MCP_HOST=0.0.0.0
1718
# Port to bind to for SSE mode (optional, defaults to 8000)
18-
MCP_PORT=8000
19+
MCP_PORT=8000
20+
21+
# API Key Authentication Configuration (for SSE mode)
22+
# Whether to require API key authentication (true/false, defaults to false)
23+
MCP_REQUIRE_AUTH=false
24+
# API key for authentication (required if MCP_REQUIRE_AUTH=true)
25+
# Must be at least 32 characters long and contain only alphanumeric characters, hyphens, or underscores
26+
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(32))"
27+
MCP_API_KEY=

docs/jaffle-shop-setup/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.11-slim
2+
3+
# Set working directory
4+
WORKDIR /app
5+
6+
# Install system dependencies
7+
RUN apt-get update && apt-get install -y \
8+
git \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# Clone the mcp-metricflow repository
12+
RUN git clone https://github.com/datnguye/mcp-metricflow.git .
13+
14+
# Install uv
15+
RUN pip install uv
16+
17+
# Install dependencies
18+
RUN uv sync --all-extras
19+
20+
# Copy the dbt project
21+
COPY . /dbt-project
22+
23+
# Set environment variables
24+
ENV DBT_PROJECT_DIR=/dbt-project
25+
ENV DBT_PROFILES_DIR=/root/.dbt
26+
ENV MF_PATH=mf
27+
ENV MF_TMP_DIR=/tmp
28+
29+
# Create .dbt directory and copy profiles
30+
RUN mkdir -p /root/.dbt
31+
COPY profiles.yml /root/.dbt/profiles.yml
32+
33+
# Default command for STDIO mode
34+
CMD ["uv", "run", "python", "src/main_stdio.py"]

0 commit comments

Comments
 (0)