mcp-server-motherduck 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

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.

Potentially problematic release.


This version of mcp-server-motherduck might be problematic. Click here for more details.

@@ -10,9 +10,16 @@ def main():
10
10
  "--db-path",
11
11
  help="Path to local DuckDB database file",
12
12
  )
13
+ # This is experimental and will change in the future
14
+ parser.add_argument(
15
+ "--result-format",
16
+ help="Format of the output",
17
+ default="markdown",
18
+ choices=["markdown", "duckbox", "text"],
19
+ )
13
20
 
14
21
  args = parser.parse_args()
15
- asyncio.run(server.main(db_path=args.db_path))
22
+ asyncio.run(server.main(db_path=args.db_path, result_format=args.result_format))
16
23
 
17
24
 
18
25
  # Optionally expose other important items at package level
@@ -3,22 +3,31 @@ import logging
3
3
  import duckdb
4
4
  from pydantic import AnyUrl
5
5
  from typing import Literal
6
+ import io
7
+ from contextlib import redirect_stdout
6
8
  import mcp.server.stdio
7
9
  import mcp.types as types
8
10
  from mcp.server import NotificationOptions, Server
9
11
  from mcp.server.models import InitializationOptions
10
12
  from .prompt import PROMPT_TEMPLATE
11
13
 
12
- SERVER_VERSION = "0.3.1"
14
+
15
+ SERVER_VERSION = "0.3.2"
13
16
 
14
17
  logger = logging.getLogger("mcp_server_motherduck")
15
18
 
16
19
 
17
20
  class DatabaseClient:
18
- def __init__(self, db_path: str = None):
21
+ def __init__(
22
+ self,
23
+ db_path: str = None,
24
+ result_format: Literal["markdown", "duckbox", "text"] = "markdown",
25
+ ):
19
26
  self.db_path, self.db_type = self._resolve_db_path_type(db_path)
20
27
  self.conn = self._initialize_connection()
21
28
 
29
+ self.result_format = result_format
30
+
22
31
  def _initialize_connection(self) -> duckdb.DuckDBPyConnection:
23
32
  """Initialize connection to the MotherDuck or DuckDB database"""
24
33
 
@@ -59,7 +68,19 @@ class DatabaseClient:
59
68
 
60
69
  def query(self, query: str) -> str:
61
70
  try:
62
- return str(self.conn.execute(query).fetchall())
71
+ if self.result_format == "markdown":
72
+ # Markdown version of the output
73
+ return self.conn.execute(query).fetchdf().to_markdown()
74
+ elif self.result_format == "duckbox":
75
+ # Duckbox version of the output
76
+ buffer = io.StringIO()
77
+ with redirect_stdout(buffer):
78
+ self.conn.sql(query).show(max_rows=100, max_col_width=20)
79
+ return buffer.getvalue()
80
+ else:
81
+ # Text version of the output
82
+ return str(self.conn.execute(query).fetchall())
83
+
63
84
  except Exception as e:
64
85
  logger.error(f"Database error executing query: {e}")
65
86
  raise ValueError(f"Error executing query: {e}")
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-server-motherduck
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: A MCP server for MotherDuck and local DuckDB
5
5
  Author-email: tdoehmen <till@motherduck.com>
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.10
8
8
  Requires-Dist: duckdb>=1.1.3
9
9
  Requires-Dist: mcp>=1.0.0
10
+ Requires-Dist: pandas>=2.0.0
11
+ Requires-Dist: tabulate>=0.9.0
10
12
  Description-Content-Type: text/markdown
11
13
 
12
14
  # mcp-server-motherduck MCP server
@@ -0,0 +1,9 @@
1
+ mcp_server_motherduck/__init__.py,sha256=0BPvfyJm7xnVEIZD7JLiuHuR0FFhf_Xa9xt7ieTZHWQ,723
2
+ mcp_server_motherduck/__main__.py,sha256=zx-Zgf5qrL280vm9L9vM64kBGfdvneJhZcU8pWSYLOw,410
3
+ mcp_server_motherduck/prompt.py,sha256=P7BrmhVXwDkPeSHQ3f25WMP6lpBpN2BxDzYPOQ3fxX8,56699
4
+ mcp_server_motherduck/server.py,sha256=EA8l90R52aXKhU4FuH9x3mnC81srZqg8omO19tYASiQ,7882
5
+ mcp_server_motherduck-0.3.2.dist-info/METADATA,sha256=238sc-UWVhRXcdRDFA4KjSkp7x934JZTekujgYkzCoo,2015
6
+ mcp_server_motherduck-0.3.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ mcp_server_motherduck-0.3.2.dist-info/entry_points.txt,sha256=dRTgcvWJn40bz0PVuKPylK6w92cFN32lwunZOgo5j4s,69
8
+ mcp_server_motherduck-0.3.2.dist-info/licenses/LICENSE,sha256=Tj68w9jCiceFKTvZ3jET-008NjhozcQMXpm-fyL9WUI,1067
9
+ mcp_server_motherduck-0.3.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- mcp_server_motherduck/__init__.py,sha256=355quIOEeF3hj4vBH-esu6yDKcNHUIrkrZZQLZ6gWLU,460
2
- mcp_server_motherduck/__main__.py,sha256=zx-Zgf5qrL280vm9L9vM64kBGfdvneJhZcU8pWSYLOw,410
3
- mcp_server_motherduck/prompt.py,sha256=P7BrmhVXwDkPeSHQ3f25WMP6lpBpN2BxDzYPOQ3fxX8,56699
4
- mcp_server_motherduck/server.py,sha256=3Ki4T3jiv6viM4-DHKEF5cpweIcVvD2O01lGmuBwOt8,7149
5
- mcp_server_motherduck-0.3.1.dist-info/METADATA,sha256=3dwytXskQyyNy-wWs4oGVZsXyOO2TtvXWjTK22rlGIw,1955
6
- mcp_server_motherduck-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- mcp_server_motherduck-0.3.1.dist-info/entry_points.txt,sha256=dRTgcvWJn40bz0PVuKPylK6w92cFN32lwunZOgo5j4s,69
8
- mcp_server_motherduck-0.3.1.dist-info/licenses/LICENSE,sha256=Tj68w9jCiceFKTvZ3jET-008NjhozcQMXpm-fyL9WUI,1067
9
- mcp_server_motherduck-0.3.1.dist-info/RECORD,,