Skip to main content
Glama
IMPLEMENTATION_PLAN.md10.8 kB
# Tableau MCP Server Implementation Plan ## Overview Build a Node.js/TypeScript remote MCP server deployed to Cloud Run that connects to both Tableau Cloud and Tableau Server environments, providing comprehensive Tableau operations through the Model Context Protocol. ## Project Structure Create in: `C:\Users\MomentumMedia\.cursor\agile\projects\tableau-mcp-project` ``` tableau-mcp-project/ ├── src/ │ ├── server.ts # Main MCP server with SSE transport │ ├── tableau-client.ts # Tableau REST API client wrapper │ ├── tools/ # Individual MCP tool implementations │ │ ├── list-workbooks.ts │ │ ├── list-views.ts │ │ ├── query-view.ts │ │ ├── refresh-extract.ts │ │ ├── search-content.ts │ │ ├── get-metadata.ts │ │ ├── get-dashboard-filters.ts │ │ ├── export-dashboard-pdf.ts │ │ └── export-dashboard-pptx.ts │ └── types.ts # TypeScript type definitions ├── package.json ├── tsconfig.json ├── Dockerfile # For Cloud Run deployment ├── .env.example # Environment variable template └── README.md ``` ## Implementation Steps ### 1. Project Initialization - Create project directory structure - Initialize Node.js project with TypeScript - Install dependencies: - `@modelcontextprotocol/sdk` - MCP server SDK - `express` or `fastify` - HTTP server for SSE - `axios` - HTTP client for Tableau REST API - `zod` - Schema validation for tool parameters - Core TypeScript and build tools ### 2. Tableau API Client (`tableau-client.ts`) Implement wrapper for Tableau REST API with: - **Authentication**: Personal Access Token (PAT) support - **Connection modes**: Auto-detect Cloud vs Server from URL - **API methods** for all required operations: - Sign in / authentication - Workbook/view listing and querying - Data querying (CSV/JSON export) - Extract refresh triggers - Content search - Metadata retrieval - Dashboard filter access - PDF/PowerPoint export ### 3. MCP Server Setup (`server.ts`) - Implement SSE (Server-Sent Events) transport for remote access - Add authentication middleware (X-API-Key header validation) - Register all tool handlers - Add health check endpoint - Configure CORS for Cursor access - Error handling and logging ### 4. MCP Tools Implementation **Core Tools:** - `tableau_list_workbooks` - List all workbooks with metadata - `tableau_list_views` - List views in a workbook - `tableau_query_view` - Export view data as CSV/JSON - `tableau_refresh_extract` - Trigger data source refresh - `tableau_search_content` - Search workbooks/views/data sources - `tableau_get_metadata` - Get detailed workbook/view metadata **Advanced Tools:** - `tableau_get_dashboard_filters` - Get filter configuration and current values - `tableau_export_dashboard_pdf` - Export dashboard as PDF with filter options - `tableau_export_dashboard_pptx` - Export dashboard as PowerPoint Each tool includes: - Zod schema for parameter validation - Clear descriptions for AI understanding - Error handling with helpful messages - Response formatting for LLM consumption ### 5. Configuration & Environment Environment variables: ``` TABLEAU_SERVER_URL=https://your-server.tableau.com TABLEAU_SITE_ID=your-site TABLEAU_TOKEN_NAME=your-token-name TABLEAU_TOKEN_VALUE=your-token-value MCP_API_KEY=secure-random-key PORT=8080 ``` ### 6. Cloud Run Deployment - Create Dockerfile with Node.js runtime - Configure for Cloud Run (PORT binding, health checks) - Deploy to `australia-southeast1` region (consistent with other MCPs) - Set up environment variables in Cloud Run - Configure authentication with X-API-Key header ### 7. Cursor Integration Create MCP config file in `shared-tools/mcp/tableau.json`: ```json { "name": "Tableau MCP Server", "description": "MCP server for Tableau Cloud and Server operations", "config": { "command": "npx", "args": [ "-y", "mcp-remote", "https://tableau-mcp-[PROJECT-ID].[REGION].run.app/sse", "--header", "X-API-Key: [API-KEY]" ] } } ``` ### 8. Testing & Documentation - Test each tool independently - Verify both Tableau Cloud and Server connectivity - Document all tool parameters and responses - Create usage examples in README ## Key Technical Decisions 1. **SSE Transport**: Enables remote access consistent with Thesus/Forsta setup 2. **Tableau REST API v3.x**: Most comprehensive API version 3. **Stateless design**: Each request authenticates independently 4. **Export handling**: Stream large files (PDF/PPTX) with proper content-type headers 5. **Filter support**: Use Tableau's view filtering API for dashboard filter manipulation ## Dependencies on Existing Files Reference existing MCP patterns: - `shared-tools/mcp/thesus-mcp.json` - Remote server configuration pattern - `shared-tools/bqsetup/02_MCP_Servers_Troubleshooting.md` - Testing and troubleshooting approach ## Implementation Checklist - [ ] Project initialization and TypeScript setup - [ ] Install MCP SDK and dependencies - [ ] Build Tableau REST API client - [ ] Implement MCP server with SSE transport - [ ] Implement core tools (list, query, refresh, search, metadata) - [ ] Implement advanced tools (filters, PDF/PPTX export) - [ ] Create Dockerfile and Cloud Run config - [ ] Create Cursor MCP config file - [ ] Test all tools and document usage ## Tool Specifications ### Core Tools Detail #### `tableau_list_workbooks` **Purpose**: List all workbooks accessible to the authenticated user **Parameters**: - `projectName` (optional): Filter by project - `tags` (optional): Filter by tags **Returns**: Array of workbooks with id, name, contentUrl, projectName, createdAt, updatedAt #### `tableau_list_views` **Purpose**: List all views/dashboards in a workbook **Parameters**: - `workbookId` (required): Workbook identifier **Returns**: Array of views with id, name, contentUrl, workbookId, viewUrlName #### `tableau_query_view` **Purpose**: Export view data as CSV or JSON **Parameters**: - `viewId` (required): View identifier - `format` (optional): 'csv' or 'json' (default: 'csv') - `maxRows` (optional): Limit number of rows **Returns**: Data in requested format #### `tableau_refresh_extract` **Purpose**: Trigger a data source extract refresh **Parameters**: - `datasourceId` (required): Data source identifier - `refreshType` (optional): 'full' or 'incremental' **Returns**: Job id and status #### `tableau_search_content` **Purpose**: Search across all Tableau content **Parameters**: - `searchTerm` (required): Search query - `contentType` (optional): 'workbook', 'view', 'datasource', 'project' **Returns**: Array of matching content items #### `tableau_get_metadata` **Purpose**: Get detailed metadata for workbook or view **Parameters**: - `contentId` (required): Workbook or view identifier - `contentType` (required): 'workbook' or 'view' **Returns**: Comprehensive metadata including fields, data sources, permissions ### Advanced Tools Detail #### `tableau_get_dashboard_filters` **Purpose**: Get all filter configurations on a dashboard **Parameters**: - `viewId` (required): View/dashboard identifier **Returns**: Array of filters with name, field, type, values, isVisible #### `tableau_export_dashboard_pdf` **Purpose**: Export dashboard as PDF **Parameters**: - `viewId` (required): View/dashboard identifier - `filters` (optional): Object with filter values to apply - `pageType` (optional): Paper size (A4, Letter, etc.) - `orientation` (optional): 'portrait' or 'landscape' **Returns**: PDF file as base64 or URL #### `tableau_export_dashboard_pptx` **Purpose**: Export dashboard as PowerPoint **Parameters**: - `viewId` (required): View/dashboard identifier - `filters` (optional): Object with filter values to apply **Returns**: PPTX file as base64 or URL ## API Endpoints Reference Tableau REST API endpoints to implement: ### Authentication - POST `/api/{version}/auth/signin` - Sign in with PAT ### Workbooks & Views - GET `/api/{version}/sites/{site-id}/workbooks` - List workbooks - GET `/api/{version}/sites/{site-id}/workbooks/{workbook-id}/views` - List views - GET `/api/{version}/sites/{site-id}/views/{view-id}/data` - Query view data ### Data Sources - POST `/api/{version}/sites/{site-id}/datasources/{datasource-id}/refresh` - Refresh extract ### Search - GET `/api/{version}/sites/{site-id}/search` - Search content ### Metadata - GET `/api/{version}/sites/{site-id}/workbooks/{workbook-id}` - Workbook metadata - GET `/api/{version}/sites/{site-id}/views/{view-id}` - View metadata ### Filters - GET `/api/{version}/sites/{site-id}/views/{view-id}/filters` - Get filters ### Export - GET `/api/{version}/sites/{site-id}/views/{view-id}/pdf` - Export PDF - GET `/api/{version}/sites/{site-id}/views/{view-id}/powerpoint` - Export PowerPoint ## Security Considerations 1. **API Key Management**: Use strong random keys, rotate regularly 2. **Tableau Credentials**: Store as environment variables, never commit 3. **CORS Configuration**: Restrict to Cursor domains 4. **Rate Limiting**: Implement to prevent abuse 5. **Input Validation**: Use Zod schemas for all parameters 6. **Error Messages**: Don't expose sensitive information in errors 7. **Logging**: Log all requests but sanitize sensitive data ## Deployment Steps 1. Build Docker image: ```bash docker build -t tableau-mcp . ``` 2. Test locally: ```bash docker run -p 8080:8080 --env-file .env tableau-mcp ``` 3. Deploy to Cloud Run: ```bash gcloud run deploy tableau-mcp \ --image gcr.io/[PROJECT-ID]/tableau-mcp \ --platform managed \ --region australia-southeast1 \ --allow-unauthenticated \ --set-env-vars TABLEAU_SERVER_URL=[URL],TABLEAU_SITE_ID=[SITE],MCP_API_KEY=[KEY] ``` 4. Configure secrets (recommended): ```bash gcloud run services update tableau-mcp \ --update-secrets TABLEAU_TOKEN_VALUE=[SECRET_NAME]:latest ``` ## Testing Strategy 1. **Unit Tests**: Test each Tableau API method independently 2. **Integration Tests**: Test full MCP tool workflows 3. **Manual Testing**: Test with Cursor in agent mode 4. **Cloud vs Server**: Verify both connection types work 5. **Error Scenarios**: Test authentication failures, API errors, timeouts 6. **Performance**: Test with large datasets and exports ## Future Enhancements - Support for Tableau Prep flows - Webhook notifications for extract refresh completion - Batch operations for multiple workbooks - Embedded analytics token generation - Custom query support (Custom SQL) - Subscription management - User and permissions management - Metrics and usage tracking integration

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/russelenriquez-agile/tableau-mcp-project'

If you have feedback or need assistance with the MCP directory API, please join our Discord server