From 7d4e79dcc24de3025fd6b7202bd4bf188316b13e Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Sun, 2 Mar 2025 17:38:41 +0800 Subject: [PATCH 1/2] chore: add Docker and environment configuration files This commit adds essential configuration files for containerization and environment setup: - Created .dockerignore to exclude unnecessary files from Docker build - Updated .env.example with more comprehensive Supabase configuration options - Added Dockerfile for Python 3.12 with uv package manager - Updated smithery.yaml to include additional Supabase configuration parameters - Updated CI workflow to simplify test running - Updated release checklist with new steps --- .dockerignore | 89 +++++++++++++++++++++ .env.example | 14 +++- .github/workflows/ci.yaml | 1 - .github/workflows/docs/release-checklist.md | 2 + Dockerfile | 36 +++++++++ smithery.yaml | 39 ++++++++- 6 files changed, 176 insertions(+), 5 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fba65ae --- /dev/null +++ b/.dockerignore @@ -0,0 +1,89 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +.pytest_cache/ +.coverage +htmlcov/ +.tox/ +.nox/ + +# Virtual Environment +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# macOS +.DS_Store +.AppleDouble +.LSOverride +Icon +._* +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# IDEs and Editors +.idea/ +.vscode/ +*.swp +*.swo +*~ +.project +.classpath +.settings/ +*.sublime-workspace +*.sublime-project + +# Local development +.env.mcp +.env.mcp2 +*.log +logs/ + +# Ignore local assets +assets/ +*.gif +*.mp4 + +# Generated version file +supabase_mcp/_version.py + +# Docs +.llms-full.txt + +# Docker specific ignores +Dockerfile +.dockerignore +docker-compose.yml +docker-compose.yaml + +# Git +.git/ +.github/ +.gitignore diff --git a/.env.example b/.env.example index 99d147a..0e69e1e 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,11 @@ -# .env.mcp.example -SUPABASE_PROJECT_REF=your-project-ref # default is local supabase project ref if not set -SUPABASE_DB_PASSWORD=your-db-password # default is local supabase db password if not set +# Supabase MCP Server Environment Configuration +# Copy this file to .env to configure your server + +# Required for remote Supabase projects (optional for local development) +SUPABASE_PROJECT_REF=your-project-ref # Your project reference from dashboard URL +SUPABASE_DB_PASSWORD=your-db-password # Database password for your project + +# Optional configuration +SUPABASE_REGION=us-east-1 # Region where your Supabase project is hosted (defaults to us-east-1) +SUPABASE_ACCESS_TOKEN=your-personal-access-token # Required for Management API tools +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key # Required for Auth Admin SDK tools diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1d61c1b..cf46687 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,7 +39,6 @@ jobs: - name: Run tests run: | - source .venv/bin/activate pytest - name: Build distribution packages diff --git a/.github/workflows/docs/release-checklist.md b/.github/workflows/docs/release-checklist.md index 5516256..4a4f75f 100644 --- a/.github/workflows/docs/release-checklist.md +++ b/.github/workflows/docs/release-checklist.md @@ -9,6 +9,8 @@ Pre-release 6. Changelog is up to date 7. Tag and release on GitHub 8. Release is published to PyPI +9. Update dockerfile +10. Update .env.example (if necessary) Post-release - Clean install from PyPi works diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..606d820 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM python:3.12-slim-bookworm + +WORKDIR /app + +# Install PostgreSQL client libraries (required for psycopg2) and curl for uv installation +RUN apt-get update && apt-get install -y \ + libpq-dev \ + gcc \ + # pipx \ + curl \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# # Install uv with fixed version +ENV UV_VERSION="0.6.1" +ADD https://astral.sh/uv/${UV_VERSION}/install.sh /uv-installer.sh +RUN sh /uv-installer.sh && rm /uv-installer.sh +# Ensure the installed binary is on the `PATH` +ENV PATH="/root/.local/bin/:$PATH" + +# # Copy the project into the image +COPY . /app +WORKDIR /app + +# Create venv and install dependencies with version set +ENV SETUPTOOLS_SCM_PRETEND_VERSION="0.3.6" +RUN uv venv && \ + . .venv/bin/activate && \ + uv pip install . + +# Install the package with pipx from PyPI +# RUN pipx install supabase-mcp-server==0.3.6 + +# Set the entrypoint to use the venv +ENTRYPOINT ["uv", "run", "supabase-mcp-server"] +# ENTRYPOINT ["supabase-mcp-server"] diff --git a/smithery.yaml b/smithery.yaml index 6ff8e1b..0103b2c 100644 --- a/smithery.yaml +++ b/smithery.yaml @@ -15,7 +15,44 @@ startCommand: supabaseDbPassword: type: string description: The database password of Supabase project you want to connect to. + supabaseRegion: + type: string + description: Region where your Supabase project is hosted. + default: "us-east-1" + enum: + - "us-west-1" + - "us-east-1" + - "us-east-2" + - "ca-central-1" + - "eu-west-1" + - "eu-west-2" + - "eu-west-3" + - "eu-central-1" + - "eu-central-2" + - "eu-north-1" + - "ap-south-1" + - "ap-southeast-1" + - "ap-northeast-1" + - "ap-northeast-2" + - "ap-southeast-2" + - "sa-east-1" + supabaseAccessToken: + type: string + description: Your Supabase access token (required for Management API tools). + supabaseServiceRoleKey: + type: string + description: Your Supabase service role key (required for Auth Admin SDK tools). commandFunction: # A function that produces the CLI command to start the MCP on stdio. |- - (config) => ({ command: 'uv', args: ['--directory', '.', 'run', 'main.py'], env: { SUPABASE_PROJECT_REF: config.supabaseProjectRef, SUPABASE_DB_PASSWORD: config.supabaseDbPassword } }) + (config) => ({ + command: 'supabase-mcp-server', + args: [], + env: { + SUPABASE_PROJECT_REF: config.supabaseProjectRef, + SUPABASE_DB_PASSWORD: config.supabaseDbPassword, + SUPABASE_REGION: config.supabaseRegion, + SUPABASE_ACCESS_TOKEN: config.supabaseAccessToken, + SUPABASE_SERVICE_ROLE_KEY: config.supabaseServiceRoleKey + } + }) From 609701b56476130517de881748d75ad78dad2b28 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Sun, 2 Mar 2025 17:57:43 +0800 Subject: [PATCH 2/2] chore: add project documentation and refine Dockerfile --- .github/PULL_REQUEST_TEMPLATE.md | 20 ++++++++++++++++++++ .github/workflows/ci.yaml | 1 + .gitignore | 1 + Dockerfile | 5 ----- 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a711d2c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + # Description + + + +## Type of Change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation update +- [ ] Performance improvement +- [ ] Code refactoring (no functional changes) +- [ ] Test updates +- [ ] CI/CD or build process changes +- [ ] Other (please describe): + +## Checklist +- [ ] I have performed a self-review of my own code +- [ ] I have made corresponding changes to the documentation +- [ ] New and existing unit tests pass locally with my changes diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cf46687..564daca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,6 +39,7 @@ jobs: - name: Run tests run: | + source .venv/bin/activate # necessary for pytest pytest - name: Build distribution packages diff --git a/.gitignore b/.gitignore index 00bba09..5548232 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ supabase_mcp/_version.py # Docs .llms-full.txt +COMMIT_CONVENTION.md diff --git a/Dockerfile b/Dockerfile index 606d820..dfb2787 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ WORKDIR /app RUN apt-get update && apt-get install -y \ libpq-dev \ gcc \ - # pipx \ curl \ ca-certificates \ && rm -rf /var/lib/apt/lists/* @@ -28,9 +27,5 @@ RUN uv venv && \ . .venv/bin/activate && \ uv pip install . -# Install the package with pipx from PyPI -# RUN pipx install supabase-mcp-server==0.3.6 - # Set the entrypoint to use the venv ENTRYPOINT ["uv", "run", "supabase-mcp-server"] -# ENTRYPOINT ["supabase-mcp-server"]