sql-mcp 2.3.9__tar.gz → 2.3.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sql_mcp-2.3.9/sql_mcp.egg-info → sql_mcp-2.3.11}/PKG-INFO +190 -131
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/README.md +188 -129
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/pyproject.toml +2 -2
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/auth.py +1 -1
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/kg_ingest.py +82 -8
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/mcp/mcp_sql.py +41 -1
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/__init__.py +1 -1
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/certification.json +3 -3
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/database.ttl +13 -31
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/shapes/connector.shacl.ttl +2 -2
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-development/SKILL.md +16 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md +19 -8
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-operations/SKILL.md +16 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-query-execution/SKILL.md +19 -8
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md +18 -7
- {sql_mcp-2.3.9 → sql_mcp-2.3.11/sql_mcp.egg-info}/PKG-INFO +190 -131
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp.egg-info/SOURCES.txt +3 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp.egg-info/requires.txt +1 -1
- sql_mcp-2.3.11/tests/test_catalog_profile.py +88 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_kg_ingest.py +6 -3
- sql_mcp-2.3.11/tests/test_ontology_extends_core.py +24 -0
- sql_mcp-2.3.11/tests/test_scion_sdk_0_10_imports.py +59 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_startup.py +1 -1
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/LICENSE +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/setup.cfg +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/__init__.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/__main__.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/api/__init__.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/api/api_client_sql.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/api_client.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/connector_contracts.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/connector_sources.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/dialects.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/kg_pgwire.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/mcp/__init__.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/mcp_config.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/mcp_server.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/fixtures/records.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/mappings/source.yaml +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/ontology/migrations/manifest.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/prompts/sql-mcp-data-analyst.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/prompts/sql-mcp-data-steward.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/prompts/sql-mcp-database-administrator.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/prompts/sql-mcp-operator.json +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/safety.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-operations/agents/openai.yaml +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-operations/references/catalog.md +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-query-execution/WORKFLOW.md +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp/sql_response_models.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp.egg-info/dependency_links.txt +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp.egg-info/entry_points.txt +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/sql_mcp.egg-info/top_level.txt +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_api_wrapper.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_auth.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_dialect_paths.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_dialects.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_identity_context_scoping.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_init_dynamics.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_kg_pgwire.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_package_getattr.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_safety.py +0 -0
- {sql_mcp-2.3.9 → sql_mcp-2.3.11}/tests/test_sql_mcp_validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sql-mcp
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.11
|
|
4
4
|
Summary: Generic SQL database (Postgres, MySQL/MariaDB, MSSQL, Oracle, SQLite) API + MCP Server for Agentic AI!
|
|
5
5
|
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: <3.15,>=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: scion-sdk[mcp]<
|
|
15
|
+
Requires-Dist: scion-sdk[mcp]<0.15,>=0.14.1
|
|
16
16
|
Requires-Dist: python-dotenv>=1.2.4
|
|
17
17
|
Requires-Dist: sqlalchemy>=2.1.5
|
|
18
18
|
Provides-Extra: postgres
|
|
@@ -33,19 +33,32 @@ Requires-Dist: pytest-cov>=7.1.0; extra == "test"
|
|
|
33
33
|
Dynamic: license-file
|
|
34
34
|
|
|
35
35
|
# Sql Mcp
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
## MCP
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+

|
|
43
|
+

|
|
44
|
+

|
|
45
|
+

|
|
46
|
+

|
|
47
|
+

|
|
48
|
+

|
|
49
|
+

|
|
50
|
+

|
|
51
|
+

|
|
52
|
+

|
|
53
|
+

|
|
54
|
+

