Skip to main content
Glama
jagadeesh52423

Redash MCP Server

README.md
# Redash MCP Server

Model Context Protocol (MCP) server for integrating Redash with AI assistants like Claude.

<a href="https://glama.ai/mcp/servers/j9bl90s3tw">
  <img width="380" height="200" src="https://glama.ai/mcp/servers/j9bl90s3tw/badge" alt="Redash Server MCP server" />
</a>

## Features

- **Query Management**: Create, update, archive, and execute Redash queries with automatic validation
- **Parameter Management**: Add and configure query parameters including dropdown/enum types
- **Dashboard Management**: Create, manage dashboards and widgets
- **Visualization Management**: Create, update, and delete visualizations
- **Data Source Integration**: List and work with multiple data sources
- **Resource Access**: Browse queries and dashboards as MCP resources
- **Query Validation**: Automatic query execution validation before creation/updates
- **Flexible Authentication**: Support for API keys with configurable SSL options

## Prerequisites

- Node.js (v18 or later)
- npm or yarn
- Access to a Redash instance
- Redash API key

## Environment Variables

The server requires the following environment variables:

- `REDASH_URL`: Your Redash instance URL (e.g., https://redash.example.com)
- `REDASH_API_KEY`: Your Redash API key

Optional variables:
- `REDASH_TIMEOUT`: Timeout for API requests in milliseconds (default: 30000)
- `NODE_TLS_REJECT_UNAUTHORIZED`: Set to '0' to ignore SSL certificate errors (not recommended for production)
- `REDASH_IGNORE_SSL_ERRORS`: Set to 'true' to ignore SSL certificate verification errors

## Installation

1. Clone this repository:
   ```bash
   git clone https://github.com/jagadeesh52423/redash-mcp.git
   cd redash-mcp
   ```

2. Install dependencies:
   ```bash
   npm install
   ```

3. Create a `.env` file with your Redash configuration:
   ```
   REDASH_URL=https://your-redash-instance.com
   REDASH_API_KEY=your_api_key
   ```

4. Build the project:
   ```bash
   npm run build
   ```

5. Start the server:
   ```bash
   npm start
   ```

## Usage with Claude for Desktop

To use this MCP server with Claude for Desktop, configure it in your Claude for Desktop configuration file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

Add the following configuration (edit paths as needed):

```json
{
  "mcpServers": {
    "redash": {
      "command": "npx",
      "args": [
         "-y",
         "@jagadeesh52423/redash-mcp"
      ],
      "env": {
        "REDASH_API_KEY": "your-api-key",
        "REDASH_URL": "https://your-redash-instance.com"
      }
    }
  }
}
```

## Available Tools

### Query Management
- `list_queries`: List all available queries with pagination and search
- `get_query`: Get details of a specific query including parameters
- `create_query`: Create a new query with automatic validation
- `update_query`: Update an existing query with validation
- `archive_query`: Archive (soft-delete) a query
- `list_data_sources`: List all available data sources

### Query Parameters
- `add_query_parameter`: Add parameters to queries (text, number, date, date-range, enum)
- `update_query_parameter_type`: Update parameter types and options

### Query Execution
- `execute_query`: Execute a saved query with parameters
- `execute_raw_query`: Execute raw SQL queries directly

### Dashboard Management
- `list_dashboards`: List all available dashboards with pagination
- `get_dashboard`: Get dashboard details including widgets
- `create_dashboard`: Create new dashboards with filters

### Widget Management
- `create_widget`: Create dashboard widgets (text or visualization)
- `update_widget`: Update existing widgets
- `delete_widget`: Remove widgets from dashboards

### Visualization Management
- `get_visualization`: Get visualization details and configuration
- `create_visualization`: Create new visualizations for queries
- `update_visualization`: Update visualization settings
- `delete_visualization`: Delete visualizations

## Key Features

### Automatic Query Validation

The server automatically validates queries before creating or updating them by executing them first. This prevents saving queries with syntax errors or permission issues.

```typescript
// Query validation is enabled by default
await createQuery({
  name: "Test Query",
  data_source_id: 1,
  query: "SELECT * FROM users", // This will be tested before saving
});

// Skip validation if needed
await createQuery({
  name: "Test Query",
  data_source_id: 1,
  query: "SELECT * FROM users",
  skipValidation: true // Bypasses validation
});
```

### Enum Parameters with Dropdown Options

Create dropdown parameters for queries using the enum type:

```typescript
// Add an enum parameter with dropdown options
await addQueryParameter({
  queryId: 123,
  parameterName: "status",
  parameterType: "enum",
  enumOptions: "active\ninactive\npending", // Newline-separated options
  defaultValue: "active"
});

// This creates a dropdown with options: active, inactive, pending
```

### Parameter Types Supported

- `text`: Text input field
- `number`: Numeric input field
- `date`: Date picker
- `date-range`: Date range picker with start and end dates
- `enum`: Dropdown selection with predefined options

### Dashboard and Widget Management

Create comprehensive dashboards with widgets:

```typescript
// Create a dashboard
const dashboard = await createDashboard({
  name: "Analytics Dashboard",
  dashboard_filters_enabled: true
});

// Add a visualization widget
await createWidget({
  dashboard_id: dashboard.id,
  visualization_id: 456,
  options: {
    position: { sizeX: 3, sizeY: 2, col: 0, row: 0 }
  }
});

// Add a text widget
await createWidget({
  dashboard_id: dashboard.id,
  text: "## Welcome to Analytics",
  options: {
    position: { sizeX: 6, sizeY: 1, col: 0, row: 2 }
  }
});
```

## CLI Usage

The server also supports CLI arguments for configuration:

```bash
# Using CLI arguments
node dist/index.js --url https://redash.example.com --api-key your_key

# With SSL options
node dist/index.js --url https://redash.example.com --api-key your_key --ignore-ssl
```

## Development

Run in development mode:
```bash
npm run dev
```

## Troubleshooting

### SSL Certificate Issues

If you encounter SSL certificate errors when connecting to your Redash instance:

```bash
# Option 1: Use environment variable (affects all Node.js processes)
export NODE_TLS_REJECT_UNAUTHORIZED=0

# Option 2: Use Redash-specific environment variable
export REDASH_IGNORE_SSL_ERRORS=true

# Option 3: Use CLI flag
node dist/index.js --ignore-ssl
```

### Common Issues

**Query Validation Failures**: If queries fail validation but you know they're correct, you can skip validation:
```typescript
await createQuery({
  name: "Complex Query",
  query: "SELECT * FROM complex_view",
  skipValidation: true
});
```

**Parameter Not Found Errors**: When updating parameter types, ensure the parameter exists first or create it with `add_query_parameter`.

**Dashboard Widget Positioning**: Widget positions use a grid system. Ensure `col` and `row` values don't overlap with existing widgets.

## Version History

- **v1.3.0**: Added enum parameters with dropdown options and automatic query validation
  - Enum parameter support with `enumOptions` for dropdown selections
  - Automatic query validation before create/update operations
  - Enhanced parameter management with type-specific options
  - Improved error handling and validation feedback

- **v1.2.0**: Comprehensive dashboard and widget management
  - Dashboard creation and management
  - Widget creation, updating, and deletion
  - Visualization management (create, update, delete)
  - Enhanced dashboard filtering capabilities

- **v1.1.0**: Enhanced query management and SSL improvements
  - Query parameter management (add, update parameter types)
  - SSL certificate verification options
  - CLI argument support for configuration
  - Improved error handling and logging

- **v1.0.0**: Initial release with basic query and resource management

## License

MIT

TDQS

A3.5/5.0

Scored across 15 tools

Disambiguation5/5

Each tool maps to a distinct resource-action pair (query, data source, dashboard, visualization, widget), with no meaningful overlap. execute_query and execute_raw_query are clearly differentiated by saved vs. raw SQL.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern (list_queries, get_query, update_query, create_widget, etc.), using standard verbs and plural/singular nouns appropriately. No mixed conventions or vague names.

Tool Count5/5

With 15 tools, the server provides broad coverage of Redash's core objects without being bloated. Each tool serves a clear purpose, and the count aligns well with the typical scope for a domain-specific MCP server.

Completeness4/5

Queries have full CRUD and execution, dashboards have list/get/create but lack update/delete, and visualizations have only get (no create/update). Widgets are covered, but the missing dashboard lifecycle and visualization management create notable gaps for a management tool.

Maintenance

ActivityInactive
ResponsivenessNo issues