@ryan4u/redash-mcp-server
v1.2.0
Published
MCP server for Redash analytics integration - with SQL safety guard, caching and more
Maintainers
Readme
Redash MCP Server
MCP (Model Context Protocol) server for Redash API integration. Can be run directly via npx without installation.
What's New in v1.1.0
- 🛡️ SQL Safety Guard — Intercepts dangerous SQL operations (DROP, TRUNCATE, ALTER TABLE, etc.), PII detection, auto LIMIT. Three modes:
off/warn(default) /strict - 📦 Query Result Caching — In-memory LRU cache with configurable TTL and max memory. Reduces duplicate API calls
- 📤 Query Publish/Unpublish —
publish_query/unpublish_querytools, plusis_draftsupport inupdate_query - 🔍 Schema Exploration —
list_tables(keyword search) andget_table_columnsfor efficient schema discovery - 📊 Dashboard Publish —
publish_dashboard/unpublish_dashboardtools - ⚡ Interactive Setup —
npx @ryan4u/redash-mcp-server setupguided configuration - Total: 69 tools across 13 categories
Features
- 69 Tools: Data sources, queries, dashboards, alerts, visualizations, widgets, and more
- SQL Safety Guard: Block dangerous operations before they reach your database
- Smart Caching: In-memory query result cache to reduce API pressure
- Dual Mode: STDIO mode for single-user (Cursor, Claude Desktop) and HTTP mode for multi-user
- No Installation Required: Run directly with
npx - TypeScript: Built with TypeScript for type safety
Quick Start
1. Get Your Redash API Key
Go to your Redash instance: Settings → Account → API Key
2. Interactive Setup (Recommended)
npx @ryan4u/redash-mcp-server setupThis will guide you through configuring Redash URL, API key, and safety settings.
3. Or Manual Configuration
Cursor IDE / Claude Desktop
{
"mcpServers": {
"Redash analytics": {
"command": "npx",
"args": ["-y", "@ryan4u/redash-mcp-server", "--stdio"],
"env": {
"REDASH_API_KEY": "your-api-key-here",
"REDASH_API_URL": "http://your-redash-instance:5000/api",
"REDASH_SAFETY_MODE": "warn",
"REDASH_AUTO_LIMIT": "1000"
}
}
}
}Claude Code
claude mcp add redash-analytics \
-e REDASH_API_KEY=your-api-key-here \
-e REDASH_API_URL=http://your-redash-instance:5000/api \
-e REDASH_SAFETY_MODE=warn \
-e REDASH_AUTO_LIMIT=1000 \
-- npx -y @ryan4u/redash-mcp-server --stdio4. Run in HTTP Mode (Multi-user)
export REDASH_API_URL="http://your-redash-instance:5000/api"
export MCP_AUTH_TOKENS="token1,token2"
npx -y @ryan4u/redash-mcp-server --httpEnvironment Variables
| Variable | Mode | Required | Default | Description |
|----------|------|----------|---------|-------------|
| REDASH_API_KEY | STDIO | Yes | — | Redash API key |
| REDASH_API_URL | Both | No | http://localhost:5000/api | Redash instance API URL |
| REDASH_TIMEOUT | Both | No | 30 | Request timeout in seconds (1–300) |
| REDASH_MAX_RETRIES | Both | No | 2 | Max retries on network errors (0–5) |
| REDASH_SAFETY_MODE | Both | No | warn | SQL safety level: off / warn / strict |
| REDASH_SAFETY_DISABLE_PII | Both | No | false | Disable PII column detection |
| REDASH_SAFETY_DISABLE_COST | Both | No | false | Disable expensive query warnings |
| REDASH_AUTO_LIMIT | Both | No | 0 | Auto-append LIMIT N to queries (0=disabled) |
| REDASH_MCP_CACHE_TTL | Both | No | 300 | Query cache TTL in seconds (0=disabled) |
| REDASH_MCP_CACHE_MAX_MB | Both | No | 50 | Max cache memory in MB |
| MCP_MODE | Both | No | stdio | Server mode: stdio or http |
| MCP_AUTH_TOKENS | HTTP | Yes | — | Comma-separated MCP access tokens |
| MCP_HOST | HTTP | No | 127.0.0.1 | HTTP bind address |
| MCP_PORT | HTTP | No | 3000 | HTTP port number |
| MCP_RATE_LIMIT | HTTP | No | 60 | Max requests/min per IP |
| MCP_SESSION_TIMEOUT | HTTP | No | 1800 | Session TTL in seconds |
| MCP_MAX_BODY_SIZE | HTTP | No | 1048576 | Max request body in bytes |
| LOG_LEVEL | Both | No | info | Log level |
SQL Safety Guard
The SQL Safety Guard protects your production database by intercepting dangerous operations.
Always Blocked (any mode except off)
DROP TABLE / DATABASE / SCHEMA / INDEX / VIEWTRUNCATE TABLEALTER TABLEGRANT/REVOKEDELETE FROM/UPDATEwithoutWHEREclause
Mode-dependent Checks
| Check | off | warn | strict |
|-------|-------|--------|----------|
| Dangerous operations (DROP, TRUNCATE, etc.) | ✗ | 🚫 Blocked | 🚫 Blocked |
| SELECT * | ✗ | ⚠️ Warning | 🚫 Blocked |
| SELECT without LIMIT | ✗ | ⚠️ Warning | 🚫 Blocked |
| PII columns detected | ✗ | ⚠️ Warning | 🚫 Blocked |
| Expensive operations (CROSS JOIN, etc.) | ✗ | ⚠️ Warning | ⚠️ Warning |
Auto LIMIT
Set REDASH_AUTO_LIMIT=1000 to automatically append LIMIT 1000 to all SELECT queries lacking a LIMIT clause.
Available Tools
Data Sources (8)
list_data_sources— List all available data sourcesget_data_source— Get data source detailsget_data_source_schema— Get table/column schemalist_tables[NEW] — List tables with optional keyword searchget_table_columns[NEW] — Get column names and types for a tabletest_data_source— Test data source connectionpause_data_source— Pause a data sourceresume_data_source— Resume a paused data source
Queries (14)
list_queries— List saved queries with paginationget_query— Get query details including SQLsearch_queries— Search queries by name/descriptioncreate_query— Create a new query (supportsis_draft)update_query— Update query (supportsis_draft)publish_query[NEW] — Publish a query (set is_draft=false)unpublish_query[NEW] — Unpublish a query (set is_draft=true)archive_query— Archive a queryrefresh_query— Force refresh query resultsfork_query— Fork a querylist_my_queries— List my querieslist_recent_queries— List recent querieslist_archived_queries— List archived querieslist_query_tags— List all query tags
Query Execution (6)
execute_query— Execute a saved queryexecute_adhoc_query— Execute an ad-hoc SQL query (with SQL Safety Guard)get_query_result— Get cached query resultget_job_status— Get background job statuscache_stats[NEW] — Get query cache statisticsclear_cache[NEW] — Clear all cached results
Dashboards (12)
list_dashboards— List dashboards with paginationget_dashboard— Get dashboard with widgetscreate_dashboard— Create a new dashboardupdate_dashboard— Update dashboard (supportsis_draft)publish_dashboard[NEW] — Publish a dashboardunpublish_dashboard[NEW] — Unpublish a dashboardarchive_dashboard— Archive a dashboardfork_dashboard— Fork a dashboardshare_dashboard— Enable public dashboard accessunshare_dashboard— Disable public dashboard accesslist_my_dashboards— List my dashboardslist_dashboard_tags— List all dashboard tags
Widgets (2)
add_widget— Add a widget to a dashboardremove_widget— Remove a widget from a dashboard
Visualizations (3)
create_visualization— Create a visualization for a queryupdate_visualization— Update a visualizationdelete_visualization— Delete a visualization
Alerts (10)
list_alerts— List all alertsget_alert— Get alert detailscreate_alert— Create an alertupdate_alert— Update an alertdelete_alert— Delete an alertmute_alert— Mute an alertunmute_alert— Unmute an alertlist_alert_subscriptions— List alert subscriptionscreate_alert_subscription— Subscribe a destination to an alertdelete_alert_subscription— Remove an alert subscription
Users (2)
list_users— List usersget_user— Get user details
Favorites (6)
favorite_query/unfavorite_query— Add/remove query from favoritesfavorite_dashboard/unfavorite_dashboard— Add/remove dashboard from favoriteslist_favorite_queries— List favorite querieslist_favorite_dashboards— List favorite dashboards
Query Snippets (5)
list_query_snippets— List query snippetsget_query_snippet— Get snippet detailscreate_query_snippet— Create a query snippetupdate_query_snippet— Update a query snippetdelete_query_snippet— Delete a query snippet
Destinations (1)
list_destinations— List notification destinations
Resources
redash://data_sources— List of all data sourcesredash://queries— List of recent queriesredash://dashboards— List of dashboardsredash://datasource/{id}/schema— Data source schemaredash://query/{id}— Query detailsredash://dashboard/{slug}— Dashboard details
Prompts
explore_data— Explore data from a data source (useslist_tablesandget_table_columns)build_dashboard— Build a new dashboardsetup_alert— Set up an alert for a queryoptimize_query— Optimize a SQL querymonitor_system— Monitor Redash system health
Development
Setup
git clone https://github.com/ryan4u/redash-mcp-server.git
cd redash-mcp-server
npm installBuild
npm run buildDevelopment Mode
npm run devLocal Testing
REDASH_API_KEY=your-key REDASH_API_URL=http://localhost:5000/api npm startPublishing to npm
- Build the project:
npm run build - Login to npm:
npm login - Publish:
npm publish --access public
License
MIT License — see LICENSE file for details.