|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
> **Documentation** — Installation, deployment, and usage across the API, CLI, MCP,
|
|
58
|
+
> and A2A agent interfaces are maintained in the
|
|
59
|
+
> [official documentation](https://knuckles-team.github.io/sql-mcp/).
|
|
60
|
+
|
|
61
|
+
---
|
|
49
62
|
|
|
50
63
|
## Overview
|
|
51
64
|
|
|
@@ -54,7 +67,9 @@ connection administration as typed, deterministic MCP tools, and ships an option
|
|
|
54
67
|
statement-type allowlist, every result is bounded by a row cap and a timeout, and
|
|
55
68
|
all values travel as bound parameters — never interpolated into SQL strings.
|
|
56
69
|
|
|
57
|
-
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Key Features
|
|
58
73
|
|
|
59
74
|
- **`SqlApi`** (`sql_mcp.api.api_client_sql`) — a SQLAlchemy 2.x Core facade with
|
|
60
75
|
named multi-connection support, lazy engine creation, the read-only statement
|
|
@@ -70,7 +85,11 @@ all values travel as bound parameters — never interpolated into SQL strings.
|
|
|
70
85
|
install via extras.
|
|
71
86
|
wired to the MCP server via `MCP_URL`.
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## MCP
|
|
91
|
+
|
|
92
|
+
### MCP tools
|
|
74
93
|
|
|
75
94
|
The table below is auto-generated from the MCP server — do not edit by hand.
|
|
76
95
|
|
|
@@ -121,6 +140,45 @@ _2 action-routed tool(s) (default) · 22 verbose 1:1 tool(s). Each is enabled un
|
|
|
121
140
|
Every tool takes `action`, `params_json`, and an optional `connection` naming one
|
|
122
141
|
of the configured connections. The whole set is toggled with `SQLTOOL`.
|
|
123
142
|
|
|
143
|
+
### MCP config
|
|
144
|
+
|
|
145
|
+
> **Install the connector-focused `[mcp]` extra.** Examples use `sql-mcp[mcp]` to add
|
|
146
|
+
> FastMCP / FastAPI through `scion-sdk`; the required Scion SDK core
|
|
147
|
+
> enables model orchestration.
|
|
148
|
+
> Combine it with the database-driver extras needed by the deployment.
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"sql-mcp": {
|
|
154
|
+
"command": "uv",
|
|
155
|
+
"args": ["run", "sql-mcp"],
|
|
156
|
+
"env": {
|
|
157
|
+
"SQL_URL": "postgresql+psycopg://svc:****@db.example.com:5432/app",
|
|
158
|
+
"SQL_ALLOW_WRITES": "False"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
<!-- BEGIN GENERATED: additional-deployment-options -->
|
|
166
|
+
### Additional Deployment Options
|
|
167
|
+
|
|
168
|
+
`sql-mcp` can run as a local stdio process or container, or behind a remote
|
|
169
|
+
network boundary. The
|
|
170
|
+
[Deployment guide](https://knuckles-team.github.io/sql-mcp/deployment/) carries
|
|
171
|
+
the detailed transport contract.
|
|
172
|
+
|
|
173
|
+
- **Local container** — launch a reviewed immutable image as a least-privilege
|
|
174
|
+
stdio child with no listener or published port.
|
|
175
|
+
- **Remote URL** — connect through an operator-supplied authenticated HTTPS
|
|
176
|
+
ingress. Keep its URL, outbound identity references, trust profile, and exact
|
|
177
|
+
`MCP_ALLOWED_HOSTS` in `AgentConfig`.
|
|
178
|
+
<!-- END GENERATED: additional-deployment-options -->
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
124
182
|
## Dialects & extras
|
|
125
183
|
|
|
126
184
|
| Dialect | SQLAlchemy scheme | Driver | Install |
|
|
@@ -133,7 +191,45 @@ of the configured connections. The whole set is toggled with `SQLTOOL`.
|
|
|
133
191
|
|
|
134
192
|
`pip install sql-mcp[all]` pulls every driver plus the MCP and agent extras.
|
|
135
193
|
|
|
136
|
-
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Docker deployment
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
docker compose -f docker/mcp.compose.yml up -d # MCP server only
|
|
200
|
+
curl -s http://localhost:8000/health # {"status":"OK"}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Both services read configuration from `../.env` (copy
|
|
204
|
+
[`.env.example`](.env.example)); see [`docs/deployment.md`](docs/deployment.md).
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Safety model
|
|
209
|
+
|
|
210
|
+
- **Read-only by default** — `sql_execute` refuses to run unless the *server* was
|
|
211
|
+
started with `SQL_ALLOW_WRITES=True`; agents cannot flip the flag per call.
|
|
212
|
+
- **Statement allowlist** — `sql_query` accepts only `SELECT`/`WITH`/`EXPLAIN`/
|
|
213
|
+
`SHOW`/`DESCRIBE`/`PRAGMA`/`VALUES`; CTEs are inspected at paren depth zero so
|
|
214
|
+
`WITH ... INSERT` cannot smuggle a write, `SELECT INTO` is rejected, and
|
|
215
|
+
multi-statement payloads are refused.
|
|
216
|
+
- **Bounded results** — per-call row caps clamp to `SQL_MAX_ROWS`; statements run
|
|
217
|
+
under `SQL_TIMEOUT_SECONDS` on a worker thread.
|
|
218
|
+
- **Parameterized only** — values bind via `:name` parameters; identifiers are
|
|
219
|
+
quoted by SQLAlchemy reflection, never hand-interpolated.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Tests
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
python -m pytest # full suite against in-memory SQLite (no live DBs)
|
|
227
|
+
pre-commit run --all-files
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Environment Variables
|
|
137
233
|
|
|
138
234
|
| Var | Default | Meaning |
|
|
139
235
|
|---|---|---|
|
|
@@ -152,6 +248,63 @@ the sole/first one. Passwords are parsed into `sqlalchemy.URL` objects and only
|
|
|
152
248
|
ever rendered redacted. Copy [`.env.example`](.env.example) to `.env` and
|
|
153
249
|
populate only what the operator use.
|
|
154
250
|
|
|
251
|
+
|
|
252
|
+
<!-- ENV-VARS-TABLE:START -->
|
|
253
|
+
|
|
254
|
+
#### Package environment variables
|
|
255
|
+
|
|
256
|
+
| Variable | Example | Description |
|
|
257
|
+
|----------|---------|-------------|
|
|
258
|
+
| `HOST` | `0.0.0.0` | |
|
|
259
|
+
| `PORT` | `8000` | |
|
|
260
|
+
| `TRANSPORT` | `stdio` | options: stdio, streamable-http, sse |
|
|
261
|
+
| `ENABLE_OTEL` | `True` | |
|
|
262
|
+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:8080/api/public/otel` | |
|
|
263
|
+
| `OTEL_EXPORTER_OTLP_PUBLIC_KEY` | secret-injected | |
|
|
264
|
+
| `OTEL_EXPORTER_OTLP_SECRET_KEY` | secret-injected | |
|
|
265
|
+
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | |
|
|
266
|
+
| `EUNOMIA_TYPE` | `none` | options: none, embedded, remote |
|
|
267
|
+
| `EUNOMIA_POLICY_FILE` | `mcp_policies.json` | |
|
|
268
|
+
| `EUNOMIA_REMOTE_URL` | `http://eunomia-server:8000` | |
|
|
269
|
+
| `SQL_CONNECTIONS` | `{"warehouse": "postgresql+psycopg://svc:password@db:5432/dw"}` | Named connections (JSON). DSN strings or {dialect, host, port, username, password, database, options} objects. Takes priority over SQL_URL. |
|
|
270
|
+
| `SQL_URL` | `postgresql+psycopg://svc:password@db.example.com:5432/app` | Single connection (registered as "default") |
|
|
271
|
+
| `SQL_DIALECT` | `postgres` | ... or discrete fields for a single "default" connection |
|
|
272
|
+
| `SQL_HOST` | `db.example.com` | |
|
|
273
|
+
| `SQL_PORT` | `5432` | |
|
|
274
|
+
| `SQL_USERNAME` | `svc` | |
|
|
275
|
+
| `SQL_PASSWORD` | secret-injected | |
|
|
276
|
+
| `SQL_DATABASE` | `app` | |
|
|
277
|
+
| `SQL_OPTIONS` | `{"sslmode": "require"}` | |
|
|
278
|
+
| `SQL_ALLOW_WRITES` | `False` | Policy (read-only by default) |
|
|
279
|
+
| `SQL_MAX_ROWS` | `500` | |
|
|
280
|
+
| `SQL_TIMEOUT_SECONDS` | `30` | |
|
|
281
|
+
| `SQLTOOL` | `True` | |
|
|
282
|
+
|
|
283
|
+
#### Inherited scion-sdk variables (apply to every connector)
|
|
284
|
+
|
|
285
|
+
| Variable | Example | Description |
|
|
286
|
+
|----------|---------|-------------|
|
|
287
|
+
| `MCP_TOOL_MODE` | `intent` | Tool surface: `intent` \| `condensed` \| `verbose` \| `both` |
|
|
288
|
+
| `MCP_ENABLED_TOOLS` | — | Comma-separated tool allow-list |
|
|
289
|
+
| `MCP_DISABLED_TOOLS` | — | Comma-separated tool deny-list |
|
|
290
|
+
| `MCP_ENABLED_TAGS` | — | Comma-separated tag allow-list |
|
|
291
|
+
| `MCP_DISABLED_TAGS` | — | Comma-separated tag deny-list |
|
|
292
|
+
| `MCP_CLIENT_AUTH` | — | Outbound MCP child auth: `oidc-client-credentials` \| `basic` \| `none` |
|
|
293
|
+
| `OIDC_CLIENT_ID` | — | OIDC client id (service-account auth) |
|
|
294
|
+
| `OIDC_CLIENT_SECRET_REF` | `secret://identity/oidc-client-secret` | Runtime secret reference for the OIDC service account |
|
|
295
|
+
| `MCP_BASIC_AUTH_USERNAME` | — | HTTP Basic username (`MCP_CLIENT_AUTH=basic`) |
|
|
296
|
+
| `MCP_BASIC_AUTH_PASSWORD_REF` | `secret://identity/mcp-basic-password` | Runtime secret reference for HTTP Basic auth (`MCP_CLIENT_AUTH=basic`) |
|
|
297
|
+
| `DEBUG` | `False` | Verbose logging |
|
|
298
|
+
| `PYTHONUNBUFFERED` | `1` | Unbuffered stdout (recommended in containers) |
|
|
299
|
+
| `MCP_URL` | `http://localhost:8000/mcp` | URL of the MCP server the agent connects to |
|
|
300
|
+
| `PROVIDER` | `openai` | LLM provider for the agent |
|
|
301
|
+
| `MODEL_ID` | `gpt-4o` | Model id for the agent |
|
|
302
|
+
|
|
303
|
+
_24 package + 16 inherited variable(s). Auto-generated from `.env.example` + the shared scion-sdk set — do not edit._
|
|
304
|
+
<!-- ENV-VARS-TABLE:END -->
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
155
308
|
## Installation
|
|
156
309
|
|
|
157
310
|
Pick the extra that matches what the operator want to run. DB-driver extras
|
|
@@ -193,6 +346,8 @@ Deployment recipes (single-node + Raft HA), connection configuration, and archit
|
|
|
193
346
|
diagrams are documented in the
|
|
194
347
|
[medulla deployment guide](https://knuckles-team.github.io/medulla/deployment/).
|
|
195
348
|
|
|
349
|
+
---
|
|
350
|
+
|
|
196
351
|
## Usage
|
|
197
352
|
|
|
198
353
|
```bash
|
|
@@ -218,72 +373,32 @@ export SQL_CONNECTIONS='{
|
|
|
218
373
|
sql-mcp
|
|
219
374
|
```
|
|
220
375
|
|
|
221
|
-
|
|
376
|
+
---
|
|
222
377
|
|
|
223
|
-
|
|
224
|
-
> FastMCP / FastAPI through `scion-sdk`; the required Scion SDK core
|
|
225
|
-
> enables model orchestration.
|
|
226
|
-
> Combine it with the database-driver extras needed by the deployment.
|
|
378
|
+
## Documentation
|
|
227
379
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"sql-mcp": {
|
|
232
|
-
"command": "uv",
|
|
233
|
-
"args": ["run", "sql-mcp"],
|
|
234
|
-
"env": {
|
|
235
|
-
"SQL_URL": "postgresql+psycopg://svc:****@db.example.com:5432/app",
|
|
236
|
-
"SQL_ALLOW_WRITES": "False"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
```
|
|
380
|
+
The complete documentation is published as the
|
|
381
|
+
[official documentation site](https://knuckles-team.github.io/sql-mcp/) and is
|
|
382
|
+
the recommended reference for installation, deployment, and day-to-day operation.
|
|
242
383
|
|
|
243
|
-
|
|
244
|
-
### Additional Deployment Options
|
|
384
|
+
---
|
|
245
385
|
|
|
246
|
-
|
|
247
|
-
network boundary. The
|
|
248
|
-
[Deployment guide](https://knuckles-team.github.io/sql-mcp/deployment/) carries
|
|
249
|
-
the detailed transport contract.
|
|
250
|
-
|
|
251
|
-
- **Local container** — launch a reviewed immutable image as a least-privilege
|
|
252
|
-
stdio child with no listener or published port.
|
|
253
|
-
- **Remote URL** — connect through an operator-supplied authenticated HTTPS
|
|
254
|
-
ingress. Keep its URL, outbound identity references, trust profile, and exact
|
|
255
|
-
`MCP_ALLOWED_HOSTS` in `AgentConfig`.
|
|
256
|
-
<!-- END GENERATED: additional-deployment-options -->
|
|
257
|
-
|
|
258
|
-
## Docker deployment
|
|
259
|
-
|
|
260
|
-
```bash
|
|
261
|
-
docker compose -f docker/mcp.compose.yml up -d # MCP server only
|
|
262
|
-
curl -s http://localhost:8000/health # {"status":"OK"}
|
|
263
|
-
```
|
|
386
|
+
## Repository Owners
|
|
264
387
|
|
|
265
|
-
|
|
266
|
-
[`.env.example`](.env.example)); see [`docs/deployment.md`](docs/deployment.md).
|
|
388
|
+
<img width="100%" height="180em" src="https://github-readme-stats.vercel.app/api?username=example&show_icons=true&hide_border=true&&count_private=true&include_all_commits=true" />
|
|
267
389
|
|
|
268
|
-
|
|
390
|
+

|
|
391
|
+

|
|
269
392
|
|
|
270
|
-
|
|
271
|
-
started with `SQL_ALLOW_WRITES=True`; agents cannot flip the flag per call.
|
|
272
|
-
- **Statement allowlist** — `sql_query` accepts only `SELECT`/`WITH`/`EXPLAIN`/
|
|
273
|
-
`SHOW`/`DESCRIBE`/`PRAGMA`/`VALUES`; CTEs are inspected at paren depth zero so
|
|
274
|
-
`WITH ... INSERT` cannot smuggle a write, `SELECT INTO` is rejected, and
|
|
275
|
-
multi-statement payloads are refused.
|
|
276
|
-
- **Bounded results** — per-call row caps clamp to `SQL_MAX_ROWS`; statements run
|
|
277
|
-
under `SQL_TIMEOUT_SECONDS` on a worker thread.
|
|
278
|
-
- **Parameterized only** — values bind via `:name` parameters; identifiers are
|
|
279
|
-
quoted by SQLAlchemy reflection, never hand-interpolated.
|
|
393
|
+
---
|
|
280
394
|
|
|
281
|
-
##
|
|
395
|
+
## Contribute
|
|
282
396
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
397
|
+
Contributions are welcome! Please ensure code quality by running local checks before submitting pull requests:
|
|
398
|
+
- Format code using `ruff format .`
|
|
399
|
+
- Lint code using `ruff check .`
|
|
400
|
+
- Validate type-safety with `mypy .`
|
|
401
|
+
- Run test suites using `pytest`
|
|
287
402
|
|
|
288
403
|
<!-- BEGIN scion-sdk-deployment (generated; do not edit between markers) -->
|
|
289
404
|
|
|
@@ -306,62 +421,6 @@ configured secret provider.
|
|
|
306
421
|
|
|
307
422
|
<!-- END scion-sdk-deployment -->
|
|
308
423
|
|
|
309
|
-
## Environment Variables
|
|
310
|
-
|
|
311
|
-
<!-- ENV-VARS-TABLE:START -->
|
|
312
|
-
|
|
313
|
-
#### Package environment variables
|
|
314
|
-
|
|
315
|
-
| Variable | Example | Description |
|
|
316
|
-
|----------|---------|-------------|
|
|
317
|
-
| `HOST` | `0.0.0.0` | |
|
|
318
|
-
| `PORT` | `8000` | |
|
|
319
|
-
| `TRANSPORT` | `stdio` | options: stdio, streamable-http, sse |
|
|
320
|
-
| `ENABLE_OTEL` | `True` | |
|
|
321
|
-
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:8080/api/public/otel` | |
|
|
322
|
-
| `OTEL_EXPORTER_OTLP_PUBLIC_KEY` | secret-injected | |
|
|
323
|
-
| `OTEL_EXPORTER_OTLP_SECRET_KEY` | secret-injected | |
|
|
324
|
-
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | |
|
|
325
|
-
| `EUNOMIA_TYPE` | `none` | options: none, embedded, remote |
|
|
326
|
-
| `EUNOMIA_POLICY_FILE` | `mcp_policies.json` | |
|
|
327
|
-
| `EUNOMIA_REMOTE_URL` | `http://eunomia-server:8000` | |
|
|
328
|
-
| `SQL_CONNECTIONS` | `{"warehouse": "postgresql+psycopg://svc:password@db:5432/dw"}` | Named connections (JSON). DSN strings or {dialect, host, port, username, password, database, options} objects. Takes priority over SQL_URL. |
|
|
329
|
-
| `SQL_URL` | `postgresql+psycopg://svc:password@db.example.com:5432/app` | Single connection (registered as "default") |
|
|
330
|
-
| `SQL_DIALECT` | `postgres` | ... or discrete fields for a single "default" connection |
|
|
331
|
-
| `SQL_HOST` | `db.example.com` | |
|
|
332
|
-
| `SQL_PORT` | `5432` | |
|
|
333
|
-
| `SQL_USERNAME` | `svc` | |
|
|
334
|
-
| `SQL_PASSWORD` | secret-injected | |
|
|
335
|
-
| `SQL_DATABASE` | `app` | |
|
|
336
|
-
| `SQL_OPTIONS` | `{"sslmode": "require"}` | |
|
|
337
|
-
| `SQL_ALLOW_WRITES` | `False` | Policy (read-only by default) |
|
|
338
|
-
| `SQL_MAX_ROWS` | `500` | |
|
|
339
|
-
| `SQL_TIMEOUT_SECONDS` | `30` | |
|
|
340
|
-
| `SQLTOOL` | `True` | |
|
|
341
|
-
|
|
342
|
-
#### Inherited scion-sdk variables (apply to every connector)
|
|
343
|
-
|
|
344
|
-
| Variable | Example | Description |
|
|
345
|
-
|----------|---------|-------------|
|
|
346
|
-
| `MCP_TOOL_MODE` | `intent` | Tool surface: `intent` \| `condensed` \| `verbose` \| `both` |
|
|
347
|
-
| `MCP_ENABLED_TOOLS` | — | Comma-separated tool allow-list |
|
|
348
|
-
| `MCP_DISABLED_TOOLS` | — | Comma-separated tool deny-list |
|
|
349
|
-
| `MCP_ENABLED_TAGS` | — | Comma-separated tag allow-list |
|
|
350
|
-
| `MCP_DISABLED_TAGS` | — | Comma-separated tag deny-list |
|
|
351
|
-
| `MCP_CLIENT_AUTH` | — | Outbound MCP child auth: `oidc-client-credentials` \| `basic` \| `none` |
|
|
352
|
-
| `OIDC_CLIENT_ID` | — | OIDC client id (service-account auth) |
|
|
353
|
-
| `OIDC_CLIENT_SECRET_REF` | `secret://identity/oidc-client-secret` | Runtime secret reference for the OIDC service account |
|
|
354
|
-
| `MCP_BASIC_AUTH_USERNAME` | — | HTTP Basic username (`MCP_CLIENT_AUTH=basic`) |
|
|
355
|
-
| `MCP_BASIC_AUTH_PASSWORD_REF` | `secret://identity/mcp-basic-password` | Runtime secret reference for HTTP Basic auth (`MCP_CLIENT_AUTH=basic`) |
|
|
356
|
-
| `DEBUG` | `False` | Verbose logging |
|
|
357
|
-
| `PYTHONUNBUFFERED` | `1` | Unbuffered stdout (recommended in containers) |
|
|
358
|
-
| `MCP_URL` | `http://localhost:8000/mcp` | URL of the MCP server the agent connects to |
|
|
359
|
-
| `PROVIDER` | `openai` | LLM provider for the agent |
|
|
360
|
-
| `MODEL_ID` | `gpt-4o` | Model id for the agent |
|
|
361
|
-
|
|
362
|
-
_24 package + 16 inherited variable(s). Auto-generated from `.env.example` + the shared scion-sdk set — do not edit._
|
|
363
|
-
<!-- ENV-VARS-TABLE:END -->
|
|
364
|
-
|
|
365
424
|
<!-- GOVERNED-CAPABILITY:START -->
|
|
366
425
|
## Governed capability contract
|
|
367
426
|
|