mcp-trino-python 0.7.0__tar.gz → 0.8.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.
- mcp_trino_python-0.8.0/.claude-plugin/marketplace.json +12 -0
- mcp_trino_python-0.8.0/.claude-plugin/plugin.json +36 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.dockerignore +16 -13
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.env.example +3 -0
- mcp_trino_python-0.8.0/.github/FUNDING.yml +1 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.github/workflows/docker.yml +2 -2
- mcp_trino_python-0.8.0/.github/workflows/publish.yml +89 -0
- mcp_trino_python-0.8.0/.github/workflows/test.yml +35 -0
- mcp_trino_python-0.8.0/Dockerfile +36 -0
- mcp_trino_python-0.8.0/PKG-INFO +351 -0
- mcp_trino_python-0.8.0/README.md +330 -0
- mcp_trino_python-0.8.0/docker-compose.yml +40 -0
- mcp_trino_python-0.8.0/mcpb/manifest.json +200 -0
- mcp_trino_python-0.8.0/mcpb/pack.sh +11 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/pyproject.toml +47 -44
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/ruff.toml +12 -3
- mcp_trino_python-0.8.0/server.json +44 -0
- mcp_trino_python-0.8.0/src/mcp_trino/__init__.py +1 -0
- mcp_trino_python-0.8.0/src/mcp_trino/config.py +44 -0
- mcp_trino_python-0.8.0/src/mcp_trino/server.py +302 -0
- mcp_trino_python-0.8.0/src/mcp_trino/trino_client.py +175 -0
- mcp_trino_python-0.8.0/tests/conftest.py +32 -0
- mcp_trino_python-0.8.0/tests/test_server.py +65 -0
- mcp_trino_python-0.8.0/tests/test_trino_client.py +78 -0
- mcp_trino_python-0.8.0/uv.lock +1833 -0
- mcp_trino_python-0.7.0/.github/workflows/publish.yml +0 -29
- mcp_trino_python-0.7.0/Dockerfile +0 -35
- mcp_trino_python-0.7.0/PKG-INFO +0 -443
- mcp_trino_python-0.7.0/README.md +0 -420
- mcp_trino_python-0.7.0/docker-compose.yml +0 -79
- mcp_trino_python-0.7.0/requirements.txt +0 -4
- mcp_trino_python-0.7.0/smithery.yaml +0 -64
- mcp_trino_python-0.7.0/src/__init__.py +0 -0
- mcp_trino_python-0.7.0/src/config.py +0 -39
- mcp_trino_python-0.7.0/src/server.py +0 -603
- mcp_trino_python-0.7.0/src/trino_client.py +0 -596
- mcp_trino_python-0.7.0/uv.lock +0 -947
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.github/CODEOWNERS +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.github/pull_request_template.md +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.gitignore +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/.python-version +0 -0
- {mcp_trino_python-0.7.0 → mcp_trino_python-0.8.0}/LICENSE +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-trino-python",
|
|
3
|
+
"description": "Trino and Iceberg tools for Claude Code",
|
|
4
|
+
"owner": { "name": "alaturqua" },
|
|
5
|
+
"plugins": [
|
|
6
|
+
{
|
|
7
|
+
"name": "trino",
|
|
8
|
+
"source": "./",
|
|
9
|
+
"description": "Query Trino and inspect or maintain Iceberg tables"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trino",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Query Trino and inspect or maintain Iceberg tables",
|
|
5
|
+
"author": { "name": "alaturqua" },
|
|
6
|
+
"homepage": "https://github.com/alaturqua/mcp-trino-python",
|
|
7
|
+
"repository": "https://github.com/alaturqua/mcp-trino-python",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"keywords": ["trino", "iceberg", "sql", "mcp"],
|
|
10
|
+
"mcpServers": {
|
|
11
|
+
"trino": {
|
|
12
|
+
"command": "uvx",
|
|
13
|
+
"args": ["mcp-trino-python"],
|
|
14
|
+
"env": {
|
|
15
|
+
"TRINO_HOST": "${user_config.trino_host}",
|
|
16
|
+
"TRINO_PORT": "${user_config.trino_port}",
|
|
17
|
+
"TRINO_USER": "${user_config.trino_user}",
|
|
18
|
+
"TRINO_PASSWORD": "${user_config.trino_password}",
|
|
19
|
+
"TRINO_HTTP_SCHEME": "${user_config.trino_http_scheme}",
|
|
20
|
+
"TRINO_CATALOG": "${user_config.trino_catalog}",
|
|
21
|
+
"TRINO_SCHEMA": "${user_config.trino_schema}",
|
|
22
|
+
"TRINO_READ_ONLY": "${user_config.trino_read_only}"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"userConfig": {
|
|
27
|
+
"trino_host": { "type": "string", "title": "Trino host", "description": "Trino server hostname", "required": true, "default": "localhost" },
|
|
28
|
+
"trino_port": { "type": "number", "title": "Trino port", "description": "Trino server port", "default": 8080 },
|
|
29
|
+
"trino_user": { "type": "string", "title": "Trino user", "description": "Trino username", "required": true, "default": "trino" },
|
|
30
|
+
"trino_password": { "type": "string", "title": "Trino password", "description": "Optional; enables basic auth (use with https)", "sensitive": true, "default": "" },
|
|
31
|
+
"trino_http_scheme": { "type": "string", "title": "HTTP scheme", "description": "http or https", "default": "http", "options": ["http", "https"] },
|
|
32
|
+
"trino_catalog": { "type": "string", "title": "Default catalog", "description": "Optional default catalog", "default": "" },
|
|
33
|
+
"trino_schema": { "type": "string", "title": "Default schema", "description": "Optional default schema", "default": "" },
|
|
34
|
+
"trino_read_only": { "type": "boolean", "title": "Read-only", "description": "Allow only read statements and hide maintenance tools", "default": false }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
.env
|
|
2
|
-
.venv/
|
|
3
|
-
.vscode/
|
|
4
|
-
.github/
|
|
5
|
-
dist/
|
|
6
|
-
__pycache__/
|
|
7
|
-
*.egg-info/
|
|
8
|
-
*.pyc
|
|
9
|
-
*.pyo
|
|
10
|
-
*.pyd
|
|
11
|
-
*.db
|
|
12
|
-
|
|
13
|
-
docker-compose.
|
|
1
|
+
.env
|
|
2
|
+
.venv/
|
|
3
|
+
.vscode/
|
|
4
|
+
.github/
|
|
5
|
+
dist/
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.egg-info/
|
|
8
|
+
*.pyc
|
|
9
|
+
*.pyo
|
|
10
|
+
*.pyd
|
|
11
|
+
*.db
|
|
12
|
+
|
|
13
|
+
docker-compose.yml
|
|
14
|
+
tests/
|
|
15
|
+
.claude-plugin/
|
|
16
|
+
plugins/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: alaturqua
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi:
|
|
9
|
+
name: Publish to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: pypi
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write # PyPI Trusted Publishing (OIDC), no token needed
|
|
14
|
+
contents: read
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: astral-sh/setup-uv@v6
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Check tag matches version
|
|
23
|
+
run: test "v$(uv version --short)" = "${GITHUB_REF_NAME}"
|
|
24
|
+
|
|
25
|
+
- name: Build
|
|
26
|
+
run: uv build
|
|
27
|
+
|
|
28
|
+
- name: Publish
|
|
29
|
+
run: uv publish
|
|
30
|
+
|
|
31
|
+
image:
|
|
32
|
+
name: Publish image to ghcr.io
|
|
33
|
+
uses: ./.github/workflows/docker.yml
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
packages: write
|
|
37
|
+
|
|
38
|
+
mcp-registry:
|
|
39
|
+
name: Publish to MCP Registry
|
|
40
|
+
needs: [pypi, image]
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
permissions:
|
|
43
|
+
id-token: write # GitHub OIDC login to the registry
|
|
44
|
+
contents: read
|
|
45
|
+
env:
|
|
46
|
+
MCP_PUBLISHER_VERSION: v1.8.1
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Set server.json version from tag
|
|
51
|
+
run: |
|
|
52
|
+
VERSION="${GITHUB_REF_NAME#v}"
|
|
53
|
+
jq --arg v "$VERSION" '.version = $v
|
|
54
|
+
| .packages[0].version = $v
|
|
55
|
+
| .packages[1].identifier = "ghcr.io/alaturqua/mcp-trino-python:\($v)"' server.json > server.tmp
|
|
56
|
+
mv server.tmp server.json
|
|
57
|
+
|
|
58
|
+
- name: Install mcp-publisher
|
|
59
|
+
run: |
|
|
60
|
+
curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
|
|
61
|
+
|
|
62
|
+
- name: Publish
|
|
63
|
+
run: |
|
|
64
|
+
./mcp-publisher login github-oidc
|
|
65
|
+
./mcp-publisher publish
|
|
66
|
+
|
|
67
|
+
mcpb:
|
|
68
|
+
name: Attach Claude Desktop extension (.mcpb) to the release
|
|
69
|
+
needs: pypi
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
permissions:
|
|
72
|
+
contents: write # upload the release asset
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
|
|
76
|
+
- uses: actions/setup-node@v4
|
|
77
|
+
with:
|
|
78
|
+
node-version: 22
|
|
79
|
+
|
|
80
|
+
- name: Build bundle
|
|
81
|
+
run: |
|
|
82
|
+
npm install -g @anthropic-ai/mcpb@2.1.2
|
|
83
|
+
jq --arg v "${GITHUB_REF_NAME#v}" '.version = $v' mcpb/manifest.json > m.tmp && mv m.tmp mcpb/manifest.json
|
|
84
|
+
sh mcpb/pack.sh
|
|
85
|
+
|
|
86
|
+
- name: Upload to release
|
|
87
|
+
env:
|
|
88
|
+
GH_TOKEN: ${{ github.token }}
|
|
89
|
+
run: gh release upload "$GITHUB_REF_NAME" dist/mcp-trino-python.mcpb --clobber
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Start Trino
|
|
16
|
+
run: docker compose up -d --wait trino
|
|
17
|
+
|
|
18
|
+
- uses: astral-sh/setup-uv@v6
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Install
|
|
23
|
+
run: uv sync --frozen
|
|
24
|
+
|
|
25
|
+
- name: Lint
|
|
26
|
+
run: uv run ruff check && uv run ruff format --check
|
|
27
|
+
|
|
28
|
+
- name: Test
|
|
29
|
+
run: uv run pytest -v
|
|
30
|
+
|
|
31
|
+
- name: Validate server.json
|
|
32
|
+
run: uvx check-jsonschema --schemafile "$(jq -r '."$schema"' server.json)" server.json
|
|
33
|
+
|
|
34
|
+
- name: Validate Claude Desktop manifest
|
|
35
|
+
run: npx -y @anthropic-ai/mcpb@2.1.2 validate mcpb/manifest.json
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
LABEL io.modelcontextprotocol.server.name="io.github.alaturqua/mcp-trino-python" \
|
|
4
|
+
org.opencontainers.image.source="https://github.com/alaturqua/mcp-trino-python" \
|
|
5
|
+
org.opencontainers.image.description="MCP server for Trino and Iceberg" \
|
|
6
|
+
org.opencontainers.image.licenses="Apache-2.0"
|
|
7
|
+
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
|
|
10
|
+
ENV UV_COMPILE_BYTECODE=1 \
|
|
11
|
+
UV_LINK_MODE=copy \
|
|
12
|
+
PYTHONUNBUFFERED=1 \
|
|
13
|
+
MCP_HOST=0.0.0.0 \
|
|
14
|
+
MCP_PORT=8000
|
|
15
|
+
|
|
16
|
+
COPY --from=ghcr.io/astral-sh/uv:0.13.5 /uv /bin/
|
|
17
|
+
|
|
18
|
+
# Dependencies first for layer caching, then the project itself
|
|
19
|
+
COPY pyproject.toml uv.lock ./
|
|
20
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
21
|
+
uv sync --frozen --no-dev --no-install-project
|
|
22
|
+
COPY README.md ./
|
|
23
|
+
COPY src/ src/
|
|
24
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
25
|
+
uv sync --frozen --no-dev --no-editable
|
|
26
|
+
|
|
27
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
28
|
+
|
|
29
|
+
RUN useradd --create-home --uid 1000 mcp
|
|
30
|
+
USER mcp
|
|
31
|
+
|
|
32
|
+
EXPOSE 8000
|
|
33
|
+
|
|
34
|
+
# stdio by default (what MCP clients spawn); use `--transport http` for a remote server on :8000/mcp
|
|
35
|
+
ENTRYPOINT ["mcp-trino"]
|
|
36
|
+
CMD ["--transport", "stdio"]
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mcp-trino-python
|
|
3
|
+
Version: 0.8.0
|
|
4
|
+
Summary: A Model Context Protocol (MCP) connector for Trino, enabling seamless integration between MCP-compliant services and Trino query engine
|
|
5
|
+
Project-URL: Homepage, https://github.com/alaturqua/mcp-trino-python
|
|
6
|
+
Project-URL: Issues, https://github.com/alaturqua/mcp-trino-python/issues
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: connector,data-catalog,fastmcp,iceberg,mcp,mcp-server,trino
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: fastmcp<4.3,>=4.2.4
|
|
18
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
19
|
+
Requires-Dist: trino>=0.336.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# MCP Trino Server
|
|
23
|
+
|
|
24
|
+
<!-- mcp-name: io.github.alaturqua/mcp-trino-python -->
|
|
25
|
+
|
|
26
|
+
[](https://mseep.ai/app/alaturqua-mcp-trino-python)
|
|
27
|
+
[](https://pypi.org/project/mcp-trino-python/)
|
|
28
|
+
[](https://www.python.org/downloads/)
|
|
29
|
+
[](https://github.com/alaturqua/mcp-trino-python/pkgs/container/mcp-trino-python)
|
|
30
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
31
|
+
|
|
32
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server for [Trino](https://trino.io),
|
|
33
|
+
built on [FastMCP](https://gofastmcp.com). It lets AI assistants explore catalogs, run SQL, and inspect or maintain
|
|
34
|
+
Iceberg tables.
|
|
35
|
+
|
|
36
|
+
- Discover catalogs, schemas, tables and views; describe tables and show DDL and stats
|
|
37
|
+
- Run SQL with JSON results
|
|
38
|
+
- Inspect Iceberg metadata (snapshots, manifests, partitions, files, refs, history)
|
|
39
|
+
- Iceberg maintenance (`optimize`, `optimize_manifests`, `expire_snapshots`)
|
|
40
|
+
- **Read-only mode** (`TRINO_READ_ONLY=true`) for safe exploration
|
|
41
|
+
- stdio and Streamable HTTP transports, Docker image, MCP Registry and Claude Code plugin
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
The server is published on PyPI and runs with [uv](https://docs.astral.sh/uv/), so there is nothing to clone:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uvx mcp-trino-python # stdio
|
|
49
|
+
uvx mcp-trino-python --transport http --port 8000 # Streamable HTTP on http://localhost:8000/mcp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Claude Code
|
|
53
|
+
|
|
54
|
+
Install the plugin from this repository's marketplace; Claude Code asks for the Trino connection settings:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
/plugin marketplace add alaturqua/mcp-trino-python
|
|
58
|
+
/plugin install trino@mcp-trino-python
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or add the server directly:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add trino -e TRINO_HOST=localhost -e TRINO_USER=trino -- uvx mcp-trino-python
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Claude Desktop
|
|
68
|
+
|
|
69
|
+
Download `mcp-trino-python.mcpb` from the [latest release](https://github.com/alaturqua/mcp-trino-python/releases/latest)
|
|
70
|
+
and double-click it (or drag it into Settings → Extensions). Claude Desktop asks for the Trino connection settings and
|
|
71
|
+
installs everything itself; you only need [uv](https://docs.astral.sh/uv/getting-started/installation/) installed.
|
|
72
|
+
|
|
73
|
+
Or add it manually to `claude_desktop_config.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"trino": {
|
|
79
|
+
"command": "uvx",
|
|
80
|
+
"args": ["mcp-trino-python"],
|
|
81
|
+
"env": { "TRINO_HOST": "localhost", "TRINO_PORT": "8080", "TRINO_USER": "trino" }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### VS Code / GitHub Copilot
|
|
88
|
+
|
|
89
|
+
Add to `.vscode/mcp.json` in your workspace (or run **MCP: Add Server**):
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"servers": {
|
|
94
|
+
"trino": {
|
|
95
|
+
"type": "stdio",
|
|
96
|
+
"command": "uvx",
|
|
97
|
+
"args": ["mcp-trino-python"],
|
|
98
|
+
"env": { "TRINO_HOST": "localhost", "TRINO_PORT": "8080", "TRINO_USER": "trino" }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For the GitHub Copilot CLI, put the same entry under `mcpServers` in `~/.copilot/mcp-config.json`.
|
|
105
|
+
|
|
106
|
+
### Docker
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# stdio (for MCP clients that spawn the container)
|
|
110
|
+
docker run -i --rm -e TRINO_HOST=host.docker.internal ghcr.io/alaturqua/mcp-trino-python
|
|
111
|
+
|
|
112
|
+
# Streamable HTTP on http://localhost:8000/mcp (health check at /health)
|
|
113
|
+
docker run --rm -p 8000:8000 -e TRINO_HOST=host.docker.internal ghcr.io/alaturqua/mcp-trino-python --transport http
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### MCP Registry
|
|
117
|
+
|
|
118
|
+
The server is listed in the [MCP Registry](https://registry.modelcontextprotocol.io) as
|
|
119
|
+
`io.github.alaturqua/mcp-trino-python` ([server.json](server.json)), which MCP clients and marketplaces can install from.
|
|
120
|
+
|
|
121
|
+
## Configuration
|
|
122
|
+
|
|
123
|
+
| Variable | Description | Default |
|
|
124
|
+
| ----------------- | ----------------------------------------------------------------- | --------- |
|
|
125
|
+
| TRINO_HOST | Trino server hostname | localhost |
|
|
126
|
+
| TRINO_PORT | Trino server port | 8080 |
|
|
127
|
+
| TRINO_USER | Trino username | trino |
|
|
128
|
+
| TRINO_PASSWORD | Password; enables basic auth (use with https) | unset |
|
|
129
|
+
| TRINO_HTTP_SCHEME | `http` or `https` | http |
|
|
130
|
+
| TRINO_CATALOG | Default catalog, used when a tool call omits it | unset |
|
|
131
|
+
| TRINO_SCHEMA | Default schema, used when a tool call omits it | unset |
|
|
132
|
+
| TRINO_READ_ONLY | `true`: hide maintenance tools and allow only read statements | false |
|
|
133
|
+
| MCP_TRANSPORT | `stdio`, `http` or `sse` (legacy); same as `--transport` | stdio |
|
|
134
|
+
| MCP_HOST | HTTP bind host; same as `--host` | 127.0.0.1 |
|
|
135
|
+
| MCP_PORT | HTTP port; same as `--port` | 8000 |
|
|
136
|
+
|
|
137
|
+
Variables can also come from a `.env` file in the working directory; real environment variables take precedence.
|
|
138
|
+
|
|
139
|
+
Read-only mode checks the statement's first keyword (`SELECT`, `WITH`, `SHOW`, `DESCRIBE`, `EXPLAIN`, `VALUES`).
|
|
140
|
+
It is a guard rail, not a security boundary: for hard guarantees, connect with a Trino user that only has read access.
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git clone https://github.com/alaturqua/mcp-trino-python.git
|
|
146
|
+
cd mcp-trino-python
|
|
147
|
+
uv sync
|
|
148
|
+
|
|
149
|
+
docker compose up -d --wait trino # Trino with TPC-H / TPC-DS sample data on localhost:8080
|
|
150
|
+
uv run pytest # tests run against that Trino
|
|
151
|
+
uv run ruff check
|
|
152
|
+
uv run mcp-trino --transport http # or try it with: npx @modelcontextprotocol/inspector
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`docker compose up mcp-trino-http` runs Trino plus the server on http://localhost:8000/mcp.
|
|
156
|
+
|
|
157
|
+
### Releasing
|
|
158
|
+
|
|
159
|
+
Bump `version` in `pyproject.toml`, then publish a GitHub release tagged `v<version>`. The `Publish` workflow pushes
|
|
160
|
+
the package to PyPI, the image to ghcr.io, and `server.json` to the MCP Registry (GitHub OIDC, no secret needed).
|
|
161
|
+
It also attaches the Claude Desktop extension (`mcp-trino-python.mcpb`) to the release; build it locally with
|
|
162
|
+
`sh mcpb/pack.sh` (needs `npm install -g @anthropic-ai/mcpb`). Bump `version` in `.claude-plugin/plugin.json` too so
|
|
163
|
+
Claude Code picks up the update.
|
|
164
|
+
|
|
165
|
+
## Tools
|
|
166
|
+
|
|
167
|
+
All `catalog` / `schema_name` parameters are optional when `TRINO_CATALOG` / `TRINO_SCHEMA` are set. Maintenance tools are hidden in read-only mode.
|
|
168
|
+
|
|
169
|
+
### Query and Exploration Tools
|
|
170
|
+
|
|
171
|
+
- **show_catalogs**
|
|
172
|
+
|
|
173
|
+
- List all available catalogs
|
|
174
|
+
- No parameters required
|
|
175
|
+
|
|
176
|
+
- **show_schemas**
|
|
177
|
+
|
|
178
|
+
- List all schemas in a catalog
|
|
179
|
+
- Parameters:
|
|
180
|
+
- `catalog`: Catalog name (string, optional)
|
|
181
|
+
|
|
182
|
+
- **show_tables**
|
|
183
|
+
|
|
184
|
+
- List all tables in a schema
|
|
185
|
+
- Parameters:
|
|
186
|
+
- `catalog`: Catalog name (string, optional)
|
|
187
|
+
- `schema_name`: Schema name (string, optional)
|
|
188
|
+
|
|
189
|
+
- **describe_table**
|
|
190
|
+
|
|
191
|
+
- Show detailed table structure and column information
|
|
192
|
+
- Parameters:
|
|
193
|
+
- `table`: Table name (string, required)
|
|
194
|
+
- `catalog`: Catalog name (string, optional)
|
|
195
|
+
- `schema_name`: Schema name (string, optional)
|
|
196
|
+
|
|
197
|
+
- **execute_query**
|
|
198
|
+
|
|
199
|
+
- Execute a SQL query and return formatted results
|
|
200
|
+
- Parameters:
|
|
201
|
+
- `query`: SQL query to execute (string, required)
|
|
202
|
+
|
|
203
|
+
- **show_catalog_tree**
|
|
204
|
+
|
|
205
|
+
- Show a hierarchical tree view of catalogs, schemas, and tables
|
|
206
|
+
- Returns a formatted tree structure with visual indicators
|
|
207
|
+
- No parameters required
|
|
208
|
+
|
|
209
|
+
- **show_create_table**
|
|
210
|
+
|
|
211
|
+
- Show the CREATE TABLE statement for a table
|
|
212
|
+
- Parameters:
|
|
213
|
+
- `table`: Table name (string, required)
|
|
214
|
+
- `catalog`: Catalog name (string, optional)
|
|
215
|
+
- `schema_name`: Schema name (string, optional)
|
|
216
|
+
|
|
217
|
+
- **show_create_view**
|
|
218
|
+
|
|
219
|
+
- Show the CREATE VIEW statement for a view
|
|
220
|
+
- Parameters:
|
|
221
|
+
- `view`: View name (string, required)
|
|
222
|
+
- `catalog`: Catalog name (string, optional)
|
|
223
|
+
- `schema_name`: Schema name (string, optional)
|
|
224
|
+
|
|
225
|
+
- **show_stats**
|
|
226
|
+
- Show statistics for a table
|
|
227
|
+
- Parameters:
|
|
228
|
+
- `table`: Table name (string, required)
|
|
229
|
+
- `catalog`: Catalog name (string, optional)
|
|
230
|
+
- `schema_name`: Schema name (string, optional)
|
|
231
|
+
|
|
232
|
+
### Iceberg Table Maintenance
|
|
233
|
+
|
|
234
|
+
- **optimize**
|
|
235
|
+
|
|
236
|
+
- Optimize an Iceberg table by compacting small files
|
|
237
|
+
- Parameters:
|
|
238
|
+
- `table`: Table name (string, required)
|
|
239
|
+
- `catalog`: Catalog name (string, optional)
|
|
240
|
+
- `schema_name`: Schema name (string, optional)
|
|
241
|
+
|
|
242
|
+
- **optimize_manifests**
|
|
243
|
+
|
|
244
|
+
- Optimize manifest files for an Iceberg table
|
|
245
|
+
- Parameters:
|
|
246
|
+
- `table`: Table name (string, required)
|
|
247
|
+
- `catalog`: Catalog name (string, optional)
|
|
248
|
+
- `schema_name`: Schema name (string, optional)
|
|
249
|
+
|
|
250
|
+
- **expire_snapshots**
|
|
251
|
+
- Remove old snapshots from an Iceberg table
|
|
252
|
+
- Parameters:
|
|
253
|
+
- `table`: Table name (string, required)
|
|
254
|
+
- `retention_threshold`: Age threshold (e.g., "7d") (string, optional)
|
|
255
|
+
- `catalog`: Catalog name (string, optional)
|
|
256
|
+
- `schema_name`: Schema name (string, optional)
|
|
257
|
+
|
|
258
|
+
### Iceberg Metadata Inspection
|
|
259
|
+
|
|
260
|
+
- **show_table_properties**
|
|
261
|
+
|
|
262
|
+
- Show Iceberg table properties
|
|
263
|
+
- Parameters:
|
|
264
|
+
- `table`: Table name (string, required)
|
|
265
|
+
- `catalog`: Catalog name (string, optional)
|
|
266
|
+
- `schema_name`: Schema name (string, optional)
|
|
267
|
+
|
|
268
|
+
- **show_table_history**
|
|
269
|
+
|
|
270
|
+
- Show Iceberg table history/changelog
|
|
271
|
+
- Contains snapshot timing, lineage, and ancestry information
|
|
272
|
+
- Parameters:
|
|
273
|
+
- `table`: Table name (string, required)
|
|
274
|
+
- `catalog`: Catalog name (string, optional)
|
|
275
|
+
- `schema_name`: Schema name (string, optional)
|
|
276
|
+
|
|
277
|
+
- **show_metadata_log_entries**
|
|
278
|
+
|
|
279
|
+
- Show Iceberg table metadata log entries
|
|
280
|
+
- Contains metadata file locations and sequence information
|
|
281
|
+
- Parameters:
|
|
282
|
+
- `table`: Table name (string, required)
|
|
283
|
+
- `catalog`: Catalog name (string, optional)
|
|
284
|
+
- `schema_name`: Schema name (string, optional)
|
|
285
|
+
|
|
286
|
+
- **show_snapshots**
|
|
287
|
+
|
|
288
|
+
- Show Iceberg table snapshots
|
|
289
|
+
- Contains snapshot details including operations and manifest files
|
|
290
|
+
- Parameters:
|
|
291
|
+
- `table`: Table name (string, required)
|
|
292
|
+
- `catalog`: Catalog name (string, optional)
|
|
293
|
+
- `schema_name`: Schema name (string, optional)
|
|
294
|
+
|
|
295
|
+
- **show_manifests**
|
|
296
|
+
|
|
297
|
+
- Show Iceberg table manifests for current or all snapshots
|
|
298
|
+
- Contains manifest file details and data file statistics
|
|
299
|
+
- Parameters:
|
|
300
|
+
- `table`: Table name (string, required)
|
|
301
|
+
- `catalog`: Catalog name (string, optional)
|
|
302
|
+
- `schema_name`: Schema name (string, optional)
|
|
303
|
+
- `all_snapshots`: Include all snapshots (boolean, optional)
|
|
304
|
+
|
|
305
|
+
- **show_partitions**
|
|
306
|
+
|
|
307
|
+
- Show Iceberg table partitions
|
|
308
|
+
- Contains partition statistics and file counts
|
|
309
|
+
- Parameters:
|
|
310
|
+
- `table`: Table name (string, required)
|
|
311
|
+
- `catalog`: Catalog name (string, optional)
|
|
312
|
+
- `schema_name`: Schema name (string, optional)
|
|
313
|
+
|
|
314
|
+
- **show_files**
|
|
315
|
+
|
|
316
|
+
- Show Iceberg table data files in current snapshot
|
|
317
|
+
- Contains detailed file metadata and column statistics
|
|
318
|
+
- Parameters:
|
|
319
|
+
- `table`: Table name (string, required)
|
|
320
|
+
- `catalog`: Catalog name (string, optional)
|
|
321
|
+
- `schema_name`: Schema name (string, optional)
|
|
322
|
+
|
|
323
|
+
- **show_entries**
|
|
324
|
+
|
|
325
|
+
- Show Iceberg table manifest entries for current or all snapshots
|
|
326
|
+
- Contains entry status and detailed file metrics
|
|
327
|
+
- Parameters:
|
|
328
|
+
- `table`: Table name (string, required)
|
|
329
|
+
- `catalog`: Catalog name (string, optional)
|
|
330
|
+
- `schema_name`: Schema name (string, optional)
|
|
331
|
+
- `all_snapshots`: Include all snapshots (boolean, optional)
|
|
332
|
+
|
|
333
|
+
- **show_refs**
|
|
334
|
+
|
|
335
|
+
- Show Iceberg table references (branches and tags)
|
|
336
|
+
- Contains reference configuration and snapshot mapping
|
|
337
|
+
- Parameters:
|
|
338
|
+
- `table`: Table name (string, required)
|
|
339
|
+
- `catalog`: Catalog name (string, optional)
|
|
340
|
+
- `schema_name`: Schema name (string, optional)
|
|
341
|
+
|
|
342
|
+
### Query History
|
|
343
|
+
|
|
344
|
+
- **show_query_history**
|
|
345
|
+
- Get the history of executed queries
|
|
346
|
+
- Parameters:
|
|
347
|
+
- `limit`: Maximum number of queries to return (number, optional)
|
|
348
|
+
|
|
349
|
+
## License
|
|
350
|
+
|
|
351
|
+
This project is licensed under the Apache 2.0 License. Please refer to the LICENSE file for the full terms.
|