mcp-trino-python 0.7.0__tar.gz → 0.7.1__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 (24) hide show
  1. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/Dockerfile +5 -2
  2. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/PKG-INFO +1 -1
  3. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/docker-compose.yml +6 -2
  4. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/pyproject.toml +1 -1
  5. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/src/server.py +25 -11
  6. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.dockerignore +0 -0
  7. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.env.example +0 -0
  8. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/CODEOWNERS +0 -0
  9. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  10. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  11. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/pull_request_template.md +0 -0
  12. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/workflows/docker.yml +0 -0
  13. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.github/workflows/publish.yml +0 -0
  14. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.gitignore +0 -0
  15. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/.python-version +0 -0
  16. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/LICENSE +0 -0
  17. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/README.md +0 -0
  18. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/requirements.txt +0 -0
  19. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/ruff.toml +0 -0
  20. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/smithery.yaml +0 -0
  21. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/src/__init__.py +0 -0
  22. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/src/config.py +0 -0
  23. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/src/trino_client.py +0 -0
  24. {mcp_trino_python-0.7.0 → mcp_trino_python-0.7.1}/uv.lock +0 -0
@@ -5,7 +5,10 @@ WORKDIR /app
5
5
  # Environment variables
6
6
  ENV UV_COMPILE_BYTECODE=1 \
7
7
  PYTHONUNBUFFERED=1 \
8
- PYTHONDONTWRITEBYTECODE=1
8
+ PYTHONDONTWRITEBYTECODE=1 \
9
+ # MCP server defaults for HTTP transports
10
+ MCP_HOST=0.0.0.0 \
11
+ MCP_PORT=8000
9
12
 
10
13
  # Install uv
11
14
  COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
@@ -31,5 +34,5 @@ ENTRYPOINT ["uv", "run", "src/server.py"]
31
34
 
32
35
  # Default arguments (can be overridden)
33
36
  # For stdio (default MCP transport): no args needed
34
- # For HTTP: --transport streamable-http --host 0.0.0.0 --port 8000
37
+ # For HTTP: --transport streamable-http
35
38
  CMD ["--transport", "stdio"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-trino-python
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -15,7 +15,7 @@ services:
15
15
  # Usage: docker-compose up mcp-trino-http
16
16
  mcp-trino-http:
17
17
  build: .
18
- command: ["--transport", "streamable-http", "--host", "0.0.0.0", "--port", "8000"]
18
+ command: ["--transport", "streamable-http"]
19
19
  ports:
20
20
  - "8000:8000"
21
21
  environment:
@@ -24,6 +24,8 @@ services:
24
24
  - TRINO_USER=trino
25
25
  - TRINO_CATALOG=tpch
26
26
  - TRINO_SCHEMA=tiny
27
+ - MCP_HOST=0.0.0.0
28
+ - MCP_PORT=8000
27
29
  depends_on:
28
30
  trino:
29
31
  condition: service_healthy
@@ -35,7 +37,7 @@ services:
35
37
  # Usage: docker-compose --profile sse up mcp-trino-sse
36
38
  mcp-trino-sse:
37
39
  build: .
38
- command: ["--transport", "sse", "--host", "0.0.0.0", "--port", "8000"]
40
+ command: ["--transport", "sse"]
39
41
  ports:
40
42
  - "8001:8000"
41
43
  environment:
@@ -44,6 +46,8 @@ services:
44
46
  - TRINO_USER=trino
45
47
  - TRINO_CATALOG=tpch
46
48
  - TRINO_SCHEMA=tiny
49
+ - MCP_HOST=0.0.0.0
50
+ - MCP_PORT=8000
47
51
  depends_on:
48
52
  trino:
49
53
  condition: service_healthy
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mcp-trino-python"
3
- version = "0.7.0"
3
+ version = "0.7.1"
4
4
  description = "A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine"
5
5
  readme = "README.md"
6
6
  license = { text = "Apache-2.0" }
@@ -4,6 +4,8 @@ This module provides a Model Context Protocol (MCP) server that exposes Trino
4
4
  functionality through resources and tools, with special support for Iceberg tables.
5
5
  """
6
6
 
7
+ import os
8
+
7
9
  from mcp.server.fastmcp import FastMCP
8
10
  from mcp.server.fastmcp.prompts import base
9
11
  from pydantic import Field
@@ -16,11 +18,16 @@ config = load_config()
16
18
  client = TrinoClient(config)
17
19
 
18
20
 
19
- # Initialize the MCP server with context
21
+ # Initialize the MCP server with recommended settings for all transports
20
22
  mcp = FastMCP(
21
23
  name="Trino Explorer",
22
24
  instructions="This Model Context Protocol (MCP) server provides access to Trino Query Engine.",
23
- dependencies=["trino", "python-dotenv", "loguru"],
25
+ # HTTP transport settings (used by streamable-http and sse)
26
+ host=os.getenv("MCP_HOST", "127.0.0.1"),
27
+ port=int(os.getenv("MCP_PORT", "8000")),
28
+ # Recommended for production HTTP deployments
29
+ stateless_http=True,
30
+ json_response=True,
24
31
  )
25
32
 
26
33
 
@@ -561,17 +568,21 @@ Examples:
561
568
 
562
569
  # Run with SSE transport
563
570
  python server.py --transport sse --host 127.0.0.1 --port 8001
571
+
572
+ Environment variables:
573
+ MCP_HOST Default host for HTTP transports (default: 127.0.0.1)
574
+ MCP_PORT Default port for HTTP transports (default: 8000)
564
575
  """,
565
576
  )
566
577
  parser.add_argument(
567
578
  "--host",
568
- default="127.0.0.1",
579
+ default=None,
569
580
  help="Host to bind to (default: 127.0.0.1, use 0.0.0.0 for all interfaces)",
570
581
  )
571
582
  parser.add_argument(
572
583
  "--port",
573
584
  type=int,
574
- default=8000,
585
+ default=None,
575
586
  help="Port to listen on (default: 8000)",
576
587
  )
577
588
  parser.add_argument(
@@ -582,22 +593,25 @@ Examples:
582
593
  )
583
594
  args = parser.parse_args()
584
595
 
596
+ # Update settings if CLI args provided (override env vars)
597
+ if args.host:
598
+ mcp.settings.host = args.host
599
+ if args.port:
600
+ mcp.settings.port = args.port
601
+
585
602
  logger.info(f"Starting Trino MCP server with {args.transport} transport")
586
603
 
587
604
  if args.transport == "stdio":
588
605
  logger.info("Using stdio transport for local MCP communication")
589
606
  mcp.run(transport="stdio")
590
607
  elif args.transport == "streamable-http":
591
- logger.info(f"Starting Streamable HTTP server on http://{args.host}:{args.port}/mcp")
592
- mcp.run(transport="streamable-http", host=args.host, port=args.port)
608
+ logger.info(f"Starting Streamable HTTP server on http://{mcp.settings.host}:{mcp.settings.port}/mcp")
609
+ mcp.run(transport="streamable-http")
593
610
  elif args.transport == "sse":
594
- logger.info(f"Starting SSE server on http://{args.host}:{args.port}/sse")
595
- mcp.run(transport="sse", host=args.host, port=args.port)
611
+ logger.info(f"Starting SSE server on http://{mcp.settings.host}:{mcp.settings.port}/sse")
612
+ mcp.run(transport="sse")
596
613
 
597
614
 
598
615
  def main():
599
616
  """Entry point for the MCP Trino server."""
600
- import sys
601
-
602
- sys.argv = sys.argv[:1] # Reset args for mcp.run
603
617
  mcp.run(transport="stdio")