sql-agent-mcp 0.2.0__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.
@@ -0,0 +1,13 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .env
5
+ *.db
6
+ .pytest_cache/
7
+ .coverage
8
+ htmlcov/
9
+ traces/
10
+ dist/
11
+ build/
12
+ *.egg-info/
13
+ .DS_Store
@@ -0,0 +1,81 @@
1
+ # Changelog
2
+
3
+ Notable changes to this project. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.2.0] - 2026-12-04
8
+
9
+ The first release published to PyPI, as `sql-agent-mcp`, and to the MCP
10
+ registry, as `io.github.Nachodusan/sql-agent`.
11
+
12
+ ### Added
13
+
14
+ - **MCP server.** `sql-agent-mcp` serves five tools over stdio, and over
15
+ streamable HTTP for container hosts: `ask`, `evaluate`, `list_tables`,
16
+ `describe_table` and `run_sql`.
17
+ - **`ask` reports the SQL that actually executed.** `final_sql` only ever holds
18
+ a query that ran; whatever the model typed into its answer is kept apart as
19
+ `claimed_sql`, and `sql_was_executed` tells the two cases apart.
20
+ - **`evaluate`** runs a golden set against the connected database and returns
21
+ accuracy, every failure with its reason, the tool path and the cost. It grades
22
+ by executing the agent's SQL and comparing result sets with a hand-written
23
+ reference.
24
+ - **PostgreSQL**, alongside SQLite, behind one connection string in
25
+ `SQL_AGENT_DSN` or `--dsn`. PostgreSQL connections are read-only three ways:
26
+ `default_transaction_read_only`, a `READ ONLY` transaction and a
27
+ `statement_timeout`. Install the driver with `sql-agent-mcp[postgres]`.
28
+ - **An adapter layer** (`sql_agent.adapters`), so another engine is a subclass
29
+ and one registry entry rather than a change to the tools.
30
+ - **`--demo`** and `SQL_AGENT_DEMO=1`, to use the bundled sample database.
31
+ - **A golden set of 34 cases** over 26 labelled traps, up from 8. Every
32
+ reference query was executed. Four cases are marked ambiguous and reported
33
+ apart from the headline accuracy.
34
+ - `evaluate` and `run_eval.py` accept your own golden file and your own
35
+ database.
36
+
37
+ ### Changed
38
+
39
+ - **The statement guard parses instead of matching words.** The regular
40
+ expression it replaces rejected valid queries — `SELECT replace(name, 'a',
41
+ 'b')`, any string containing `create` — and could not see a second statement
42
+ after a semicolon or a write inside a CTE. `sql_agent.sqlguard` accepts
43
+ exactly one read-only query, parsed with sqlglot in the target dialect.
44
+ - **The system prompt names the engine** it is pointed at and no longer asserts
45
+ that money is stored in cents, which was a fact about the sample database.
46
+ Results from before this change are not comparable with results after it.
47
+ - **There is no default database.** Pass `--dsn`, `--db` or `--demo`, or set
48
+ `SQL_AGENT_DSN`.
49
+ - The distribution is named `sql-agent-mcp`. The import package is still
50
+ `sql_agent` and the commands are still `sql-agent` and `sql-agent-mcp`.
51
+
52
+ ### Fixed
53
+
54
+ - **The sample database is no longer built behind your back.** Connecting to a
55
+ path that did not exist used to create the sample database there, so a typo
56
+ produced an agent answering questions about fictional data. A path or DSN
57
+ that does not resolve is now an error.
58
+ - **A run that hits the step budget keeps the SQL it ran.** The `max_steps`
59
+ exit never recorded `final_sql`, so such a run was reported as having
60
+ produced no SQL while its own step list showed a successful query. It is
61
+ still graded as a failure, with the true reason.
62
+ - Installed from a wheel, `--demo` wrote the sample database into
63
+ `site-packages`. It now goes to the user data directory.
64
+ - Installed from a wheel, `evaluate` with no arguments could not find the
65
+ bundled golden set.
66
+
67
+ ### Measured
68
+
69
+ DeepSeek-V3 on the 34-case set, sample database, one run per case: 18/34
70
+ overall and 17/30 on the unambiguous cases, for $0.0679. Eleven of the thirteen
71
+ unambiguous failures are valid SQL returning a plausible wrong number. A second
72
+ run with a 20-step budget scored 20/34; four cases changed result between the
73
+ two runs, and the larger budget rescued none of the three that had run out.
74
+
75
+ ## [0.1.0]
76
+
77
+ Never published. The agent loop as a LangGraph state machine, four tools over a
78
+ single SQLite file, per-step tracing with latency and cost, and an 8-case
79
+ golden set graded on result sets.
80
+
81
+ [0.2.0]: https://github.com/Nachodusan/sql-agent/releases/tag/v0.2.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ignacio Duque Sandoval
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.