sql-mcp 2.3.8__tar.gz → 2.3.10__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.8/sql_mcp.egg-info → sql_mcp-2.3.10}/PKG-INFO +192 -133
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/README.md +190 -131
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/pyproject.toml +2 -2
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/__init__.py +3 -3
- sql_mcp-2.3.10/sql_mcp/api_client.py +41 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/auth.py +1 -1
- sql_mcp-2.3.10/sql_mcp/connector_contracts.py +630 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/connector_sources.py +17 -1
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/kg_ingest.py +12 -3
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/kg_pgwire.py +5 -5
- sql_mcp-2.3.10/sql_mcp/mcp/mcp_sql.py +112 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/__init__.py +1 -1
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/certification.json +3 -3
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/database.ttl +8 -32
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/shapes/connector.shacl.ttl +2 -2
- sql_mcp-2.3.10/sql_mcp/prompts/sql-mcp-data-analyst.json +52 -0
- sql_mcp-2.3.10/sql_mcp/prompts/sql-mcp-data-steward.json +50 -0
- sql_mcp-2.3.10/sql_mcp/prompts/sql-mcp-database-administrator.json +70 -0
- sql_mcp-2.3.10/sql_mcp/prompts/sql-mcp-operator.json +74 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-development/SKILL.md +18 -2
- sql_mcp-2.3.10/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md +93 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/WORKFLOW.md +14 -21
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-operations/SKILL.md +17 -1
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-operations/references/catalog.md +1 -1
- sql_mcp-2.3.10/sql_mcp/skills/sql-mcp-query-execution/SKILL.md +95 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-query-execution/WORKFLOW.md +16 -25
- sql_mcp-2.3.10/sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md +87 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-schema-inspection/WORKFLOW.md +18 -30
- {sql_mcp-2.3.8 → sql_mcp-2.3.10/sql_mcp.egg-info}/PKG-INFO +192 -133
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp.egg-info/SOURCES.txt +7 -2
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp.egg-info/requires.txt +1 -1
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_api_wrapper.py +1 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_identity_context_scoping.py +1 -5
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_kg_ingest.py +8 -5
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_kg_pgwire.py +1 -1
- sql_mcp-2.3.10/tests/test_ontology_extends_core.py +24 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_package_getattr.py +0 -8
- sql_mcp-2.3.10/tests/test_scion_sdk_0_10_imports.py +59 -0
- sql_mcp-2.3.10/tests/test_sql_mcp_validation.py +278 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_startup.py +2 -2
- sql_mcp-2.3.8/sql_mcp/api_client.py +0 -9
- sql_mcp-2.3.8/sql_mcp/mcp/mcp_sql.py +0 -625
- sql_mcp-2.3.8/sql_mcp/prompts/database_specialist.json +0 -42
- sql_mcp-2.3.8/sql_mcp/skills/sql-mcp-knowledge-graph-ingestion/SKILL.md +0 -89
- sql_mcp-2.3.8/sql_mcp/skills/sql-mcp-query-execution/SKILL.md +0 -93
- sql_mcp-2.3.8/sql_mcp/skills/sql-mcp-schema-inspection/SKILL.md +0 -88
- sql_mcp-2.3.8/sql_mcp/sql_input_models.py +0 -129
- sql_mcp-2.3.8/tests/test_sql_mcp_validation.py +0 -406
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/LICENSE +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/setup.cfg +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/__main__.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/api/__init__.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/api/api_client_sql.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/dialects.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/mcp/__init__.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/mcp_config.json +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/mcp_server.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/fixtures/records.json +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/mappings/source.yaml +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/ontology/migrations/manifest.json +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/safety.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/skills/sql-mcp-operations/agents/openai.yaml +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp/sql_response_models.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp.egg-info/dependency_links.txt +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp.egg-info/entry_points.txt +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/sql_mcp.egg-info/top_level.txt +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_auth.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_dialect_paths.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_dialects.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_init_dynamics.py +0 -0
- {sql_mcp-2.3.8 → sql_mcp-2.3.10}/tests/test_safety.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.10
|
|
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]<0.
|
|
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,104 +140,7 @@ _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
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| Dialect | SQLAlchemy scheme | Driver | Install |
|
|
127
|
-
|---|---|---|---|
|
|
128
|
-
| SQLite | `sqlite+pysqlite` | stdlib | `pip install sql-mcp` (core) |
|
|
129
|
-
| PostgreSQL | `postgresql+psycopg` | psycopg 3 | `pip install sql-mcp[postgres]` |
|
|
130
|
-
| MySQL / MariaDB | `mysql+pymysql` | PyMySQL | `pip install sql-mcp[mysql]` |
|
|
131
|
-
| SQL Server | `mssql+pyodbc` | pyodbc | `pip install sql-mcp[mssql]` |
|
|
132
|
-
| Oracle | `oracle+oracledb` | python-oracledb | `pip install sql-mcp[oracle]` |
|
|
133
|
-
|
|
134
|
-
`pip install sql-mcp[all]` pulls every driver plus the MCP and agent extras.
|
|
135
|
-
|
|
136
|
-
## Configuration (environment)
|
|
137
|
-
|
|
138
|
-
| Var | Default | Meaning |
|
|
139
|
-
|---|---|---|
|
|
140
|
-
| `SQL_CONNECTIONS` | _(empty)_ | JSON map of named connections: DSN strings or `{dialect, host, port, username, password, database, options}` objects |
|
|
141
|
-
| `SQL_URL` | _(empty)_ | Single DSN registered as connection `default` |
|
|
142
|
-
| `SQL_DIALECT` / `SQL_HOST` / `SQL_PORT` / `SQL_USERNAME` / `SQL_PASSWORD` / `SQL_DATABASE` / `SQL_OPTIONS` | _(empty)_ | Discrete fields for a single `default` connection |
|
|
143
|
-
| `SQL_ALLOW_WRITES` | `False` | Enable `sql_execute` (DML/DDL). **Read-only by default** |
|
|
144
|
-
| `SQL_MAX_ROWS` | `500` | Per-call row cap; tool requests are clamped to it |
|
|
145
|
-
| `SQL_TIMEOUT_SECONDS` | `30` | Per-statement timeout |
|
|
146
|
-
| `SQLTOOL` | `True` | Register the SQL tool set |
|
|
147
|
-
|
|
148
|
-
With nothing configured the server registers a zero-infra in-memory SQLite
|
|
149
|
-
connection named `memory`, so it works by default. Tools take an optional
|
|
150
|
-
`connection` parameter naming one of the configured connections; it defaults to
|
|
151
|
-
the sole/first one. Passwords are parsed into `sqlalchemy.URL` objects and only
|
|
152
|
-
ever rendered redacted. Copy [`.env.example`](.env.example) to `.env` and
|
|
153
|
-
populate only what the operator use.
|
|
154
|
-
|
|
155
|
-
## Installation
|
|
156
|
-
|
|
157
|
-
Pick the extra that matches what the operator want to run. DB-driver extras
|
|
158
|
-
(`postgres` / `mysql` / `mssql` / `oracle`) are **additive** — combine them with
|
|
159
|
-
|
|
160
|
-
| Extra | Installs | Use when |
|
|
161
|
-
|-------|----------|----------|
|
|
162
|
-
| `sql-mcp[mcp]` | Connector-focused MCP server (`scion-sdk` — FastMCP/FastAPI + `epistemic-graph[full]`) | The operator only run the **MCP server** (smallest install / image) |
|
|
163
|
-
| `sql-mcp[all]` | Everything (`mcp` + `agent` + **every** DB driver + `logfire`) | Development / both surfaces |
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
pip install sql-mcp # core (SQLite only, MCP server, API)
|
|
167
|
-
pip install "sql-mcp[mcp]" # connector-focused MCP server (add drivers: [mcp,postgres])
|
|
168
|
-
pip install "sql-mcp[all]" # every driver + MCP + agent extras
|
|
169
|
-
pip install -e . # from source
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Container images (`:mcp`)
|
|
173
|
-
|
|
174
|
-
One multi-stage `docker/Dockerfile` builds the MCP-only image (`--target mcp`):
|
|
175
|
-
|
|
176
|
-
| Image tag | Build target | Contents | Entrypoint |
|
|
177
|
-
|-----------|--------------|----------|------------|
|
|
178
|
-
| `example/sql-mcp:mcp` | `--target mcp` | `sql-mcp[mcp]` — **connector-focused**, includes `epistemic-graph[full]`; no model-orchestration stack | `sql-mcp` |
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
docker pull example/sql-mcp:mcp # connector-focused MCP server
|
|
182
|
-
docker build --target mcp -t example/sql-mcp:mcp docker/ # build MCP server
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
agent (`immutable agent digest`) with a co-located `:mcp` sidecar.
|
|
186
|
-
|
|
187
|
-
### Knowledge-graph database (`epistemic-graph`)
|
|
188
|
-
|
|
189
|
-
Scion SDK core dependency (`epistemic-graph[full]`). The `[mcp]` extra keeps
|
|
190
|
-
deployments can use the bundled engine. For production or shared state, run
|
|
191
|
-
**epistemic-graph as a dedicated database service** and configure the runtime to use it.
|
|
192
|
-
Deployment recipes (single-node + Raft HA), connection configuration, and architecture
|
|
193
|
-
diagrams are documented in the
|
|
194
|
-
[epistemic-graph deployment guide](https://knuckles-team.github.io/epistemic-graph/deployment/).
|
|
195
|
-
|
|
196
|
-
## Usage
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
sql-mcp # stdio MCP server (default transport)
|
|
200
|
-
sql-mcp --transport streamable-http --host 0.0.0.0 --port 8000
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Point it at a database:
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
export SQL_URL="postgresql+psycopg://svc:****@db.example.com:5432/app"
|
|
207
|
-
sql-mcp
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Or multiple:
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
export SQL_CONNECTIONS='{
|
|
214
|
-
"warehouse": "postgresql+psycopg://svc:****@dw.example.com:5432/dw",
|
|
215
|
-
"erp": {"dialect": "mysql", "host": "erp.example.com", "username": "svc",
|
|
216
|
-
"password": "****", "database": "erp"}
|
|
217
|
-
}'
|
|
218
|
-
sql-mcp
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
## MCP config
|
|
143
|
+
### MCP config
|
|
222
144
|
|
|
223
145
|
> **Install the connector-focused `[mcp]` extra.** Examples use `sql-mcp[mcp]` to add
|
|
224
146
|
> FastMCP / FastAPI through `scion-sdk`; the required Scion SDK core
|
|
@@ -255,6 +177,22 @@ the detailed transport contract.
|
|
|
255
177
|
`MCP_ALLOWED_HOSTS` in `AgentConfig`.
|
|
256
178
|
<!-- END GENERATED: additional-deployment-options -->
|
|
257
179
|
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Dialects & extras
|
|
183
|
+
|
|
184
|
+
| Dialect | SQLAlchemy scheme | Driver | Install |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| SQLite | `sqlite+pysqlite` | stdlib | `pip install sql-mcp` (core) |
|
|
187
|
+
| PostgreSQL | `postgresql+psycopg` | psycopg 3 | `pip install sql-mcp[postgres]` |
|
|
188
|
+
| MySQL / MariaDB | `mysql+pymysql` | PyMySQL | `pip install sql-mcp[mysql]` |
|
|
189
|
+
| SQL Server | `mssql+pyodbc` | pyodbc | `pip install sql-mcp[mssql]` |
|
|
190
|
+
| Oracle | `oracle+oracledb` | python-oracledb | `pip install sql-mcp[oracle]` |
|
|
191
|
+
|
|
192
|
+
`pip install sql-mcp[all]` pulls every driver plus the MCP and agent extras.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
258
196
|
## Docker deployment
|
|
259
197
|
|
|
260
198
|
```bash
|
|
@@ -265,6 +203,8 @@ curl -s http://localhost:8000/health # {"status":"OK"}
|
|
|
265
203
|
Both services read configuration from `../.env` (copy
|
|
266
204
|
[`.env.example`](.env.example)); see [`docs/deployment.md`](docs/deployment.md).
|
|
267
205
|
|
|
206
|
+
---
|
|
207
|
+
|
|
268
208
|
## Safety model
|
|
269
209
|
|
|
270
210
|
- **Read-only by default** — `sql_execute` refuses to run unless the *server* was
|
|
@@ -278,6 +218,8 @@ Both services read configuration from `../.env` (copy
|
|
|
278
218
|
- **Parameterized only** — values bind via `:name` parameters; identifiers are
|
|
279
219
|
quoted by SQLAlchemy reflection, never hand-interpolated.
|
|
280
220
|
|
|
221
|
+
---
|
|
222
|
+
|
|
281
223
|
## Tests
|
|
282
224
|
|
|
283
225
|
```bash
|
|
@@ -285,28 +227,27 @@ python -m pytest # full suite against in-memory SQLite (no live DBs)
|
|
|
285
227
|
pre-commit run --all-files
|
|
286
228
|
```
|
|
287
229
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
## Deploy with `scion-sdk-deployment`
|
|
291
|
-
|
|
292
|
-
Provision this package with the consolidated **`scion-sdk-deployment`**
|
|
293
|
-
workflow. It selects an installed-package, editable-source, or immutable-container
|
|
294
|
-
path; records only runtime secret and TLS-profile references in `AgentConfig`; and
|
|
295
|
-
runs doctor, registration, policy, observability, and rollback gates. Ask your agent
|
|
296
|
-
to **"deploy `sql-mcp` with scion-sdk-deployment"**.
|
|
230
|
+
---
|
|
297
231
|
|
|
298
|
-
|
|
299
|
-
|------|---------|
|
|
300
|
-
| Installed package | `uv tool install "sql-mcp[mcp]"`, then run `sql-mcp` |
|
|
301
|
-
| Immutable container | deploy `registry.example.invalid/sql-mcp@sha256:<digest>` through the operator-selected orchestrator |
|
|
232
|
+
## Environment Variables
|
|
302
233
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
234
|
+
| Var | Default | Meaning |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| `SQL_CONNECTIONS` | _(empty)_ | JSON map of named connections: DSN strings or `{dialect, host, port, username, password, database, options}` objects |
|
|
237
|
+
| `SQL_URL` | _(empty)_ | Single DSN registered as connection `default` |
|
|
238
|
+
| `SQL_DIALECT` / `SQL_HOST` / `SQL_PORT` / `SQL_USERNAME` / `SQL_PASSWORD` / `SQL_DATABASE` / `SQL_OPTIONS` | _(empty)_ | Discrete fields for a single `default` connection |
|
|
239
|
+
| `SQL_ALLOW_WRITES` | `False` | Enable `sql_execute` (DML/DDL). **Read-only by default** |
|
|
240
|
+
| `SQL_MAX_ROWS` | `500` | Per-call row cap; tool requests are clamped to it |
|
|
241
|
+
| `SQL_TIMEOUT_SECONDS` | `30` | Per-statement timeout |
|
|
242
|
+
| `SQLTOOL` | `True` | Register the SQL tool set |
|
|
306
243
|
|
|
307
|
-
|
|
244
|
+
With nothing configured the server registers a zero-infra in-memory SQLite
|
|
245
|
+
connection named `memory`, so it works by default. Tools take an optional
|
|
246
|
+
`connection` parameter naming one of the configured connections; it defaults to
|
|
247
|
+
the sole/first one. Passwords are parsed into `sqlalchemy.URL` objects and only
|
|
248
|
+
ever rendered redacted. Copy [`.env.example`](.env.example) to `.env` and
|
|
249
|
+
populate only what the operator use.
|
|
308
250
|
|
|
309
|
-
## Environment Variables
|
|
310
251
|
|
|
311
252
|
<!-- ENV-VARS-TABLE:START -->
|
|
312
253
|
|
|
@@ -362,6 +303,124 @@ configured secret provider.
|
|
|
362
303
|
_24 package + 16 inherited variable(s). Auto-generated from `.env.example` + the shared scion-sdk set — do not edit._
|
|
363
304
|
<!-- ENV-VARS-TABLE:END -->
|
|
364
305
|
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Installation
|
|
309
|
+
|
|
310
|
+
Pick the extra that matches what the operator want to run. DB-driver extras
|
|
311
|
+
(`postgres` / `mysql` / `mssql` / `oracle`) are **additive** — combine them with
|
|
312
|
+
|
|
313
|
+
| Extra | Installs | Use when |
|
|
314
|
+
|-------|----------|----------|
|
|
315
|
+
| `sql-mcp[mcp]` | Connector-focused MCP server (`scion-sdk` — FastMCP/FastAPI + `medulla[full]`) | The operator only run the **MCP server** (smallest install / image) |
|
|
316
|
+
| `sql-mcp[all]` | Everything (`mcp` + `agent` + **every** DB driver + `logfire`) | Development / both surfaces |
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
pip install sql-mcp # core (SQLite only, MCP server, API)
|
|
320
|
+
pip install "sql-mcp[mcp]" # connector-focused MCP server (add drivers: [mcp,postgres])
|
|
321
|
+
pip install "sql-mcp[all]" # every driver + MCP + agent extras
|
|
322
|
+
pip install -e . # from source
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Container images (`:mcp`)
|
|
326
|
+
|
|
327
|
+
One multi-stage `docker/Dockerfile` builds the MCP-only image (`--target mcp`):
|
|
328
|
+
|
|
329
|
+
| Image tag | Build target | Contents | Entrypoint |
|
|
330
|
+
|-----------|--------------|----------|------------|
|
|
331
|
+
| `example/sql-mcp:mcp` | `--target mcp` | `sql-mcp[mcp]` — **connector-focused**, includes `medulla[full]`; no model-orchestration stack | `sql-mcp` |
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
docker pull example/sql-mcp:mcp # connector-focused MCP server
|
|
335
|
+
docker build --target mcp -t example/sql-mcp:mcp docker/ # build MCP server
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
agent (`immutable agent digest`) with a co-located `:mcp` sidecar.
|
|
339
|
+
|
|
340
|
+
### Knowledge-graph database (`medulla`)
|
|
341
|
+
|
|
342
|
+
Scion SDK core dependency (`medulla[full]`). The `[mcp]` extra keeps
|
|
343
|
+
deployments can use the bundled engine. For production or shared state, run
|
|
344
|
+
**medulla as a dedicated database service** and configure the runtime to use it.
|
|
345
|
+
Deployment recipes (single-node + Raft HA), connection configuration, and architecture
|
|
346
|
+
diagrams are documented in the
|
|
347
|
+
[medulla deployment guide](https://knuckles-team.github.io/medulla/deployment/).
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Usage
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
sql-mcp # stdio MCP server (default transport)
|
|
355
|
+
sql-mcp --transport streamable-http --host 0.0.0.0 --port 8000
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Point it at a database:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
export SQL_URL="postgresql+psycopg://svc:****@db.example.com:5432/app"
|
|
362
|
+
sql-mcp
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Or multiple:
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
export SQL_CONNECTIONS='{
|
|
369
|
+
"warehouse": "postgresql+psycopg://svc:****@dw.example.com:5432/dw",
|
|
370
|
+
"erp": {"dialect": "mysql", "host": "erp.example.com", "username": "svc",
|
|
371
|
+
"password": "****", "database": "erp"}
|
|
372
|
+
}'
|
|
373
|
+
sql-mcp
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Documentation
|
|
379
|
+
|
|
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.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Repository Owners
|
|
387
|
+
|
|
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" />
|
|
389
|
+
|
|
390
|
+

|
|
391
|
+

|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Contribute
|
|
396
|
+
|
|
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`
|
|
402
|
+
|
|
403
|
+
<!-- BEGIN scion-sdk-deployment (generated; do not edit between markers) -->
|
|
404
|
+
|
|
405
|
+
## Deploy with `scion-sdk-deployment`
|
|
406
|
+
|
|
407
|
+
Provision this package with the consolidated **`scion-sdk-deployment`**
|
|
408
|
+
workflow. It selects an installed-package, editable-source, or immutable-container
|
|
409
|
+
path; records only runtime secret and TLS-profile references in `AgentConfig`; and
|
|
410
|
+
runs doctor, registration, policy, observability, and rollback gates. Ask your agent
|
|
411
|
+
to **"deploy `sql-mcp` with scion-sdk-deployment"**.
|
|
412
|
+
|
|
413
|
+
| Install mode | Command |
|
|
414
|
+
|------|---------|
|
|
415
|
+
| Installed package | `uv tool install "sql-mcp[mcp]"`, then run `sql-mcp` |
|
|
416
|
+
| Immutable container | deploy `registry.example.invalid/sql-mcp@sha256:<digest>` through the operator-selected orchestrator |
|
|
417
|
+
|
|
418
|
+
The repository embeds no deployment profile, credential value, certificate path, or
|
|
419
|
+
environment-specific endpoint. Supply those at runtime through `AgentConfig` and the
|
|
420
|
+
configured secret provider.
|
|
421
|
+
|
|
422
|
+
<!-- END scion-sdk-deployment -->
|
|
423
|
+
|
|
365
424
|
<!-- GOVERNED-CAPABILITY:START -->
|
|
366
425
|
## Governed capability contract
|
|
367
426
|
|