### Install Dependencies Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Use this command to install project dependencies with uv. ```bash uv sync ``` -------------------------------- ### Install uv Package Manager Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Instructions for installing the uv package manager. Follow the official documentation for detailed steps. ```bash # Follow instructions at https://docs.astral.sh/uv/guides/install-python/ ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Installs project dependencies using the uv package manager after navigating to the project directory. ```bash cd dremio-mcp-server uv sync ``` -------------------------------- ### File-based Configuration Example Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md An example of a YAML configuration file for Dremio AI settings. It demonstrates how to set Dremio connection details and tool server modes. ```yaml dremio: uri: "https://api.dremio.cloud" pat: "@~/tokens/dremio.pat" project_id: "project123" # required only for DC enable_search: # Optional: Enable semantic search features allow_dml: # Optional: Allow MCP Server to create views in Dremio tools: server_mode: "FOR_SELF,FOR_DATA_PATTERNS" ``` -------------------------------- ### Install Dremio MCP with PAT (Development/Testing) Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Installs the Dremio MCP Helm chart for development or testing using a Personal Access Token (PAT). This is not recommended for production environments. ```bash helm install dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ --set dremio.pat=your-personal-access-token \ -n dremio ``` -------------------------------- ### Install Dremio MCP with OAuth (Production) Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Installs the Dremio MCP Helm chart in production mode using OAuth authentication. Ensure a namespace named 'dremio' exists. ```bash kubectl create namespace dremio helm install dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ -n dremio ``` -------------------------------- ### Verify Dremio MCP Server Installation Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Verifies the installation of the Dremio MCP Server by running its help command. ```bash uv run dremio-mcp-server --help ``` -------------------------------- ### Programmatic Configuration with Pydantic Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Demonstrates how to configure Dremio AI settings programmatically using the `dremioai.config.settings` module. Includes loading from a file, getting current settings, and overriding them. ```python from dremioai.config import settings # Load from file settings.configure("path/to/config.yaml") # Get current settings current = settings.instance() # Override settings current.with_overrides({ "dremio.uri": "https://new-uri.com", "tools.server_mode": "FOR_SELF" }) ``` -------------------------------- ### Create a New Dremio Tool Source: https://github.com/dremio/dremio-mcp/blob/main/docs/tools.md Example of how to create a new custom tool by inheriting from the `Tools` base class and implementing the `invoke` method. ```python from typing import ClassVar, Annotated from dremioai.config.tools import ToolType class MyNewTool(Tools): For: ClassVar[Annotated[ToolType, ToolType.FOR_SELF]] async def invoke(self) -> Dict[str, Any]: """Tool description here""" # Implementation pass ``` -------------------------------- ### Get Help with Dremio MCP Deployment Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Commands to assist with troubleshooting and understanding the Dremio MCP deployment status. ```bash kubectl logs -f -l app.kubernetes.io/name=dremio-mcp -n dremio helm status dremio-mcp -n dremio kubectl describe all -n dremio ``` -------------------------------- ### Define a New Dremio MCP Tool Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Example of how to define a new tool by inheriting from the `Tools` class and implementing the `invoke` method. Ensure to import necessary types. ```python from dremioai.tools.tools import Tools from dremioai.config.tools import ToolType class MyNewTool(Tools): For: ClassVar[Annotated[ToolType, ToolType.FOR_SELF]] async def invoke(self) -> Dict[str, Any]: """Tool description here""" # Implementation pass ``` -------------------------------- ### Dremio MCP Client with SDK (TypeScript) Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/AUTHENTICATION.md Connects to the MCP server using the official SDK and Dremio token. Requires `@modelcontextprotocol/sdk` to be installed. Use this for client applications to interact with Dremio's Model Context Protocol. ```typescript // mcp-client.ts - MCP server communication using official SDK import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamable-http.js'; class DremioMCPClient { private mcpServerUrl: string; private client: Client | null = null; constructor(mcpServerUrl: string) { // e.g., "https://dremio-mcp.example.com" this.mcpServerUrl = mcpServerUrl; } /** * Connect to MCP server with Dremio token * Uses StreamableHTTPClientTransport for compatibility with --enable-streaming-http */ async connect(dremioToken: string): Promise { // Create Streamable HTTP transport with authentication const transport = new StreamableHTTPClientTransport( new URL(this.mcpServerUrl), { headers: { 'Authorization': `Bearer ${dremioToken}` } } ); // Create and connect MCP client this.client = new Client({ name: 'dremio-chat-client', version: '1.0.0' }, { capabilities: {} }); await this.client.connect(transport); } /** * List available tools */ async listTools(): Promise { if (!this.client) { throw new Error('MCP client not connected'); } return await this.client.listTools(); } /** * Close connection */ async close(): Promise { if (this.client) { await this.client.close(); this.client = null; } } } ``` -------------------------------- ### Verify Python Installation for Dremio MCP Server Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Check if the installed Python version meets the requirement of Python 3.11 or later for the Dremio MCP server. This command helps ensure the environment is correctly set up. ```shell uv python find ``` -------------------------------- ### Configure Dremio MCP Server in Claude Desktop Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Add this JSON section to your Claude desktop config file to specify the Dremio MCP server command and arguments. This assumes a local install and picks up the default MCP server config file location. ```json { "globalShortcut": "", "mcpServers": { "Dremio": { "command": "uv", "args": [ "run", "--directory", "" "dremio-mcp-server", "run" ] } } } ``` -------------------------------- ### Get Dremio Application URL Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/templates/NOTES.txt Use these commands to determine the URL for accessing your Dremio application based on your Kubernetes service configuration. ```bash {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dremio-mcp.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "dremio-mcp.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dremio-mcp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}) echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dremio-mcp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT {{- end }} ``` -------------------------------- ### Run MCP Server with Custom Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Launch the MCP server using a specified configuration file. Ensure the config file path is correct. ```bash uv run dremio-mcp-server run --config-file ``` -------------------------------- ### List Available Tools via CLI Source: https://github.com/dremio/dremio-mcp/blob/main/docs/tools.md Use this command to list all available tools for a specific mode, such as 'FOR_SELF'. ```bash uv run dremio-mcp-server tools list -m FOR_SELF ``` -------------------------------- ### Create Dremio Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Use this command to create the Dremio configuration file. Provide your Dremio URI and PAT. For Dremio Cloud, include the project ID. The PAT can be provided directly or via a file path prefixed with '@'. ```shell $ uv run dremio-mcp-server config create dremioai \ --uri \ --pat \ # required for cloud: add your project ID if setting up for dremio cloud # --project-id ``` ```shell $ uv run dremio-mcp-server config create dremioai \ --uri \ --pat @/path/to/tokenfile \ ``` -------------------------------- ### Deploy MCP Server with Helm (Bash) Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/AUTHENTICATION.md Deploys the MCP server using the provided Helm chart. Ensure Dremio PAT configuration is omitted when using OAuth. ```bash # For Dremio Software helm install dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 ``` -------------------------------- ### List Default Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md View the default configuration file path and its contents. This command helps in understanding the default settings and their location. ```bash $ uv run dremio-mcp-server config list Default config file: /home/user/.config/dremioai/config.yaml (exists = True) dremio: uri: https://api.dremio.cloud pat: your-pat-here project_id: project123 experimental_enabled: false allow_dml: false tools: server_mode: FOR_SELF ``` -------------------------------- ### Show Configuration File Path Only Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Retrieve only the path to the default configuration file without displaying its contents. Useful for scripting or quick checks. ```bash $ dremio-mcp-server config list --show-filename Default config file: /home/user/.config/dremioai/config.yaml (exists = True) ``` -------------------------------- ### Build and Deploy Dremio MCP Server with Helm Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Build the Docker image and deploy the Dremio MCP server using Helm for production or development/testing. The production deployment uses OAuth, while development uses a Personal Access Token (PAT). ```bash docker build -t dremio-mcp:0.1.0 . # Production deployment with OAuth (Recommended) helm install my-dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 # Development/Testing with PAT (Not for production) helm install my-dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ --set dremio.pat= ``` -------------------------------- ### List Dremio AI Configurations Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md View all configured Dremio AI connection settings. Useful for verifying or managing multiple configurations. ```bash uv run dremio-mcp-server config list --type dremioai ``` -------------------------------- ### Build Docker Image Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Create a Docker image for the Dremio MCP server. Tag the image with a specific version, e.g., 0.1.0. ```bash docker build -t dremio-mcp:0.1.0 . ``` -------------------------------- ### Create Claude Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/README.md This command creates the configuration file for the Claude LLM desktop app, enabling it to connect with the MCP server. ```shell $ uv run dremio-mcp-server config create claude ``` -------------------------------- ### Run MCP Server Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Execute the MCP server in local stdio mode. For remote deployment, consider streaming HTTP mode. ```bash uv run dremio-mcp-server run ``` -------------------------------- ### Create Dremio AI Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Configure Dremio AI connection details, including URI and Personal Access Token (PAT). This is typically for local or development environments. ```bash uv run dremio-mcp-server config create dremioai --uri --pat ``` -------------------------------- ### Dremio MCP Server Project Structure Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Overview of the directory structure for the Dremio MCP Server project, highlighting key directories like src/ and docs/. ```tree dremio-mcp-server/ ├── src/ │ └── dremioai/ │ ├── config/ # Configuration management │ ├── servers/ # MCP server implementation │ └── tools/ # Dremio tools implementation └── docs/ # Documentation ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Shows how to configure Dremio AI settings using environment variables. Nested settings are separated by double underscores. ```bash DREMIOAI_DREMIO__URI="https://api.dremio.cloud" DREMIOAI_DREMIO__PAT="your-pat-here" DREMIOAI_TOOLS__SERVER_MODE="FOR_SELF" ``` -------------------------------- ### Build Dremio MCP Docker Image Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Builds the Docker image for Dremio MCP. If using a private registry, tag and push the image. ```bash docker build -t dremio-mcp:0.1.0 . docker tag dremio-mcp:0.1.0 /dremio-mcp:0.1.0 docker push /dremio-mcp:0.1.0 ``` -------------------------------- ### Execute a Specific Tool via CLI Source: https://github.com/dremio/dremio-mcp/blob/main/docs/tools.md Test a specific tool with arguments using the CLI. Arguments are passed in the format 'arg=value'. ```bash uv run dremio-mcp-server tools invoke -t RunSqlQuery -c config.yaml \ args="query=SELECT * FROM sys.nodes" ``` ```json [ { "node_id": "node1", "node_type": "COORDINATOR", "status": "UP", "last_contact": "2024-01-20 10:30:00" }, { "node_id": "node2", "node_type": "EXECUTOR", "status": "UP", "last_contact": "2024-01-20 10:29:55" } ] ``` -------------------------------- ### View Dremio MCP Helm Manifest Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Displays all Kubernetes resources managed by the Dremio MCP Helm release. ```bash helm get manifest dremio-mcp -n dremio ``` -------------------------------- ### View Dremio MCP Helm Values Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Retrieves and displays the current configuration values for the Dremio MCP Helm release. ```bash helm get values dremio-mcp -n dremio ``` -------------------------------- ### Run All Tests Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Execute all project tests using pytest. Strict asyncio mode is enforced. ```bash uv run pytest tests ``` -------------------------------- ### Access Dremio MCP Metrics Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/templates/NOTES.txt Forward the metrics port to your local machine to access Dremio MCP metrics. This requires metrics to be enabled in your Helm chart values. ```bash kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "dremio-mcp.fullname" . }} {{ .Values.metrics.port }}:{{ .Values.metrics.port }} Then visit http://localhost:{{ .Values.metrics.port }}/metrics ``` -------------------------------- ### Troubleshoot Dremio MCP Pods Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Commands to help diagnose issues with Dremio MCP pods, including describing pods and checking events. ```bash kubectl describe pod -l app.kubernetes.io/name=dremio-mcp -n dremio kubectl get events -n dremio --sort-by='.lastTimestamp' ``` -------------------------------- ### List Claude Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Validates the Claude configuration by listing its current settings. Shows the default config file path and its contents. ```shell $ uv run dremio-mcp-server config list --type claude Default config file: '/Users/..../Library/Application Support/Claude/claude_desktop_config.json' (exists = True) { 'globalShortcut': '', 'mcpServers': { 'Dremio': { 'command': '/opt/homebrew/Cellar/uv/0.6.14/bin/uv', 'args': [ 'run', '--directory', '...../dremio-mcp', 'dremio-mcp-server', 'run' ] } } } ``` -------------------------------- ### Dremio MCP Server Configuration File Format Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Defines the structure and options for the Dremio MCP server configuration file (config.yaml). Includes settings for Dremio connection, PAT, project ID, search enablement, DML allowance, and server mode. ```yaml # The dremio section contains 3 main things - the URI to connect, PAT to use # and optionally the project_id if using with Dremio Cloud dremio: uri: https://.... # the Dremio URI pat: "@~/ws/tokens/idl.token" # PAT can be put in a file and used here with @ prefix project_id: Project ID required for Dremio Cloud enable_search: # Optional: Enable semantic search allow_dml: # Optional: Allow MCP Server to create views in Dremio tools: server_mode: FOR_DATA_PATTERNS # the serverm # Optionally the MCP server can also connect and use a prometheus configuration if it # has been enabled for your Dremio cluster (typically useful for SW installations) #prometheus: #uri: ... #token: ... ``` -------------------------------- ### Run Specific Test File Source: https://github.com/dremio/dremio-mcp/blob/main/CLAUDE.md Focus testing on a particular file, such as test_chart.py. This is useful for targeted debugging. ```bash uv run pytest tests/test_chart.py ``` -------------------------------- ### Enable Metrics in Dremio MCP Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Upgrades the Dremio MCP deployment to enable metrics collection on a specified port. ```bash helm upgrade dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ --set metrics.enabled=true \ --set metrics.port=9091 \ -n dremio ``` -------------------------------- ### Run All Project Tests Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Execute all tests for the project using pytest. This command is typically run from the project's root directory. ```shell # Run all tests $ uv run pytest tests ``` -------------------------------- ### Check Dremio MCP Logs Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Commands to follow live logs or retrieve logs from a previous, potentially crashed, container for Dremio MCP. ```bash kubectl logs -f -l app.kubernetes.io/name=dremio-mcp -n dremio kubectl logs -l app.kubernetes.io/name=dremio-mcp -n dremio --previous ``` -------------------------------- ### Prometheus Integration Settings Schema Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Defines the configuration parameters for integrating with a Prometheus server, including its URI and authentication token. ```yaml prometheus: uri: # Prometheus server URI token: # Authentication token ``` -------------------------------- ### Dremio Connection Settings Schema Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Defines the structure for Dremio connection settings, including URI, Personal Access Token (PAT), project ID, and options for search and DML. ```yaml dremio: uri: # Dremio instance URI pat: # Personal Access Token project_id: # Optional: Project ID for Dremio Cloud enable_search: # Optional: Enable semantic search allow_dml: # Optional: Allow MCP Server to create views in Dremio wlm: # Optional: WLM settings, for running MCP server in stdio mode engine_name: # Optional: Direct all SQL to this engine if set ``` -------------------------------- ### Verify Dremio MCP Deployment Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Commands to check the status of Dremio MCP pods, view logs, and inspect services after deployment. ```bash kubectl get pods -n dremio kubectl logs -f -l app.kubernetes.io/name=dremio-mcp -n dremio kubectl get svc -n dremio ``` -------------------------------- ### Enable Autoscaling in Dremio MCP Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Upgrades the Dremio MCP deployment to enable autoscaling with specified replica limits and target CPU utilization. ```bash helm upgrade dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ --set autoscaling.enabled=true \ --set autoscaling.minReplicas=2 \ --set autoscaling.maxReplicas=10 \ --set autoscaling.targetCPUUtilizationPercentage=80 \ -n dremio ``` -------------------------------- ### Upgrade Dremio MCP Deployment Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Upgrades an existing Dremio MCP deployment using Helm. Ensure the Dremio URI is correctly set. ```bash helm upgrade dremio-mcp ./helm/dremio-mcp \ --set dremio.uri=https://dremio.example.com:9047 \ -n dremio ``` -------------------------------- ### Run Dremio MCP Server with Logging Options Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Use these shell commands to run the Dremio MCP server, controlling log file output. You can disable file logging and enable JSON formatted logs, or just enable JSON logging. ```shell $ uv run dremio-mcp-server run --no-log-to-file --enable-json-logging ``` ```shell # OR $ uv run dremio-mcp-server run --enable-json-logging ``` -------------------------------- ### List Dremio AI Configuration Source: https://github.com/dremio/dremio-mcp/blob/main/README.md Validates the Dremio AI configuration by listing its current settings. Shows the default config file path and its contents, including Dremio URI and PAT. ```shell $ uv run dremio-mcp-server config list --type dremioai Default config file: /Users/..../.config/dremioai/config.yaml (exists = True) dremio: enable_search: false pat: .... uri: .... tools: server_mode: FOR_DATA_PATTERNS ``` -------------------------------- ### Tools Settings Schema Source: https://github.com/dremio/dremio-mcp/blob/main/docs/settings.md Specifies the configuration for Dremio AI tools, including various server modes like introspection, Prometheus integration, and data pattern analysis. ```yaml tools: server_mode: # Tool types to enable ``` -------------------------------- ### Check Dremio MCP Server Logs Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/templates/NOTES.txt Stream the logs for your Dremio MCP deployment. This command is useful for debugging and monitoring. ```bash kubectl logs -f --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dremio-mcp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" ``` -------------------------------- ### Create a New Feature Branch Source: https://github.com/dremio/dremio-mcp/blob/main/CONTRIBUTING.md Creates a new git branch for feature development, branching off the main branch. ```bash git checkout -b feature/your-feature-name ``` -------------------------------- ### Rollback Dremio MCP Deployment Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Rolls back the Dremio MCP deployment to the previous Helm release. ```bash helm rollback dremio-mcp -n dremio ``` -------------------------------- ### Uninstall Dremio MCP Deployment Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/QUICKSTART.md Uninstalls the Dremio MCP Helm release and associated resources. ```bash helm uninstall dremio-mcp -n dremio ``` -------------------------------- ### Dremio OAuth Token Exchange Service (TypeScript) Source: https://github.com/dremio/dremio-mcp/blob/main/helm/dremio-mcp/AUTHENTICATION.md Implements a service to exchange OAuth JWTs for Dremio access tokens and manage token validity. Use this for client-side applications requiring Dremio authentication. ```typescript // auth.ts - OAuth and token exchange implementation interface DremioTokenResponse { access_token: string; token_type: string; expires_in: number; issued_token_type: string; scope: string; } class DremioAuthService { private dremioBaseUrl: string; private dremioToken: string | null = null; private tokenExpiry: number = 0; constructor(dremioBaseUrl: string) { // e.g., "https://dremio.example.com" for Dremio Software this.dremioBaseUrl = dremioBaseUrl; } /** * Exchange OAuth JWT for Dremio access token * Uses Dremio's OAuth Token Exchange API * * Reference: https://docs.dremio.com/current/reference/api/oauth-token/#exchanging-an-external-jwt */ async exchangeToken(oauthJwt: string): Promise { const url = `${this.dremioBaseUrl}/oauth/token`; // Prepare form data as per Dremio API specification const formData = new URLSearchParams({ subject_token: oauthJwt, subject_token_type: 'urn:ietf:params:oauth:token-type:jwt', grant_type: 'urn:ietf:params:oauth:grant-type:token-exchange', scope: 'dremio.all' }); const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: formData.toString() }); if (!response.ok) { throw new Error(`Token exchange failed: ${response.status} ${response.statusText}`); } const tokenData: DremioTokenResponse = await response.json(); // Store token and expiry this.dremioToken = tokenData.access_token; this.tokenExpiry = Date.now() + (tokenData.expires_in * 1000); return tokenData; } /** * Get valid Dremio token, refreshing if necessary */ async getDremioToken(oauthJwt: string): Promise { // Check if token is still valid (with 5 minute buffer) if (this.dremioToken && Date.now() < this.tokenExpiry - 300000) { return this.dremioToken; } // Exchange for new token const tokenData = await this.exchangeToken(oauthJwt); return tokenData.access_token; } } // Usage in chat application async function initializeChatSession(oauthJwt: string) { const authService = new DremioAuthService( 'https://dremio.example.com' // Your Dremio Software instance ); // Exchange OAuth JWT for Dremio token const dremioToken = await authService.exchangeToken(oauthJwt); // Store token securely (e.g., in session storage with encryption) sessionStorage.setItem('dremio_token', dremioToken.access_token); sessionStorage.setItem('dremio_token_expiry', String(Date.now() + dremioToken.expires_in * 1000)); return dremioToken.access_token; } ``` -------------------------------- ### Auto-Close Window Script Source: https://github.com/dremio/dremio-mcp/blob/main/src/dremioai/resources/auth_redirect.html This JavaScript code automatically closes the browser window after a 3-second delay, providing a seamless user experience after authentication. ```javascript function closeWindow() { window.close(); } // Try auto-close after 3 seconds window.onload = function () { setTimeout(closeWindow, 3000); }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.