MCP Authorization Error

Hello,

We are received folloiwing error message, even the user which is used for authentication MCPTest is assing to ADMIN role.

Promt is : Could you please get record count for table MCPTest.“inflation_tufe”

I logged in with the user from Dremio UI, queries are working from web ui

Best Regards,

Vahide.

The error shows that the MCP server is trying to access Dremio tables but getting permission denied (401 Unauthorized). This means:

  1. :white_check_mark: Azure OpenAI connection is working

  2. :white_check_mark: MCP server is running

  3. :cross_mark: Dremio authentication/authorization is failing

Solution: Configure Dremio Credentials

You need to set up Dremio authentication for the MCP server. Add these environment variables:

bash

# Existing Azure OpenAI config (keep these)
export AZURE_OPENAI_API_KEY="your-key"
export AZURE_OPENAI_ENDPOINT="https://vanopenaimcp.openai.azure.com"
export AZURE_OPENAI_API_VERSION="2024-11-20"
export AZURE_OPENAI_DEPLOYMENT="your-deployment-name"
export LLM_MODEL="azure_chat_openai"

# ADD DREMIO AUTHENTICATION
export DREMIO_ENDPOINT="https://your-dremio-server:9047"  # or http://localhost:9047
export DREMIO_USERNAME="your-dremio-username"
export DREMIO_PASSWORD="your-dremio-password"

# OR use Personal Access Token (recommended for production)
export DREMIO_ENDPOINT="https://your-dremio-server:9047"
export DREMIO_PAT="your-personal-access-token"

Check Your Dremio Connection

From the screenshot, it looks like the MCP server is trying to connect to:

  • https://vanopenaimcp.openai.azure.com/openai/deployments/...

But this appears to be mixing up the Azure OpenAI endpoint with Dremio.

What is your actual Dremio server URL? It should be something like:

  • http://localhost:9047 (local)

  • https://dremio.yourcompany.com:9047 (on-prem)

  • https://app.dremio.cloud (Dremio Cloud)

Create a Personal Access Token (Recommended)

Instead of using username/password, create a PAT in Dremio:

  1. Log into Dremio UI

  2. Click your user profile (top right)

  3. Go to SettingsPersonal Access Tokens

  4. Click Generate Token

  5. Copy the token and use it:

bash

export DREMIO_PAT="dremio_pat_xxxxxxxxxxxxx"

Grant Permissions

Make sure the Dremio user has permissions to:

  • Execute SELECT queries

  • Access sys.options table

  • Access the specific schemas/tables you want to query

Complete Configuration Example

bash

# Azure OpenAI
export AZURE_OPENAI_API_KEY="31mT4nEh...ZGgp"
export AZURE_OPENAI_ENDPOINT="https://vanopenaimcp.openai.azure.com"
export AZURE_OPENAI_API_VERSION="2024-11-20"
export AZURE_OPENAI_DEPLOYMENT="gpt-4o"
export LLM_MODEL="azure_chat_openai"
export DETAILED_OUTPUT="false"

# Dremio Connection
export DREMIO_ENDPOINT="http://your-dremio-server:9047"
export DREMIO_PAT="dremio_pat_your_token_here"

# Start MCP server
python -m dremio_mcp_server

Can you share:

  1. What is your Dremio server URL/endpoint?

  2. Are you using username/password or PAT authentication?

  3. Does the Dremio user have admin privileges or specific grants?

This will help me guide you to the exact configuration needed!

Hello thank you very much for your reply

Actually, we tied both of them, after your proposal we give following variables, but it didn’t work.

user has admin rights as well

(root) root@TUP01SRV73:~/dremio-mcp# echo $DREMIO_PAT
valid-pat
(root) root@TUP01SRV73:~/dremio-mcp# echo $DREMIO_USERNAME
MCPTest
(root) root@TUP01SRV73:~/dremio-mcp# echo $DREMIO_PASSWORD
XXXXXXX
(root) root@TUP01SRV73:~/dremio-mcp# echo $DREMIO_ENDPOINT
https://10.1.1.73:9047

Here congif.yaml and other variables

Best Regards,

Vahide.

I can see from your screenshots that:

  1. :white_check_mark: Your environment variables are set correctly

  2. :white_check_mark: The MCP server configuration file shows Dremio connection details

  3. :warning: There’s a configuration file at /root/.local/share/dremio/lldp/dremio1.log

However, I notice the MCP server config shows it’s looking for a .env file but the warning says it will be ignored. Let me help you properly configure this.

The Issue: Configuration File vs Environment Variables

The MCP server appears to support both:

  1. Environment variables (what you’re using)

  2. A configuration file (what it’s checking for)

Solution 1: Create a Proper .env File

Create a .env file in your MCP server directory:

bash

cd ~/dremio-mcp
cat > .env << 'EOF'
# Azure OpenAI Configuration
AZURE_OPENAI_API_VERSION=2024-01-01-preview
AZURE_OPENAI_ENDPOINT=https://vanopenaimcp.openai.azure.com
AZURE_OPENAI_API_KEY=your-actual-key
AZURE_OPENAI_DEPLOYMENT=gpt-4o
LLM_MODEL=azure_openai:gpt-4o
DETAILED_OUTPUT=false

# Dremio Configuration
DREMIO_ENDPOINT=https://10.1.1.73:9047
DREMIO_USERNAME=MCPTest
DREMIO_PASSWORD=your-password
DREMIO_PAT=valid-pat
DREMIO_VERIFY_SSL=false
EOF

Solution 2: Check the Actual MCP Server Start Command

Looking at your config, the server mode is FOR_DATA_PATTERNS. Try starting the server explicitly:

bash

cd ~/dremio-mcp
python -m dremio_mcp_server --config .env

Or if there’s a specific script:

bash

cd ~/dremio-mcp
./run_mcp_server.sh

Solution 3: Check If There’s a Config Template

Look for configuration examples:

bash

cd ~/dremio-mcp
ls -la
cat dremio_mcp_server.yaml 2>/dev/null || echo "No YAML config"
cat config.json 2>/dev/null || echo "No JSON config"
cat README.md | grep -A 20 "Configuration"

Debugging: Check What’s Actually Running

When you see the permission errors, what command are you actually running? Are you:

  1. Running the MCP server standalone?

  2. Connecting through Claude Desktop?

  3. Using the langchain-mcp-client?

Please show me:

bash

# Show the full command you're using
ps aux | grep mcp

# Check if there are any startup scripts
ls -la ~/dremio-mcp/*.sh

# Look for the main entry point
cat ~/dremio-mcp/pyproject.toml 2>/dev/null | grep entry

What command exactly are you running when you get the 401 errors? That will help me understand the complete flow!