redash-connector-mcp
v1.0.6
Published
MCP server for Redash integration
Maintainers
Readme
redash-connector-mcp
A Model Context Protocol (MCP) server that enables seamless integration between Redash and Claude AI (Desktop & Code). Query your data warehouse, manage queries, and execute analytics workflows directly through natural language conversations with Claude.
Table of Contents
- Features
- Installation
- Configuration
- Usage
- Available Tools
- MCP Resources
- Development
- Troubleshooting
- Security
- Contributing
- License
Features
🔍 Comprehensive Query Management
- List & Search: Browse queries with pagination, filter by tags, search by keywords
- CRUD Operations: Create, read, update, and archive queries
- Smart Tagging: Organize queries with tags and retrieve tag statistics
⚡ Query Execution
- Async Polling: Execute long-running queries with automatic job polling
- Parameterized Queries: Pass dynamic parameters to queries
- Cached Results: Retrieve cached results without re-execution (configurable TTL)
📊 Dashboard & Data Source Management
- Dashboard Access: List and view Redash dashboards
- Data Source Discovery: Explore available data sources
🔗 MCP Resources
- Resource URIs: Access queries and dashboards as MCP resources (
redash://query/{id},redash://dashboard/{id}) - Rich Metadata: Get query definitions and execution results in one call
🛡️ Production-Ready
- Type Safety: Full TypeScript implementation with strict type checking
- Error Handling: Comprehensive error handling with detailed logging
- Test Coverage: 86%+ test coverage with 107 unit tests
- Logging: Configurable logging levels (DEBUG, INFO, WARNING, ERROR)
Installation
Quick Start (Claude MCP Add)
The easiest way to install is using the claude mcp add command:
claude mcp add redash \
--env REDASH_URL=https://your-redash-instance.com \
--env REDASH_API_KEY=your_api_key_here \
-- npx -y redash-connector-mcpReplace the following:
https://your-redash-instance.com- Your Redash instance URLyour_api_key_here- Your Redash API key (see Getting Your Redash API Key)
This command will:
- Automatically install the latest version via npx (no global install needed)
- Configure the MCP server with your credentials
- Make it available in Claude Desktop/Code
After running this command, restart Claude Desktop/Code to activate the server.
Manual Installation
1. Install the Package
npm install -g redash-connector-mcp2. Configure MCP Settings
Add the following to your Claude MCP configuration file:
macOS/Linux: ~/.claude/config.json
Windows: %APPDATA%\Claude\config.json
{
"mcpServers": {
"redash": {
"command": "redash-connector-mcp",
"env": {
"REDASH_URL": "https://your-redash-instance.com",
"REDASH_API_KEY": "your_api_key_here"
}
}
}
}3. Restart Claude
Restart Claude Desktop or Claude Code to load the MCP server.
Configuration
Environment Variables
The MCP server requires the following environment variables:
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| REDASH_URL | Yes | - | Your Redash instance URL (e.g., https://redash.example.com) |
| REDASH_API_KEY | Yes | - | Your Redash user API key |
| REDASH_TIMEOUT | No | 30000 | HTTP request timeout in milliseconds |
| REDASH_JOB_TIMEOUT | No | 60000 | Query job polling timeout in milliseconds |
| REDASH_JOB_POLL_INTERVAL | No | 1000 | Job polling interval in milliseconds |
| LOG_LEVEL | No | INFO | Logging level: DEBUG, INFO, WARNING, ERROR |
When using claude mcp add: Environment variables are passed directly via --env flags (no .env file needed).
When running manually or in development: You can create a .env file in your project directory:
REDASH_URL=https://your-redash-instance.com
REDASH_API_KEY=your_api_key_here
REDASH_TIMEOUT=30000
LOG_LEVEL=INFOGetting Your Redash API Key
- Log in to your Redash instance
- Click your profile icon (top-right corner)
- Navigate to Settings → Account
- Find or generate your API Key under the "API Key" section
- Copy the key and use it as
REDASH_API_KEY
Security Note: Keep your API key confidential. Never commit it to version control.
Usage
Once configured, interact with Redash through natural language conversations with Claude:
Example Conversations
Query Management
You: "List all queries tagged with 'sales'"
Claude: [Uses list-queries tool with tag filter]
You: "Show me query ID 123"
Claude: [Uses get-query tool]
You: "Create a query named 'Daily Revenue' that selects from the sales table"
Claude: [Uses create-query tool]
You: "Update query 123 to include WHERE date > '2024-01-01'"
Claude: [Uses update-query tool]Query Execution
You: "Execute query 430"
Claude: [Uses execute-query tool, polls async job if needed]
You: "Run query 430 with start_date='2024-01-01' and end_date='2024-12-31'"
Claude: [Uses execute-query tool with parameters]
You: "Get the cached results for query 430"
Claude: [Uses get-query-results tool]Dashboards & Data Sources
You: "Show me all dashboards"
Claude: [Uses list-dashboards tool]
You: "What data sources are available?"
Claude: [Uses list-data-sources tool]
You: "Show me the details of dashboard 5"
Claude: [Uses get-dashboard tool]Analytics & Insights
You: "What are the most commonly used query tags?"
Claude: [Uses list-query-tags tool]
You: "Find all queries about customer churn"
Claude: [Uses list-queries with search parameter]Available Tools
The MCP server provides 11 tools for interacting with Redash:
Query Management (5 tools)
| Tool | Description | Parameters |
|------|-------------|------------|
| list-queries | List queries with pagination, filtering, and search | page, pageSize, tag, search |
| get-query | Get detailed information about a query | queryId |
| create-query | Create a new query | name, dataSourceId, query, description, tags, options, schedule |
| update-query | Update an existing query | queryId, name, query, description, tags, options, schedule |
| archive-query | Archive (soft delete) a query | queryId |
Query Execution (2 tools)
| Tool | Description | Parameters |
|------|-------------|------------|
| execute-query | Execute a query and return results (async polling supported) | queryId, parameters |
| get-query-results | Get cached results without re-execution | queryId, maxAge (default: 86400s) |
Dashboard Management (2 tools)
| Tool | Description | Parameters |
|------|-------------|------------|
| list-dashboards | List dashboards with pagination | page, pageSize |
| get-dashboard | Get dashboard details and widgets | dashboardId |
Data Source Management (1 tool)
| Tool | Description | Parameters |
|------|-------------|------------|
| list-data-sources | List all available data sources | - |
Tag Management (1 tool)
| Tool | Description | Parameters |
|------|-------------|------------|
| list-query-tags | List query tags with usage counts (sorted by frequency) | - |
MCP Resources
The server exposes Redash queries and dashboards as MCP resources, enabling Claude to discover and read them:
Resource URIs
- Queries:
redash://query/{queryId} - Dashboards:
redash://dashboard/{dashboardId}
Resource Discovery
Claude can automatically discover available queries and dashboards through the listResources() MCP endpoint.
Reading Resources
When reading a query resource, the response includes:
- Query definition (name, SQL, description, tags, etc.)
- Latest execution results (if available)
- Metadata (creation date, author, etc.)
Example resource read:
{
"uri": "redash://query/123",
"mimeType": "application/json",
"contents": {
"query": { "id": 123, "name": "Sales Report", "query": "SELECT ..." },
"result": { "data": { "rows": [...], "columns": [...] } }
}
}Development
Prerequisites
- Node.js 18+ (recommended: Node.js 20 LTS)
- npm 9+
- A Redash instance (for testing)
Setup
Clone the repository
git clone https://github.com/yourusername/redash-connector-mcp.git cd redash-connector-mcpInstall dependencies
npm installSet up environment variables
cp .env.example .env # Edit .env with your Redash credentialsBuild the project
npm run build
Testing
The project uses Vitest for testing with 86%+ coverage:
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Run tests with UI
npm run test:uiTest Structure:
tests/unit/- Unit tests for core modulestests/helpers/- Test helpers and mockstests/fixtures/- Test data fixtures
Coverage Report:
File | Lines | Funcs | Branch | Stmts
-----------------|--------|--------|--------|--------
All files | 86.33% | 93.33% | 73.42% | 83.94%
index.ts | 75% | 83.33% | 55.38% | 73.41%
logger.ts | 100% | 100% | 100% | 100%
redashClient.ts | 99.11% | 100% | 88.15% | 95.16%Code Quality
# Type checking
npm run typecheck
# Linting
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Format code
npm run formatPre-commit Hooks: Husky + lint-staged automatically run linting and formatting on staged files.
Local Development with Claude
To test your local build with Claude Desktop/Code:
{
"mcpServers": {
"redash-dev": {
"command": "node",
"args": ["/absolute/path/to/redash-connector-mcp/dist/index.js"],
"env": {
"REDASH_URL": "https://your-redash-instance.com",
"REDASH_API_KEY": "your_api_key_here",
"LOG_LEVEL": "DEBUG"
}
}
}
}Troubleshooting
Common Issues
Error: "REDASH_URL and REDASH_API_KEY must be provided"
Cause: Environment variables are not configured correctly.
Solution:
- Verify the MCP configuration file exists at
~/.claude/config.json(macOS/Linux) or%APPDATA%\Claude\config.json(Windows) - Ensure
REDASH_URLandREDASH_API_KEYare set in theenvsection - Restart Claude after making changes
- Check the MCP server logs for detailed error messages
Error: "Query execution timed out"
Cause: Query is taking longer than the configured timeout.
Solutions:
- Increase
REDASH_JOB_TIMEOUT(default: 60000ms)"env": { "REDASH_URL": "...", "REDASH_API_KEY": "...", "REDASH_JOB_TIMEOUT": "120000" } - Optimize the query in Redash's web interface
- Check if the query executes successfully in Redash directly
Error: "Failed to fetch queries from Redash"
Cause: Connection or authentication issue.
Solutions:
- Verify
REDASH_URLis correct and accessible from your machine - Test the URL in a browser:
https://your-redash-instance.com/api/queries - Verify
REDASH_API_KEYis valid (regenerate if necessary) - Check network connectivity and firewall settings
- Ensure your Redash instance is running
MCP Server Not Appearing in Claude
Solutions:
- Restart Claude Desktop/Code completely (quit and reopen)
- Check the MCP configuration file syntax (must be valid JSON)
- Verify the
commandpath is correct - Check Claude's MCP logs for error messages
Debugging
Enable debug logging for detailed information:
{
"mcpServers": {
"redash": {
"command": "redash-connector-mcp",
"env": {
"REDASH_URL": "https://your-redash-instance.com",
"REDASH_API_KEY": "your_api_key_here",
"LOG_LEVEL": "DEBUG"
}
}
}
}Logs will appear in Claude's MCP server logs panel.
Security
Best Practices
API Key Security
- Never commit API keys to version control
- Use environment variables or secure secret management
- Rotate API keys periodically
- Use read-only API keys when possible
Network Security
- Use HTTPS for Redash instance URLs
- Consider IP whitelisting if your Redash instance supports it
- Use VPN or private networks for sensitive data
Access Control
- The MCP server inherits the permissions of the Redash API key
- Use API keys with minimal necessary permissions
- Avoid using admin API keys for routine operations
Reporting Security Issues
If you discover a security vulnerability, please email [email protected] instead of using the issue tracker.
Contributing
We welcome contributions! Here's how you can help:
Getting Started
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Write or update tests
- Ensure all tests pass (
npm test) - Ensure code quality checks pass (
npm run lint && npm run typecheck) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Code Style: Follow the existing code style (enforced by ESLint + Prettier)
- Tests: Maintain or improve test coverage (currently 86%+)
- Documentation: Update README.md for new features
- Commits: Use clear, descriptive commit messages
- Types: Add proper TypeScript types for all new code
Pull Request Process
- Update the README.md with details of changes (if applicable)
- Add tests for new functionality
- Ensure the test suite passes
- Update the version number following SemVer
- The PR will be merged once approved by maintainers
Code of Conduct
This project follows the Contributor Covenant Code of Conduct.
Roadmap
Future enhancements under consideration:
- [ ] Query result caching with configurable TTL
- [ ] Batch query execution
- [ ] Query scheduling management
- [ ] Alert configuration
- [ ] Visualization metadata extraction
- [ ] Query performance metrics
- [ ] Multi-instance support
- [ ] Webhook support for query completion
See Issues for active feature requests.
Related Projects
- Model Context Protocol - The MCP specification
- Redash - Open source data visualization platform
- Claude Desktop - Desktop app for Claude AI
- Claude Code - VS Code extension for Claude AI
License
MIT License - see LICENSE file for details.
Acknowledgments
- Built with the Model Context Protocol SDK
- Powered by Redash API
- TypeScript, Vitest, and the amazing open-source community
Made with ❤️ for the Redash and Claude AI communities
If you find this project useful, please consider giving it a ⭐ on GitHub!
