Two guards do most of the work. Calculated fields are checked against a packaged function catalog before the XML changes — CHR(10) comes back rejected with a CHAR() suggestion — and repairs default to a dry run. Write commands need an explicit output path unless you deliberately ask to edit in place, and the cloud semantic check runs without publishing, so a malformed workbook is caught without leaving a copy on the server.
A Python toolkit and MCP server that builds .twb and .twbx workbooks by patching XML with lxml, from a packaged template or from scratch. It reads existing workbooks too: analyse them, audit their calculated fields, and repoint them at a new data source.
- Workbook lifecycle: create_workbook, open_workbook, save_workbook, with list_fields, list_worksheets, and list_dashboards to read what is there
- Charts: configure_chart, configure_dual_axis, configure_layered_chart, configure_chart_recipe, and configure_worksheet_style
- Calculated fields checked against the packaged Tableau function catalog before any XML is touched — add_calculated_field, validate_formula, audit_calculated_fields, repair_calculated_field_issues
- Structure: add_group, add_set, add_hierarchy, add_parameter, add_reference_line, configure_subtotals, enable_domain_completion
- Dashboards: add_dashboard, add_dashboard_action, add_dashboard_set_action, with layouts authored as JSON or YAML through generate_layout_json and generate_layout_yaml
- A gallery of seven packaged layouts, ranked by recommend_gallery_templates against explicit requirements and returning its scores, matching reasons, and penalties
- Connections for MySQL, Tableau Server, Excel, CSV, and Hyper
- Migration: inspect_target_schema, profile_twb_for_migration, propose_field_mapping, preview_twb_migration, apply_twb_migration
- Validation against structure, the Tableau TWB XSD for 2026.1 and 2026.2, and REST API semantics — with upload_workbook and screenshot_workbook when you want publish evidence
Python 3.10 or higher. Install with pip install cwtwb, or let the client launch it with uvx cwtwb; cwtwb mcp and python -m cwtwb.mcp_server are equivalent. Local authoring needs no credentials at all. Cloud validation and publishing need the validate extra installed and Tableau credentials, resolved in a fixed order: an explicit env_path first, then environment variables, then TABLEAU_ENV_FILE, then a .env beside the workbook, the working directory, and finally your home directory.
One command — uvx cwtwb
