@jagadeesh52423/redash-mcp
v0.0.2
Published
MCP server for Redash integration
Readme
Redash MCP Server
Model Context Protocol (MCP) server for integrating Redash with AI assistants like Claude.
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
Clone this repository:
git clone https://github.com/jagadeesh52423/redash-mcp.git cd redash-mcpInstall dependencies:
npm installCreate a
.envfile with your Redash configuration:REDASH_URL=https://your-redash-instance.com REDASH_API_KEY=your_api_keyBuild the project:
npm run buildStart the server:
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):
{
"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 searchget_query: Get details of a specific query including parameterscreate_query: Create a new query with automatic validationupdate_query: Update an existing query with validationarchive_query: Archive (soft-delete) a querylist_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 parametersexecute_raw_query: Execute raw SQL queries directly
Dashboard Management
list_dashboards: List all available dashboards with paginationget_dashboard: Get dashboard details including widgetscreate_dashboard: Create new dashboards with filters
Widget Management
create_widget: Create dashboard widgets (text or visualization)update_widget: Update existing widgetsdelete_widget: Remove widgets from dashboards
Visualization Management
get_visualization: Get visualization details and configurationcreate_visualization: Create new visualizations for queriesupdate_visualization: Update visualization settingsdelete_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.
// 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:
// 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, pendingParameter Types Supported
text: Text input fieldnumber: Numeric input fielddate: Date pickerdate-range: Date range picker with start and end datesenum: Dropdown selection with predefined options
Dashboard and Widget Management
Create comprehensive dashboards with widgets:
// 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:
# 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-sslDevelopment
Run in development mode:
npm run devTroubleshooting
SSL Certificate Issues
If you encounter SSL certificate errors when connecting to your Redash instance:
# 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-sslCommon Issues
Query Validation Failures: If queries fail validation but you know they're correct, you can skip validation:
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
enumOptionsfor dropdown selections - Automatic query validation before create/update operations
- Enhanced parameter management with type-specific options
- Improved error handling and validation feedback
- Enum parameter support with
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
