Redash MCP服务器

Redash MCP服务器通过Model Context Protocol(MCP)提供对Redash核心数据操作的访问,适用于需要远程或本地集成Redash功能的场景。

  • by conekta
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 conekta/redash-mcp-server

使用说明

Redash MCP服务器

MCP服务器 红灰 API将Redash的核心数据操作作为 模型上下文协议.

设置

# Install dependencies
uv sync

# Set your Redash API key and URL
export REDASH_API_KEY=your_api_key
export REDASH_URL=https://redash.example.com

# Run the server
uv run python -m redash_mcp

默认情况下,服务器使用 stdio 本地MCP客户端(如Claude Desktop)的传输。

托管MCP

服务器可以通过Streamable HTTP部署为远程MCP端点:

uv run python -m redash_mcp --transport streamable-http

在请求头中发送您的Redash API密钥:

Authorization: Key your_api_key

配置(托管/流式HTTP)

如果您的MCP客户端支持通过HTTP的远程服务器,JSON配置应包括托管URL和 Authorization 头球

例子:

{
  "mcpServers": {
    "redash": {
      "url": "https://your-mcp-host.com/mcp",
      "headers": {
        "Authorization": "Key your_api_key"
      }
    }
  }
}

笔记:

  • 替换 your_api_key 使用您的真实Redash API密钥。
  • 标题必须准确无误 Authorization.
  • 该值必须包括 Key 前缀。

克劳德代码(CLI)

claude mcp add --transport http redash https://your-mcp-host.com/mcp \
  --header "Authorization: Key your_api_key"

替换 your_api_key 使用您的真实Redash API密钥。

配置(克劳德桌面/stdio)

添加 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "redash": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/redash-mcp-server", "run", "python", "-m", "redash_mcp"],
      "env": {
        "REDASH_API_KEY": "your_api_key",
        "REDASH_URL": "https://redash.example.com"
      }
    }
  }
}

可用工具

资源 工具
查询 list_queries, get_query, create_query, update_query, search_queries, get_recent_queries, archive_query, refresh_query
仪表板 list_dashboards, get_dashboard, create_dashboard, update_dashboard
数据来源 list_data_sources, get_data_source, get_data_source_schema, check_data_source_connection
查询结果 get_query_result, execute_query
用户 list_users, get_user
警报 list_alerts, get_alert, create_alert
可视化 list_query_visualizations

环境变量

变量 描述 默认值
REDASH_API_KEY Redash API密钥(stdio传输所需) -
REDASH_URL Redash实例的基本URL http://localhost:5000
REDASH_MCP_TRANSPORT 运输类型(stdio 或 streamable-http) stdio
REDASH_MCP_HOST 主机绑定HTTP服务器 127.0.0.1
REDASH_MCP_PORT HTTP服务器端口 8000
REDASH_MCP_STREAMABLE_HTTP_PATH MCP端点的HTTP路径 /mcp

码头工人

# Build the image
docker build -t redash-mcp .

docker run -i --rm \
  -e REDASH_API_KEY=your_api_key \
  -e REDASH_URL=https://redash.example.com \
  redash-mcp

配置(带Docker/stdio的克劳德桌面)

{
  "mcpServers": {
    "redash": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "REDASH_API_KEY", "-e", "REDASH_URL", "redash-mcp"],
      "env": {
        "REDASH_API_KEY": "your_api_key",
        "REDASH_URL": "https://redash.example.com"
      }
    }
  }
}

发展

# Install with dev dependencies
uv sync --extra dev

# Run tests
uv run pytest tests/ -v