@sugitat/redash-mcp 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # Redash MCP Server
2
+
3
+ Model Context Protocol (MCP) server for integrating Redash with AI assistants like Claude.
4
+
5
+ <a href="https://glama.ai/mcp/servers/j9bl90s3tw">
6
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/j9bl90s3tw/badge" alt="Redash Server MCP server" />
7
+ </a>
8
+
9
+ ## Features
10
+
11
+ - Connect to Redash instances via the Redash API
12
+ - List available queries and dashboards as resources
13
+ - Execute queries and retrieve results
14
+ - Create and manage queries (create, update, archive)
15
+ - List data sources for query creation
16
+ - Get dashboard details and visualizations
17
+
18
+ ## Prerequisites
19
+
20
+ - Node.js (v18 or later)
21
+ - npm or yarn
22
+ - Access to a Redash instance
23
+ - Redash API key
24
+
25
+ ## Environment Variables
26
+
27
+ The server requires the following environment variables:
28
+
29
+ - `REDASH_URL`: Your Redash instance URL (e.g., https://redash.example.com)
30
+ - `REDASH_API_KEY`: Your Redash API key
31
+
32
+ Optional variables:
33
+ - `REDASH_TIMEOUT`: Timeout for API requests in milliseconds (default: 30000)
34
+ - `REDASH_MAX_RESULTS`: Maximum number of results to return (default: 1000)
35
+ - `REDASH_EXTRA_HEADERS`: Extra HTTP headers to include with every Redash request. Accepts either a JSON object string or a semicolon/comma-separated list of `key=value` pairs.
36
+
37
+ Examples:
38
+
39
+ JSON (recommended):
40
+ ```
41
+ REDASH_EXTRA_HEADERS='{"CF-Access-Client-Id":"<client_id>","CF-Access-Client-Secret":"<client_secret>"}'
42
+ ```
43
+
44
+ Key/value list:
45
+ ```
46
+ REDASH_EXTRA_HEADERS=CF-Access-Client-Id=<client_id>;CF-Access-Client-Secret=<client_secret>
47
+ ```
48
+
49
+ Notes:
50
+ - The `Authorization` header is managed by the server (`Key <REDASH_API_KEY>`) and cannot be overridden.
51
+ - All extra headers are added to every request made to Redash.
52
+
53
+ ## Installation
54
+
55
+ 1. Clone this repository:
56
+ ```bash
57
+ git clone https://github.com/suthio/redash-mcp.git
58
+ cd redash-mcp
59
+ ```
60
+
61
+ 2. Install dependencies:
62
+ ```bash
63
+ npm install
64
+ ```
65
+
66
+ 3. Create a `.env` file with your Redash configuration:
67
+ ```
68
+ REDASH_URL=https://your-redash-instance.com
69
+ REDASH_API_KEY=your_api_key
70
+ # Optional: Cloudflare Access (or other gateway) headers
71
+ # REDASH_EXTRA_HEADERS='{"CF-Access-Client-Id":"<client_id>","CF-Access-Client-Secret":"<client_secret>"}'
72
+ ```
73
+
74
+ 4. Build the project:
75
+ ```bash
76
+ npm run build
77
+ ```
78
+
79
+ 5. Start the server:
80
+ ```bash
81
+ npm start
82
+ ```
83
+
84
+ ## Usage with Claude for Desktop
85
+
86
+ To use this MCP server with Claude for Desktop, configure it in your Claude for Desktop configuration file:
87
+
88
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
89
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
90
+
91
+ Add the following configuration (edit paths as needed):
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "redash": {
97
+ "command": "npx",
98
+ "args": [
99
+ "-y",
100
+ "@suthio/redash-mcp"
101
+ ],
102
+ "env": {
103
+ "REDASH_API_KEY": "your-api-key",
104
+ "REDASH_URL": "https://your-redash-instance.com"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ## Available Tools
112
+
113
+ ### Query Management
114
+ - `list-queries`: List all available queries in Redash
115
+ - `get-query`: Get details of a specific query
116
+ - `create-query`: Create a new query in Redash
117
+ - `update-query`: Update an existing query in Redash
118
+ - `archive-query`: Archive (soft-delete) a query
119
+ - `list-data-sources`: List all available data sources
120
+
121
+ ### Query Execution
122
+ - `execute-query`: Execute a query and return results
123
+ - `execute-adhoc-query`: Execute an ad-hoc query without saving it to Redash
124
+ - `get-query-results-csv`: Get query results in CSV format (supports optional refresh for latest data)
125
+
126
+ ### Dashboard Management
127
+ - `list-dashboards`: List all available dashboards
128
+ - `get-dashboard`: Get dashboard details and visualizations
129
+ - `get-visualization`: Get details of a specific visualization
130
+
131
+ ### Visualization Management
132
+ - `create-visualization`: Create a new visualization for a query
133
+ - `update-visualization`: Update an existing visualization
134
+ - `delete-visualization`: Delete a visualization
135
+
136
+ ## Development
137
+
138
+ Run in development mode:
139
+ ```bash
140
+ npm run dev
141
+ ```
142
+
143
+ ## Testing
144
+
145
+ ### Unit Tests
146
+
147
+ ```bash
148
+ npm test
149
+ ```
150
+
151
+ ### E2E Tests
152
+
153
+ ```bash
154
+ npm run e2e:test
155
+ ```
156
+
157
+ E2E tests use these default values (can be overridden with environment variables):
158
+ - `REDASH_URL`: https://demo.redash.io
159
+ - `REDASH_API_KEY`: test_api_key
160
+
161
+ Override example:
162
+ ```bash
163
+ REDASH_URL=https://your-instance.com REDASH_API_KEY=your_key npm run e2e:test
164
+ ```
165
+
166
+ ### Manual Testing
167
+
168
+ ```bash
169
+ npm run inspector
170
+ ```
171
+
172
+ ## Version History
173
+
174
+ - v1.1.0: Added query management functionality (create, update, archive)
175
+ - v1.0.0: Initial release
176
+
177
+ ## License
178
+
179
+ MIT
package/dist/cli.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ import * as dotenv from 'dotenv';
3
+ import { existsSync } from 'fs';
4
+ import * as path from 'path';
5
+ // Check if .env file exists in current directory and load it
6
+ const envPath = path.join(process.cwd(), '.env');
7
+ if (existsSync(envPath)) {
8
+ dotenv.config({ path: envPath });
9
+ }
10
+ // Check required environment variables
11
+ const requiredVars = ['REDASH_URL', 'REDASH_API_KEY'];
12
+ const missingVars = requiredVars.filter(varName => !process.env[varName]);
13
+ if (missingVars.length > 0) {
14
+ console.error(`Error: Missing required environment variables: ${missingVars.join(', ')}`);
15
+ console.error('');
16
+ console.error('Please create a .env file in your current directory with the following variables:');
17
+ console.error('');
18
+ console.error('REDASH_URL=https://your-redash-instance.com');
19
+ console.error('REDASH_API_KEY=your_api_key');
20
+ console.error('');
21
+ console.error('Or provide them when running the command:');
22
+ console.error('');
23
+ console.error('REDASH_URL=https://your-redash-instance.com REDASH_API_KEY=your_key npx @suthio/redash-mcp');
24
+ process.exit(1);
25
+ }
26
+ // Run the MCP server
27
+ import './index.js';