Tableau Workbook MCP Server
by quinnschris
README.md
# Tableau Workbook MCP Server
An MCP (Model Context Protocol) server that downloads Tableau workbooks via the REST API and extracts their XML content for interpretation by Claude.
## Overview
This MCP server enables Claude to analyze Tableau workbooks by:
- Downloading workbooks from Tableau Server or Tableau Cloud using REST API
- Extracting XML structure from both .twb and .twbx formats
- Parsing connection, dashboard, and worksheet information
- Presenting workbook structure in an LLM-optimized format
## Features
- **Seamless Integration**: Works alongside the existing Tableau MCP server
- **Secure Authentication**: Uses Personal Access Tokens (PAT) for authentication
- **Flexible Parsing**: Optional parsing of connections and dashboards
- **Performance Optimized**: Excludes extracts by default for faster downloads
- **Error Resilience**: Comprehensive error handling with actionable suggestions
- **Context-Aware**: Automatic XML truncation to respect LLM context windows
## Prerequisites
Before using this MCP server, ensure you have:
1. **Node.js**: Version 18.0.0 or higher
2. **Tableau Access**: Access to Tableau Server or Tableau Cloud
3. **Personal Access Token**: Create a PAT with appropriate permissions
4. **Existing Tableau MCP**: The official Tableau MCP server for finding workbook IDs
## Installation
### 1. Install Dependencies
Navigate to the project directory and install Node.js dependencies:
```bash
cd /Users/qchriste/Library/CloudStorage/OneDrive-CHGHealthcare/Documents/Development/tableau-workbook-mcp
npm install
```
### 2. Build the Project
Compile TypeScript to JavaScript:
```bash
npm run build
```
This creates the compiled files in the `dist/` directory.
### 3. Verify Installation
Check that the server can start:
```bash
node dist/index.js --help
```
## Configuration
### Environment Variables
This MCP server requires separate configuration from the existing Tableau MCP. Add the following environment variables to your MCP client configuration:
- **TWB_SERVER**: Your Tableau Server URL (e.g., `https://tableau.example.com`)
- **TWB_SITE_NAME**: Your Tableau site name (use empty string `""` for default site)
- **TWB_PAT_NAME**: Your Personal Access Token name
- **TWB_PAT_TOKEN**: Your Personal Access Token secret
### Claude Desktop Configuration
Add this server to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"tableau": {
"command": "npx",
"args": ["-y", "@tableau/mcp-server@latest"],
"env": {
"SERVER": "https://my-tableau-server.com",
"SITE_NAME": "my_site",
"PAT_NAME": "my_pat",
"PAT_VALUE": "pat_value"
}
},
"tableau-workbook": {
"command": "node",
"args": [
"/Users/qchriste/Library/CloudStorage/OneDrive-CHGHealthcare/Documents/Development/tableau-workbook-mcp/dist/index.js"
],
"env": {
"TWB_SERVER": "https://my-tableau-server.com",
"TWB_SITE_NAME": "my_site",
"TWB_PAT_NAME": "my_pat_for_downloads",
"TWB_PAT_TOKEN": "my_pat_secret_for_downloads"
}
}
}
}
```
### Creating a Personal Access Token
1. Sign in to your Tableau Server or Tableau Cloud
2. Navigate to **My Account Settings**
3. Click **Personal Access Tokens** tab
4. Click **Create new token**
5. Enter a token name and click **Create**
6. Copy the **Token Name** and **Token Secret** immediately (secret is only shown once)
### Required Permissions
The Personal Access Token must be associated with a user account that has:
- **Read (view)** permission for workbooks you want to download
- **ExportXml** permission for those workbooks
- Access to the specific Tableau site
## Usage
### Typical Workflow
1. **Find the workbook** using the existing Tableau MCP:
```
Use tableau:list-workbooks to find workbooks named "Sales Dashboard"
```
2. **Download and analyze** using this MCP:
```
Use download_tableau_workbook with the workbook ID from step 1
```
### Tool: download_tableau_workbook
Downloads a Tableau workbook and extracts its XML structure.
#### Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `workbook_id` | string | Yes | - | The LUID of the workbook to download |
| `include_extract` | boolean | No | false | Whether to include data extracts |
| `parse_connections` | boolean | No | true | Parse connection information |
| `parse_dashboards` | boolean | No | true | Parse dashboard structure |
#### Example: Basic Download
```typescript
{
"workbook_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
}
```
#### Example: Download with Extract
```typescript
{
"workbook_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"include_extract": true
}
```
#### Example: Download Without Parsing
```typescript
{
"workbook_id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
"parse_connections": false,
"parse_dashboards": false
}
```
### Response Structure
The tool returns a JSON object with:
```typescript
{
"workbookId": "string", // The workbook ID
"workbookName": "string", // Filename of the workbook
"fileType": "twb" | "twbx", // File format
"xmlContent": "string", // Complete XML content
"structure": { // Parsed structure (if enabled)
"workbookName": "string",
"connections": [...], // Connection details
"dashboards": [...], // Dashboard structure
"worksheets": [...], // Worksheet names
"dataSourceCount": number,
"hasParameters": boolean
},
"message": "string" // Status message
}
```
## Error Handling
The server provides detailed, actionable error messages:
### Authentication Errors (401)
```
Error: Authentication failed (401 Unauthorized)
Suggestion: Verify that your TWB_PAT_NAME and TWB_PAT_TOKEN environment variables are correct...
```
### Permission Errors (403)
```
Error: Access forbidden (403 Forbidden)
Suggestion: Verify that your Tableau user account has ExportXml permission...
```
### Not Found Errors (404)
```
Error: Workbook not found (404 Not Found)
Suggestion: Verify that the workbook ID is correct. Use tableau:list-workbooks to find the correct ID...
```
### Rate Limit Errors (429)
```
Error: Rate limit exceeded (429 Too Many Requests)
Suggestion: Wait a few minutes before retrying the request.
```
## Development
### Project Structure
```
tableau-workbook-mcp/
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript compiler configuration
├── README.md # This file
├── src/
│ ├── index.ts # Main server entry point
│ ├── types.ts # TypeScript type definitions
│ ├── constants.ts # Shared constants
│ ├── schemas.ts # Zod validation schemas
│ ├── services/
│ │ └── tableauApi.ts # Tableau REST API client
│ └── utils/
│ └── xmlExtractor.ts # XML extraction and parsing utilities
└── dist/ # Compiled JavaScript (created by build)
```
### Build Commands
- **Build**: `npm run build` - Compile TypeScript to JavaScript
- **Watch**: `npm run watch` - Auto-compile on file changes
- **Start**: `npm start` - Run the compiled server
- **Dev**: `npm run dev` - Watch mode with auto-restart
### Testing
To test the server manually:
1. **Verify compilation**:
```bash
npm run build
```
2. **Check environment variables** are set in your MCP client configuration
3. **Test with Claude Desktop** or another MCP client by calling the tool
## Performance Considerations
- **Extract Size**: Set `include_extract: false` (default) for faster downloads of workbooks with large extracts
- **XML Truncation**: XML content is automatically truncated at 25,000 characters to fit within Claude's context window
- **Parsing Overhead**: Disable `parse_connections` and `parse_dashboards` if you only need raw XML
- **Download Timeout**: Requests timeout after 5 minutes for very large workbooks
## Troubleshooting
### Server Won't Start
**Problem**: Error about missing environment variables
**Solution**: Ensure TWB_SERVER, TWB_SITE_NAME, TWB_PAT_NAME, and TWB_PAT_TOKEN are configured in your MCP client
---
**Problem**: TypeScript compilation errors
**Solution**: Run `npm install` to ensure all dependencies are installed, then `npm run build`
### Authentication Issues
**Problem**: 401 Unauthorized error
**Solution**:
1. Verify your PAT credentials are correct
2. Check that the token hasn't expired
3. Ensure the PAT is for the correct Tableau site
### Download Failures
**Problem**: 403 Forbidden error
**Solution**: Contact your Tableau administrator to grant ExportXml permission
---
**Problem**: 404 Not Found error
**Solution**: Use the existing Tableau MCP's `tableau:list-workbooks` tool to find the correct workbook ID
### Large Workbooks
**Problem**: Timeout errors or very slow downloads
**Solution**:
1. Set `include_extract: false` to skip data extracts
2. Increase `REQUEST_TIMEOUT` in `src/constants.ts` if needed
## Security Notes
- Personal Access Tokens are stored in environment variables (not in code)
- Tokens are transmitted over HTTPS to Tableau Server
- Authentication tokens are invalidated after each request
- No credentials are logged or written to disk
## Integration with Existing Tableau MCP
This server is designed to complement the official Tableau MCP server:
| Use Official Tableau MCP For | Use This MCP Server For |
|------------------------------|-------------------------|
| Listing workbooks | Downloading workbook XML |
| Searching content | Analyzing workbook structure |
| Querying data sources | Examining calculations |
| Getting view images | Understanding connections |
| Managing Pulse metrics | Documenting workbook metadata |
## Limitations
- Maximum download size: 64MB (Tableau REST API limit)
- XML truncation: Content limited to 25,000 characters for Claude
- Single workbook: Downloads one workbook at a time
- Read-only: Cannot modify or upload workbooks
## License
MIT
## Support
For issues related to:
- **This MCP server**: File an issue in this repository
- **Tableau REST API**: Consult [Tableau REST API documentation](https://help.tableau.com/current/api/rest_api/en-us/)
- **MCP Protocol**: Visit [Model Context Protocol documentation](https://modelcontextprotocol.io/)
## Version History
### 1.0.0 (Initial Release)
- Download Tableau workbooks via REST API
- Extract XML from .twb and .twbx formats
- Parse connections and dashboard structure
- Automatic XML truncation for context windows
- Comprehensive error handling with actionable messages
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues