cwprep MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add cwprep -- uvx --from "cwprep[mcp]" cwprep-mcp
README.md

Generating Tableau Prep data flow (.tfl) files

cwprep - Text-to-PrepFlow Engine

cwprep is a Python-based engine that enables Text-to-PrepFlow generation.

By reverse-engineering the .tfl JSON structure and providing a built-in MCP (Model Context Protocol) server, cwprep acts as a bridge between LLMs (like Claude, Gemini) and Tableau Prep. You can now generate, modify, and build data cleaning flows simply through natural language conversations or Python scripts, without ever opening the GUI!

Installation

pip install cwprep

Quick Start

from cwprep import TFLBuilder, TFLPackager

# Create builder
builder = TFLBuilder(flow_name="My Flow")

# Add database connection
conn_id = builder.add_connection(
    host="localhost",
    username="root",
    dbname="mydb"
)

# Add input tables
orders = builder.add_input_table("orders", "orders", conn_id)
customers = builder.add_input_table("customers", "customers", conn_id)

# Join tables
joined = builder.add_join(
    name="Orders + Customers",
    left_id=orders,
    right_id=customers,
    left_col="customer_id",
    right_col="customer_id",
    join_type="left"
)

# Add output
builder.add_output_server("Output", joined, "My_Datasource")

# Build and save
flow, display, meta = builder.build()
TFLPackager.save_tfl("./my_flow.tfl", flow, display, meta)

By default, both the SDK and MCP output only the final .tfl/.tflx archive. Use save_to_folder() only when you explicitly want the exploded folder for inspection.

Features

Feature Method Description
Database Connection add_connection() Connect to MySQL/PostgreSQL/SQL Server
File Connection add_file_connection() Connect to Excel (.xlsx/.xls) or CSV files
SQL Input add_input_sql() Custom SQL query input
Table Input add_input_table() Direct table connection
Excel Input add_input_excel() Read from Excel worksheet
CSV Input add_input_csv() Read from CSV file
CSV Union add_input_csv_union() Merge multiple CSV files
Join add_join() left/right/inner/full joins (single or multi-column)
Union add_union() Merge multiple tables
Filter add_filter() Expression-based filter
Value Filter add_value_filter() Keep/exclude by values
Keep Only add_keep_only() Select columns
Remove Columns add_remove_columns() Drop columns
Rename add_rename() Rename columns
Calculation add_calculation() Tableau formula fields
Quick Calc add_quick_calc() Quick clean (lowercase/uppercase/trim/remove)
Change Type add_change_type() Change column data types
Duplicate Column add_duplicate_column() Duplicate (copy) a column
Aggregate add_aggregate() GROUP BY with SUM/AVG/COUNT
Pivot add_pivot() Rows to columns
Unpivot add_unpivot() Columns to rows
Output add_output_server() Publish to Tableau Server
TFLX Packaging build(is_packaged=True) Generate .tflx with embedded data files
SQL Translation SQLTranslator Translate TFL flows to equivalent ANSI SQL

Examples

See the examples/ directory for complete demos:

  • demo_basic.py - Input, Join, Output
  • demo_cleaning.py - Filter, Calculate, Rename
  • demo_field_operations.py - Quick Calc, Change Type, Duplicate Column
  • demo_aggregation.py - Union, Aggregate, Pivot
  • demo_comprehensive.py - All features combined
  • prompts.md - 8 ready-to-use MCP prompt templates for AI-driven flow generation

MCP Server

cwprep includes a built-in Model Context Protocol server, enabling AI clients (Claude Desktop, Cursor, Gemini CLI, etc.) to generate TFL files directly.

Prerequisites

Method Requirement
uvx (recommended) Install uv — it auto-downloads cwprep[mcp] in an isolated env
pip install Python ≥ 3.8 + pip install cwprep[mcp]

Quick Start

# Local (stdio)
cwprep-mcp

# Remote (Streamable HTTP)
cwprep-mcp --transport streamable-http --port 8000

[!TIP] Upgrading? If you previously used uvx with an older version, clear the cache to pick up the latest release:

uv cache clean cwprep

Client Configuration

All clients below use the uvx method (recommended). Replace uvx with cwprep-mcp if you prefer a local pip install.

Claude Desktop

Edit config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "cwprep": {
      "command": "uvx",
      "args": ["--from", "cwprep[mcp]", "cwprep-mcp"]
    }
  }
}
Cursor

Settings → MCP → Add new MCP server, or edit ~/.cursor/mcp.json:

{
  "mcpServers": {
    "cwpre

Configuration

claude_desktop_config.json
{"mcpServers": {"cwprep": {"command": "uvx", "args": ["--from", "cwprep[mcp]", "cwprep-mcp"]}}}

Try it

Create a Tableau Prep flow that joins an 'orders' table and a 'customers' table on the 'customer_id' column using a left join.
Generate a TFL file that filters the 'sales' dataset to only include records where the 'region' is 'West' and then renames the 'cust_name' column to 'Customer Name'.
Build a data cleaning flow that reads from an Excel file, performs a quick clean to trim whitespace, and outputs the result to a Tableau Server data source.
Create a flow that aggregates sales data by 'category' and 'year', calculating the sum of 'revenue' and the average of 'quantity'.

Frequently Asked Questions

What are the key features of cwprep?

Text-to-PrepFlow generation via natural language. Support for database connections including MySQL, PostgreSQL, and SQL Server. Comprehensive data transformation tools including joins, unions, filters, and aggregations. Tableau formula field support via calculation tools. Direct generation of .tfl and .tflx archive files.

What can I use cwprep for?

Automating the creation of repetitive data cleaning flows without using the Tableau Prep GUI. Integrating Tableau Prep flow generation into AI-driven data engineering pipelines. Rapidly prototyping data transformation logic using natural language prompts. Standardizing data preparation steps across multiple Tableau projects via code-based flow generation.

How do I install cwprep?

Install cwprep by running: uvx --from cwprep[mcp] cwprep-mcp

What MCP clients work with cwprep?

cwprep works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep cwprep docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare