Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/checkstyle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check formatting

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Check formatting
id: check-formatting
run: |
uv run black --check --diff src/ tests/ || \
echo -e "Formatting check failed. Please run 'uv run black src/ tests/' to fix."
57 changes: 57 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker Image builder

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build container
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: dremio-mcp-server:${{ github.sha }}
- name: Validate docker
run: |
docker run -e TOOLS_MODE=FOR_DATA_PATTERNS \
-e DREMIO_URI=https://fake \
-e DREMIO_OAUTH_SUPPORTED=false \
dremio-mcp-server:${{ github.sha }} \
dremio-mcp-server tools list
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Start container
run: |
docker run -e TOOLS_MODE=FOR_DATA_PATTERNS \
-e DREMIO_URI=https://fake \
-e DREMIO_OAUTH_SUPPORTED=false \
-p 6789:6789 \
--name mcp --rm \
--network host \
dremio-mcp-server:${{ github.sha }} \
dremio-mcp-server run --enable-streaming-http --port 6789 --no-log-to-file \
--enable-json-logging &

- name: Test container
run: |
uv run python tests/stremable_http_cli.py --url http://127.0.0.1:6789/mcp --token fake

- name: Stop container
run: |
docker stop mcp

39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Build stage
FROM python:3.13-slim AS builder

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1

WORKDIR /build

# Copy project files
COPY pyproject.toml README.md ./
COPY src/ ./src/

# Build wheel
RUN pip install --upgrade pip build && \
python -m build --wheel --outdir /dist

# Runtime stage
FROM python:3.13-slim

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1

# Create non-root user
RUN useradd -m -u 1001 appuser

WORKDIR /app

# Copy wheel from builder
COPY --from=builder /dist/*.whl /tmp/

# Install the wheel and dependencies
RUN pip install --no-cache-dir /tmp/*.whl && \
rm /tmp/*.whl

USER 1001

# Console script is now properly installed
CMD ["dremio-mcp-server", "run"]
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ requires-python = ">=3.11"
dependencies = [
"aiohttp>=3.11.12",
"beeai-framework>=0.1.8",
"black>=25.1.0",
"click>=8.1.8",
"fastapi>=0.115.11",
"langchain>=0.3.20",
Expand All @@ -20,8 +21,10 @@ dependencies = [
"langchain-openai>=0.3.7",
"langgraph>=0.3.12",
"mcp>=1.9.4",
"multidict>=6.4.0",
"openai>=1.65.3",
"pandas>=2.2.3",
"pandas-stubs==2.3.0.250703",
"prompt-toolkit>=3.0.50",
"pydantic>=2.10.6",
"pydantic-settings>=2.8.1",
Expand Down
10 changes: 5 additions & 5 deletions src/dremioai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
10 changes: 5 additions & 5 deletions src/dremioai/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

import sys
import os
Expand Down
11 changes: 5 additions & 6 deletions src/dremioai/api/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
10 changes: 5 additions & 5 deletions src/dremioai/api/cli/engines.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

from typing import Annotated, Optional, List
from typer import Option, Argument, Typer
Expand Down
10 changes: 5 additions & 5 deletions src/dremioai/api/cli/prometheus.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

from typing import Annotated, Optional, List
from typer import Option, Argument, Typer, BadParameter
Expand Down
11 changes: 5 additions & 6 deletions src/dremioai/api/dremio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
11 changes: 5 additions & 6 deletions src/dremioai/api/prometheus/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
10 changes: 5 additions & 5 deletions src/dremioai/api/prometheus/vm.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

from pydantic import BaseModel, Field, AfterValidator
from typing import List, Dict, Union, Optional, Any, Annotated
Expand Down
10 changes: 5 additions & 5 deletions src/dremioai/api/util.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

from asyncio import Semaphore, gather
from typing import List, Awaitable
Expand Down
11 changes: 5 additions & 6 deletions src/dremioai/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#
#
# Copyright (C) 2017-2025 Dremio Corporation
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
11 changes: 7 additions & 4 deletions src/dremioai/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ def configure(enable_json_logging=None, to_file=False):
log_file_path = get_log_file()

# Configure rotating file handler
file_handler = RotatingFileHandler(
handler = RotatingFileHandler(
log_file_path, maxBytes=10 * 1024 * 1024, backupCount=5 # 10MB
)
file_handler.setLevel(level())
logging.getLogger().handlers.clear()
logging.getLogger().addHandler(file_handler)
else:
handler = logging.StreamHandler(sys.stderr)

handler.setLevel(level())
logging.getLogger().handlers.clear()
logging.getLogger().addHandler(handler)

renderer = (
structlog.processors.JSONRenderer()
Expand Down
Loading