Overview
What is Cwtwb?
Cwtwb is a Model Context Protocol (MCP) server and Python toolkit for programmatically generating Tableau Desktop workbook files (.twb / .twbx) from code or AI-driven tool calls. It is designed as a workbook engineering layer to make workbook generation reproducible, inspectable, and safe to automate in local workflows, scripts, and CI.
How to use Cwtwb?
Install via pip install cwtwb. As an MCP server, configure your client to launch with uvx cwtwb. As a Python library, use TWBEditor to open templates, add fields, build worksheets, assemble dashboards, and save .twb or .twbx files. Cwtwb also supports a guided datasource-first authoring run with confirmation gates.
Key features of Cwtwb
- MCP tools for guided authoring runs and workbook creation
- Python library with
TWBEditorfor scripted workbook engineering - Supports
.twband.twbxfiles transparently - Worksheet clone and refactor with identity normalization
- Built-in chart primitives (bar, pie, map, text, etc.) and dashboard composition
- XML-based engine using lxml for patching and validation
Use cases of Cwtwb
- Automate Tableau workbook generation in CI/CD pipelines
- Create reproducible dashboards from code or AI assistant interactions
- Clone and refactor existing worksheets to produce KPI variants
- Build structured authoring contracts from datasource schema exploration
- Package plain
.twbfiles into.twbxarchives for distribution
FAQ from Cwtwb
What are the runtime dependencies?
Python >= 3.10, lxml >= 5.0, uv, and mcp >= 1.0.
Can I work with packaged .twbx files?
Yes. Cwtwb reads and writes .twbx files (ZIP archives containing workbook XML, extracts, and images). You can open existing .twbx files, modify them, and save back as .twb or .twbx.
What is the difference between the MCP server and the Python library?
The MCP server exposes tools (e.g., create_workbook, add_parameter, generate_workbook_from_run) for AI clients like Claude Desktop or Cursor. The Python library provides TWBEditor for direct script-based use without an MCP client.
Does cwtwb require Tableau Desktop to be installed?
No. Cwtwb generates valid .twb / .twbx files that open in Tableau Desktop, but it does not require Tableau to be installed on the same machine.
How do I start a guided authoring run?
Use the start_authoring_run MCP tool, which creates a manifest under tmp/agentic_run/{run_id}/ and guides you through schema intake, analysis brief, contract drafting, wireframe review, and final workbook generation.