Skip to content

Commit b9138a5

Browse files
authored
Merge pull request #10 from alaturqua/update_project
Update project
2 parents 3f682dd + 68665b9 commit b9138a5

File tree

1 file changed

+144
-31
lines changed

1 file changed

+144
-31
lines changed

README.md

Lines changed: 144 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MCP Trino Server
22

33
[![smithery badge](https://smithery.ai/badge/@alaturqua/mcp-trino-python)](https://smithery.ai/server/@alaturqua/mcp-trino-python)
4-
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
4+
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
55
[![VS Code](https://img.shields.io/badge/vscode-available-007ACC.svg?style=flat-square&logo=visual-studio-code&logoColor=white)](https://code.visualstudio.com/)
66
[![Docker](https://img.shields.io/badge/docker-available-2496ED.svg?style=flat-square&logo=docker&logoColor=white)](https://github.com/alaturqua/mcp-trino-python/pkgs/container/mcp-trino-python)
77
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
@@ -20,9 +20,38 @@ data exploration, querying, and table maintenance capabilities through a standar
2020
## Prerequisites
2121

2222
1. A running Trino server (or Docker Compose for local development)
23-
2. Python 3.11 or higher
23+
2. Python 3.12 or higher
2424
3. Docker (optional, for containerized deployment)
2525

26+
## Quick Start
27+
28+
### 1. Clone the Repository
29+
30+
```bash
31+
git clone https://github.com/alaturqua/mcp-trino-python.git
32+
cd mcp-trino-python
33+
```
34+
35+
### 2. Create Environment File
36+
37+
Create a `.env` file in the root directory:
38+
39+
```bash
40+
TRINO_HOST=localhost
41+
TRINO_PORT=8080
42+
TRINO_USER=trino
43+
TRINO_CATALOG=tpch
44+
TRINO_SCHEMA=tiny
45+
```
46+
47+
### 3. Run Trino Locally (Optional)
48+
49+
```bash
50+
docker-compose up -d trino
51+
```
52+
53+
This starts a Trino server on `localhost:8080` with sample TPC-H and TPC-DS data.
54+
2655
## Installation
2756

2857
### Installing via Smithery
@@ -33,49 +62,77 @@ To install MCP Trino Server for Claude Desktop automatically via [Smithery](http
3362
npx -y @smithery/cli install @alaturqua/mcp-trino-python --client claude
3463
```
3564

36-
### Running Trino Locally
65+
### Using uv (Recommended)
66+
67+
```bash
68+
uv sync
69+
uv run src/server.py
70+
```
3771

38-
The easiest way to get started is to use the included Docker Compose configuration to run Trino locally:
72+
### Using pip
3973

4074
```bash
41-
docker-compose up -d
75+
pip install -e .
76+
python src/server.py
4277
```
4378

44-
This will start a Trino server on `localhost:8080`. You can now proceed with configuring the MCP server.
79+
## Transport Modes
80+
81+
The server supports three transport modes:
82+
83+
| Transport | Description | Use Case |
84+
| ----------------- | ---------------------- | ------------------------------------------ |
85+
| `stdio` | Standard I/O (default) | VS Code, Claude Desktop, local MCP clients |
86+
| `streamable-http` | HTTP with streaming | Remote access, web clients, Docker |
87+
| `sse` | Server-Sent Events | Legacy HTTP transport |
4588

46-
### Usage with VS Code
89+
### Running with Different Transports
4790

48-
For quick installation, you can add the following configuration to your VS Code settings. You can do this by pressing `Ctrl + Shift + P` and typing `Preferences: Open User Settings (JSON)`.
91+
```bash
92+
# stdio (default) - for VS Code and Claude Desktop
93+
python src/server.py
94+
95+
# Streamable HTTP - for remote/web access
96+
python src/server.py --transport streamable-http --host 0.0.0.0 --port 8000
4997

50-
Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.
98+
# SSE - legacy HTTP transport
99+
python src/server.py --transport sse --host 0.0.0.0 --port 8000
100+
```
51101

52-
> Note that the `mcp` key is not needed in the `.vscode/mcp.json` file.
102+
## Usage with VS Code
103+
104+
Add to your VS Code settings (`Ctrl+Shift+P``Preferences: Open User Settings (JSON)`):
53105

54106
```json
55107
{
56108
"mcp": {
57109
"servers": {
58-
"trino": {
59-
"command": "docker",
60-
"args": ["run", "--rm", "ghcr.io/alaturqua/mcp-trino-python:latest"],
61-
"env": {
62-
"TRINO_HOST": "${input:trino_host}",
63-
"TRINO_PORT": "${input:trino_port}",
64-
"TRINO_USER": "${input:trino_user}",
65-
"TRINO_PASSWORD": "${input:trino_password}",
66-
"TRINO_HTTP_SCHEME": "${input:trino_http_scheme}",
67-
"TRINO_CATALOG": "${input:trino_catalog}",
68-
"TRINO_SCHEMA": "${input:trino_schema}"
69-
}
110+
"mcp-trino-python": {
111+
"command": "uv",
112+
"args": [
113+
"run",
114+
"--with",
115+
"mcp[cli]",
116+
"--with",
117+
"trino",
118+
"--with",
119+
"loguru",
120+
"mcp",
121+
"run",
122+
"/path/to/mcp-trino-python/src/server.py"
123+
],
124+
"envFile": "/path/to/mcp-trino-python/.env"
70125
}
71126
}
72127
}
73128
}
74129
```
75130

76-
### Usage with Claude Desktop
131+
Or add to `.vscode/mcp.json` in your workspace (without the `mcp` wrapper key).
132+
133+
## Usage with Claude Desktop
77134

78-
Add the following configuration to your Claude Desktop settings:
135+
Add to your Claude Desktop configuration:
79136

80137
```json
81138
{
@@ -93,18 +150,74 @@ Add the following configuration to your Claude Desktop settings:
93150
}
94151
```
95152

96-
### Running as HTTP Server
153+
## Docker Usage
97154

98-
You can run the server with the `streamable-http` transport for HTTP-based access:
155+
### Build the Image
99156

100157
```bash
101-
python src/server.py --transport streamable-http --host 0.0.0.0 --port 8000
158+
docker build -t mcp-trino-python .
159+
```
160+
161+
### Run with stdio (for VS Code)
162+
163+
```bash
164+
docker run -i --rm \
165+
-e TRINO_HOST=host.docker.internal \
166+
-e TRINO_PORT=8080 \
167+
-e TRINO_USER=trino \
168+
mcp-trino-python
169+
```
170+
171+
### Run with Streamable HTTP
172+
173+
```bash
174+
docker run -p 8000:8000 \
175+
-e TRINO_HOST=host.docker.internal \
176+
-e TRINO_PORT=8080 \
177+
mcp-trino-python \
178+
--transport streamable-http --host 0.0.0.0 --port 8000
102179
```
103180

104-
Available transport options:
105-
- `stdio` (default): Standard input/output, recommended for Claude Desktop
106-
- `streamable-http`: HTTP-based transport with streaming support
107-
- `sse`: Server-Sent Events transport
181+
### Docker Compose
182+
183+
```bash
184+
# Start Trino + MCP server with Streamable HTTP
185+
docker-compose up -d
186+
187+
# Start with SSE transport
188+
docker-compose --profile sse up -d
189+
190+
# Run stdio for testing
191+
docker-compose --profile stdio run --rm mcp-trino-stdio
192+
```
193+
194+
### VS Code with Docker
195+
196+
```json
197+
{
198+
"mcp": {
199+
"servers": {
200+
"mcp-trino-python": {
201+
"command": "docker",
202+
"args": [
203+
"run",
204+
"-i",
205+
"--rm",
206+
"--network",
207+
"mcp-trino-python_trino-network",
208+
"-e",
209+
"TRINO_HOST=trino",
210+
"-e",
211+
"TRINO_PORT=8080",
212+
"-e",
213+
"TRINO_USER=trino",
214+
"mcp-trino-python"
215+
]
216+
}
217+
}
218+
}
219+
}
220+
```
108221

109222
## Configuration
110223

0 commit comments

Comments
 (0)