mcp-sequel 0.2.1__tar.gz → 0.2.2__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.
Files changed (30) hide show
  1. mcp_sequel-0.2.2/CHANGELOG.md +53 -0
  2. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/PKG-INFO +2 -2
  3. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/adapters/base.py +3 -1
  4. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/adapters/mysql.py +5 -1
  5. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/adapters/postgres.py +3 -1
  6. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/adapters/sqlite.py +5 -1
  7. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/server.py +9 -3
  8. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/pyproject.toml +2 -2
  9. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/adapters/test_mysql.py +18 -0
  10. mcp_sequel-0.2.2/tests/test_server_query.py +39 -0
  11. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/uv.lock +11 -5
  12. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/.github/workflows/ci.yml +0 -0
  13. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/.github/workflows/publish.yml +0 -0
  14. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/.github/workflows/test.yml +0 -0
  15. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/.gitignore +0 -0
  16. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/LICENSE +0 -0
  17. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/README.md +0 -0
  18. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/__init__.py +0 -0
  19. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/adapters/__init__.py +0 -0
  20. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/config.py +0 -0
  21. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/pool.py +0 -0
  22. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/mcp_sequel/tunnel.py +0 -0
  23. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/adapters/__init__.py +0 -0
  24. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/adapters/test_base.py +0 -0
  25. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/adapters/test_postgresql.py +0 -0
  26. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/adapters/test_sqlite.py +0 -0
  27. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/test_config_ssh.py +0 -0
  28. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/test_pool.py +0 -0
  29. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/test_server_version.py +0 -0
  30. {mcp_sequel-0.2.1 → mcp_sequel-0.2.2}/tests/test_tunnel.py +0 -0
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5
+
6
+ ## [0.2.2] - 2026-07-31
7
+
8
+ ### Fixed
9
+ - MySQL queries no longer hang forever if the network connection drops mid-query; added a per-query timeout, default 60s (#29). PostgreSQL, SQLite, and SSH-tunnel connections are not yet covered.
10
+ - Pinned `mcp` SDK to `>=1.28,<2`, fixing `uvx mcp-sequel` crashing with `ModuleNotFoundError: mcp.server.fastmcp` (an unbounded dependency resolve was pulling in the incompatible `mcp` 2.0 SDK).
11
+
12
+ ### Security
13
+ - Upgraded `mcp` SDK to `>=1.28.1`, resolving 3 high-severity vulnerabilities: unauthorized task cancellation, missing HTTP transport principal verification, and missing WebSocket Host/Origin validation (#30).
14
+
15
+ ## [0.2.1] - 2026-06-29
16
+
17
+ ### Security
18
+ - Upgraded vulnerable transitive dependencies (#27).
19
+
20
+ ## [0.2.0] - 2026-06-12
21
+
22
+ ### Added
23
+ - PostgreSQL adapter with per-database connection pooling (#4).
24
+
25
+ ### Changed
26
+ - Replaced the `sshtunnel` dependency with direct SSH port forwarding via paramiko (#25).
27
+
28
+ ## [0.1.2] - 2026-05-27
29
+
30
+ ### Added
31
+ - `get_version` MCP tool exposing the installed mcp-sequel version.
32
+ - Pre-merge CI check blocking RC versions from merging to `main`.
33
+ - CI requires tests to pass before publishing to PyPI.
34
+
35
+ ### Changed
36
+ - Swapped `mysql-connector-python` for PyMySQL, dropping the explicit `paramiko` dependency (#17).
37
+
38
+ ### Fixed
39
+ - Re-added the `paramiko<3.0` pin to fix SSH tunnels broken by the PyMySQL swap (#17).
40
+
41
+ ## [0.1.1] - 2026-05-12
42
+
43
+ ### Changed
44
+ - Switched publishing from TestPyPI to production PyPI (#8).
45
+
46
+ ## [0.1.0.1] - 2026-05-12
47
+
48
+ ### Added
49
+ - Initial MCP server with a `list_connections` tool.
50
+ - `query` tool with a MySQL adapter, connection pooling, and a readonly guard (#2).
51
+ - SQLite adapter support (#5).
52
+ - Connect to databases via an SSH tunnel (#7).
53
+ - CI setup and TestPyPI publish workflow (#13).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-sequel
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: MCP server for Claude that connects to MySQL, MariaDB, PostgreSQL, and SQLite databases
5
5
  Project-URL: Homepage, https://github.com/eukos/mcp-sequel
6
6
  Author-email: Eugene Kosyakov <eukos@yandex.by>
@@ -9,7 +9,7 @@ License-File: LICENSE
9
9
  Keywords: ai,claude,llm,mariadb,mcp,mysql,postgresql,sqlite
10
10
  Classifier: Development Status :: 4 - Beta
11
11
  Requires-Python: >=3.10
12
- Requires-Dist: mcp[cli]>=1.0
12
+ Requires-Dist: mcp[cli]<2,>=1.28
13
13
  Requires-Dist: paramiko>=5.0
14
14
  Requires-Dist: psycopg[binary]>=3.3.4
15
15
  Requires-Dist: pydantic>=2.0
@@ -67,7 +67,9 @@ class BaseAdapter(ABC):
67
67
  def ping(self, conn: Any) -> bool: ...
68
68
 
69
69
  @abstractmethod
70
- def execute(self, conn: Any, sql: str, database: str | None) -> QueryResult: ...
70
+ def execute(
71
+ self, conn: Any, sql: str, database: str | None, timeout: int = 60
72
+ ) -> QueryResult: ...
71
73
 
72
74
  @abstractmethod
73
75
  def close(self, conn: Any) -> None: ...
@@ -58,7 +58,11 @@ class MySQLAdapter(BaseAdapter):
58
58
  conn.ping(reconnect=True)
59
59
  return True
60
60
 
61
- def execute(self, conn: Any, sql: str, database: str | None) -> QueryResult:
61
+ def execute(
62
+ self, conn: Any, sql: str, database: str | None, timeout: int = 60
63
+ ) -> QueryResult:
64
+ conn._read_timeout = timeout
65
+ conn._write_timeout = timeout
62
66
  cursor = conn.cursor()
63
67
  try:
64
68
  if database is not None:
@@ -57,7 +57,9 @@ class PostgreSQLAdapter(BaseAdapter):
57
57
  conn.execute("SELECT 1")
58
58
  return True
59
59
 
60
- def execute(self, conn: Any, sql: str, database: str | None) -> QueryResult:
60
+ def execute(
61
+ self, conn: Any, sql: str, database: str | None, timeout: int = 60
62
+ ) -> QueryResult:
61
63
  if database is not None and database != self._database:
62
64
  raise RuntimeError(
63
65
  f"PostgreSQL does not support switching databases mid-connection "
@@ -19,7 +19,11 @@ class SQLiteAdapter(BaseAdapter):
19
19
  return True
20
20
 
21
21
  def execute(
22
- self, conn: sqlite3.Connection, sql: str, database: str | None
22
+ self,
23
+ conn: sqlite3.Connection,
24
+ sql: str,
25
+ database: str | None,
26
+ timeout: int = 60,
23
27
  ) -> QueryResult:
24
28
  cursor = conn.execute(sql)
25
29
  columns = [desc[0] for desc in cursor.description] if cursor.description else []
@@ -58,8 +58,14 @@ def list_connections() -> str:
58
58
 
59
59
 
60
60
  @mcp.tool()
61
- def query(connection: str, sql: str, database: str | None = None) -> str:
62
- """Execute a SQL query on a database connection. Returns JSON with columns, rows, row_count, limit_applied."""
61
+ def query(
62
+ connection: str, sql: str, database: str | None = None, timeout: int = 60
63
+ ) -> str:
64
+ """Execute a SQL query on a database connection. Returns JSON with columns, rows, row_count, limit_applied.
65
+
66
+ timeout: max seconds to wait for the query to complete (default 60). Raise this
67
+ for known-heavy queries. Currently enforced for MySQL/MariaDB connections only.
68
+ """
63
69
  try:
64
70
  cfg, adapter, conn = get_connection(connection, database)
65
71
 
@@ -74,7 +80,7 @@ def query(connection: str, sql: str, database: str | None = None) -> str:
74
80
  actual_sql = sql.rstrip().rstrip(";") + f" LIMIT {cfg.row_limit}"
75
81
  limit_applied = cfg.row_limit
76
82
 
77
- result = adapter.execute(conn, actual_sql, database)
83
+ result = adapter.execute(conn, actual_sql, database, timeout)
78
84
  result.limit_applied = limit_applied
79
85
 
80
86
  return json.dumps(
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mcp-sequel"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "MCP server for Claude that connects to MySQL, MariaDB, PostgreSQL, and SQLite databases"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Eugene Kosyakov", email = "eukos@yandex.by" }]
@@ -15,7 +15,7 @@ classifiers = [
15
15
  ]
16
16
  keywords = ["mcp", "mysql", "mariadb", "postgresql", "sqlite", "claude", "llm", "ai"]
17
17
  dependencies = [
18
- "mcp[cli]>=1.0",
18
+ "mcp[cli]>=1.28,<2",
19
19
  "pymysql>=1.2",
20
20
  "sqlglot>=20.0",
21
21
  "pydantic>=2.0",
@@ -94,6 +94,24 @@ def test_execute_empty_result(adapter):
94
94
  assert result.row_count == 0
95
95
 
96
96
 
97
+ def test_execute_applies_default_timeout(adapter):
98
+ conn, _ = _make_conn(None, [])
99
+
100
+ adapter.execute(conn, "SELECT 1", None)
101
+
102
+ assert conn._read_timeout == 60
103
+ assert conn._write_timeout == 60
104
+
105
+
106
+ def test_execute_applies_explicit_timeout(adapter):
107
+ conn, _ = _make_conn(None, [])
108
+
109
+ adapter.execute(conn, "SELECT 1", None, timeout=5)
110
+
111
+ assert conn._read_timeout == 5
112
+ assert conn._write_timeout == 5
113
+
114
+
97
115
  # --- tunnel integration ---
98
116
 
99
117
 
@@ -0,0 +1,39 @@
1
+ from unittest.mock import MagicMock, patch
2
+
3
+ import mcp_sequel.server as server
4
+
5
+
6
+ class _Config:
7
+ readonly = False
8
+ row_limit = None
9
+
10
+
11
+ def _make_adapter():
12
+ adapter = MagicMock()
13
+ adapter.sqlglot_dialect = "mysql"
14
+ adapter.execute.return_value = MagicMock(
15
+ columns=["x"], rows=[[1]], row_count=1, limit_applied=None
16
+ )
17
+ return adapter
18
+
19
+
20
+ def test_query_forwards_explicit_timeout():
21
+ cfg = _Config()
22
+ adapter = _make_adapter()
23
+ conn = MagicMock()
24
+
25
+ with patch("mcp_sequel.server.get_connection", return_value=(cfg, adapter, conn)):
26
+ server.query("myconn", "SELECT 1", timeout=5)
27
+
28
+ adapter.execute.assert_called_once_with(conn, "SELECT 1", None, 5)
29
+
30
+
31
+ def test_query_forwards_default_timeout():
32
+ cfg = _Config()
33
+ adapter = _make_adapter()
34
+ conn = MagicMock()
35
+
36
+ with patch("mcp_sequel.server.get_connection", return_value=(cfg, adapter, conn)):
37
+ server.query("myconn", "SELECT 1")
38
+
39
+ adapter.execute.assert_called_once_with(conn, "SELECT 1", None, 60)
@@ -1,6 +1,12 @@
1
1
  version = 1
2
2
  revision = 3
3
3
  requires-python = ">=3.10"
4
+ resolution-markers = [
5
+ "python_full_version >= '3.14' and sys_platform == 'win32'",
6
+ "python_full_version >= '3.14' and sys_platform != 'win32'",
7
+ "python_full_version < '3.14' and sys_platform == 'win32'",
8
+ "python_full_version < '3.14' and sys_platform != 'win32'",
9
+ ]
4
10
 
5
11
  [[package]]
6
12
  name = "annotated-doc"
@@ -408,7 +414,7 @@ wheels = [
408
414
 
409
415
  [[package]]
410
416
  name = "mcp"
411
- version = "1.27.1"
417
+ version = "1.29.0"
412
418
  source = { registry = "https://pypi.org/simple" }
413
419
  dependencies = [
414
420
  { name = "anyio" },
@@ -426,9 +432,9 @@ dependencies = [
426
432
  { name = "typing-inspection" },
427
433
  { name = "uvicorn", marker = "sys_platform != 'emscripten'" },
428
434
  ]
429
- sdist = { url = "https://files.pythonhosted.org/packages/38/83/d1efe7c2980d8a3afa476f4e3d42d53dd54c0ab94c27bee5d755b45c8b73/mcp-1.27.1.tar.gz", hash = "sha256:0f47e1820f8f8f941466b39749eb1d1839a04caddca2bc60e9d46e8a99914924", size = 608458, upload-time = "2026-05-08T16:50:12.601Z" }
435
+ sdist = { url = "https://files.pythonhosted.org/packages/30/d3/f9acc21dfc886e4f78e2add1a47db46ce16884346afde53f8a064c02c891/mcp-1.29.0.tar.gz", hash = "sha256:52d01f334de1868cc3bb2d6604931126a67631f99a6c5d3b82ba47290315ec36", size = 643148, upload-time = "2026-07-28T13:41:41.939Z" }
430
436
  wheels = [
431
- { url = "https://files.pythonhosted.org/packages/fd/73/42d9596facebdb533b7f0b86c1b0364ef350d1f8ba78b1052e8a58b48b65/mcp-1.27.1-py3-none-any.whl", hash = "sha256:1af3c4203b329430fde7a87b4fcb6392a041f5cb851fd68fc674016ab4e7c06f", size = 216260, upload-time = "2026-05-08T16:50:10.547Z" },
437
+ { url = "https://files.pythonhosted.org/packages/01/c8/248b201f6d753d69fd5d6506011abbb35a946d9142b2ae311a948fd0be3d/mcp-1.29.0-py3-none-any.whl", hash = "sha256:f5a075bb611f23d6f4d080c6a1699fa62772eebc562ba9e66b306ddde1c755f7", size = 223436, upload-time = "2026-07-28T13:41:40.337Z" },
432
438
  ]
433
439
 
434
440
  [package.optional-dependencies]
@@ -439,7 +445,7 @@ cli = [
439
445
 
440
446
  [[package]]
441
447
  name = "mcp-sequel"
442
- version = "0.2.1"
448
+ version = "0.2.2"
443
449
  source = { editable = "." }
444
450
  dependencies = [
445
451
  { name = "mcp", extra = ["cli"] },
@@ -457,7 +463,7 @@ dev = [
457
463
 
458
464
  [package.metadata]
459
465
  requires-dist = [
460
- { name = "mcp", extras = ["cli"], specifier = ">=1.0" },
466
+ { name = "mcp", extras = ["cli"], specifier = ">=1.28,<2" },
461
467
  { name = "paramiko", specifier = ">=5.0" },
462
468
  { name = "psycopg", extras = ["binary"], specifier = ">=3.3.4" },
463
469
  { name = "pydantic", specifier = ">=2.0" },
File without changes
File without changes
File without changes