Skip to content

Commit 2a07a57

Browse files
Merge pull request #41 from alexander-zuev/feat/sql-validation
feat: sql syntax validation, new safety mode, automatic migration, new db client, improved tools
2 parents 1780f3f + 3257a85 commit 2a07a57

File tree

86 files changed

+8785
-2653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+8785
-2653
lines changed

.env.test

Lines changed: 0 additions & 2 deletions
This file was deleted.

.env.test.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Supabase MCP Server Test Environment
2+
# Copy this file to .env.test and modify as needed for your tests
3+
4+
# Connection settings for test database
5+
SUPABASE_PROJECT_REF=127.0.0.1:54322
6+
SUPABASE_DB_PASSWORD=postgres
7+
8+
# Optional: Management API access token (for API tests)
9+
# SUPABASE_ACCESS_TOKEN=your_access_token
10+
11+
# Optional: Service role key (for auth tests)
12+
# SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Bug report
3-
about: Report an issuewith the ser
3+
about: Report an issue with the Supabase MCP server
44
title: "An issue with doing X when Y under conditions Z"
55
labels: bug
66
assignees: alexander-zuev

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Feature request
3-
about: Suggest an idea to improve this MCP server
3+
about: Suggest an idea to improve the Supabase MCP server
44
title: "I want X so that I can do Y and gain Z"
55
labels: ''
66
assignees: ''

.github/workflows/ci.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
SUPABASE_PROJECT_REF: ${{ secrets.SUPABASE_PROJECT_REF }}
1818
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
1919
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
20+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
2021
steps:
2122
- uses: actions/checkout@v4
2223

@@ -40,7 +41,14 @@ jobs:
4041
- name: Run tests
4142
run: |
4243
source .venv/bin/activate # necessary for pytest
43-
pytest
44+
pytest --cov=supabase_mcp --cov-report=xml --cov-report=term
45+
46+
- name: Upload coverage to Codecov
47+
uses: codecov/codecov-action@v3
48+
with:
49+
token: ${{ secrets.CODECOV_TOKEN }}
50+
files: ./coverage.xml
51+
fail_ci_if_error: false
4452

4553
- name: Build distribution packages
4654
run: |

.github/workflows/docs/release-checklist.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ Post-release
1616
- Clean install from PyPi works
1717

1818

19+
## v0.3.8 - 2025-03-07
20+
21+
Pre-release
22+
1. Tests pass - [X]
23+
2. CI passes - [X]
24+
3. Build succeeds - [X]
25+
4. Documentation is up to date - [X]
26+
5. Changelog is up to date - [X]
27+
6. Tag and release on GitHub
28+
7. Release is published to PyPI
29+
8. Update dockerfile - [X]
30+
9. Update .env.example (if necessary) - [X]
31+
32+
Post-release
33+
10. Clean install from PyPi works
34+
35+
1936

2037
## v0.3.0 - 2025-02-22
2138

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ htmlcov/
2727

2828
# Virtual Environment
2929
.env
30+
.env.test
3031
.venv
3132
env/
3233
venv/
@@ -61,8 +62,7 @@ Icon
6162
*.sublime-project
6263

6364
# Local development
64-
.env.mcp
65-
.env.mcp2
65+
6666
*.log
6767
logs/
6868

@@ -78,3 +78,4 @@ supabase_mcp/_version.py
7878
# Docs
7979
.llms-full.txt
8080
COMMIT_CONVENTION.md
81+
feature-spec/

.pre-commit-config.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@ repos:
2929
name: Check for debugger imports
3030
stages: [pre-commit, manual]
3131

32+
# === SQL Linting ===
33+
- repo: https://github.com/sqlfluff/sqlfluff
34+
rev: 3.3.1
35+
hooks:
36+
- id: sqlfluff-lint
37+
name: Run SQLFluff linter
38+
description: Lint SQL files with SQLFluff
39+
types: [sql]
40+
args: [
41+
"--dialect", "postgres",
42+
"--exclude-rules", "L016,L031,LT02", # Exclude some opinionated rules
43+
]
44+
files: ^(supabase_mcp/sql|tests/sql)/
45+
- id: sqlfluff-fix
46+
name: Run SQLFluff fixer
47+
description: Auto-fix SQL files with SQLFluff
48+
types: [sql]
49+
args: [
50+
"--dialect", "postgres",
51+
"--exclude-rules", "L016,L031,LT02", # Exclude some opinionated rules
52+
]
53+
files: ^(supabase_mcp/sql|tests/sql)/
54+
3255
# === Type Checking ===
3356

3457
- repo: https://github.com/pre-commit/mirrors-mypy
@@ -60,7 +83,7 @@ repos:
6083

6184
# === Code Quality & Style ===
6285
- repo: https://github.com/astral-sh/ruff-pre-commit
63-
rev: v0.9.7
86+
rev: v0.9.9
6487
hooks:
6588
- id: ruff
6689
name: Run Ruff linter
@@ -96,7 +119,12 @@ repos:
96119
types: [python]
97120
pass_filenames: false
98121
args: [
99-
"--no-header", ]
122+
"--no-header",
123+
"-v",
124+
"--quiet",
125+
"--no-summary",
126+
"--show-capture=no"
127+
]
100128
stages: [pre-commit, pre-push]
101129

102130
# === Build Check ===

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12.9

CHANGELOG.MD

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77

8+
## [0.3.8] - 2025-03-07
9+
### Added
10+
- SQL query validation using PostgreSQL's parser (pglast v7.3+)
11+
- Automatic migration script generation for schema changes
12+
- Universal safety system with standardized risk levels (Low/Medium/High/Extreme)
13+
- Switched to asyncpg v0.30.0+ from psycopg2
14+
- Enhanced API spec tool with multiple query modes and risk assessment
15+
- Connection retry logic for database and API operations
16+
- Code coverage with pytest-cov
17+
- SQL linting with SQLFluff
18+
- Added pyyaml v6.0.2+ for configuration
19+
20+
### Changed
21+
- Refactored to use dependency injection pattern
22+
- Standardized service initialization to synchronous pattern
23+
- Improved SQL safety categorization:
24+
- `safe`: Read-only operations (always allowed)
25+
- `write`: Data modification (requires unsafe mode)
26+
- `destructive`: Schema changes (requires unsafe mode + confirmation)
27+
- Updated Ruff to v0.9.9
28+
- Added asyncpg-stubs and pytest-mock for testing
29+
30+
## [0.3.7] - 2025-03-02
31+
### Fixed
32+
- Documentation inaccuracies
33+
34+
### Added
35+
- Auth admin SDK support for local Supabase instances
36+
37+
838
## [0.3.6] - 2025-02-26
939
### Added
1040
- Added `call_auth_admin_method` which enables MCP server to manage users in your database (create, update, delete, confirm). All Auth SDK methods are supported

0 commit comments

Comments
 (0)