cwprep-mcp

cwprep-mcp

Generating Tableau Prep data flow (.tfl) files

Category
Visit Server

README

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_to_folder("./output", flow, display, meta)
TFLPackager.pack_zip("./output", "./my_flow.tfl")

Features

Feature Method Description
Database Connection add_connection() Connect to MySQL/PostgreSQL/Oracle
SQL Input add_input_sql() Custom SQL query input
Table Input add_input_table() Direct table connection
Join add_join() left/right/inner/full joins
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

Examples

See the examples/ directory for complete demos:

  • demo_basic.py - Input, Join, Output
  • demo_cleaning.py - Filter, Calculate, Rename
  • demo_aggregation.py - Union, Aggregate, Pivot
  • demo_comprehensive.py - All features combined

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

Client Configuration

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

<details> <summary><b>Claude Desktop</b></summary>

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"]
    }
  }
}

</details>

<details> <summary><b>Cursor</b></summary>

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

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

</details>

<details> <summary><b>VS Code (Copilot)</b></summary>

Create .vscode/mcp.json in project root:

{
  "servers": {
    "cwprep": {
      "command": "uvx",
      "args": ["--from", "cwprep[mcp]", "cwprep-mcp"]
    }
  }
}

</details>

<details> <summary><b>Windsurf (Codeium)</b></summary>

Edit ~/.codeium/windsurf/mcp_config.json:

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

</details>

<details> <summary><b>Claude Code (CLI)</b></summary>

claude mcp add cwprep -- uvx --from "cwprep[mcp]" cwprep-mcp

</details>

<details> <summary><b>Gemini CLI</b></summary>

Edit ~/.gemini/settings.json:

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

</details>

<details> <summary><b>Continue (VS Code / JetBrains)</b></summary>

Edit ~/.continue/config.yaml:

mcpServers:
  - name: cwprep
    command: uvx
    args:
      - --from
      - cwprep[mcp]
      - cwprep-mcp

</details>

<details> <summary><b>Remote HTTP Mode (any client)</b></summary>

Start the server:

cwprep-mcp --transport streamable-http --port 8000

Then configure your client with the endpoint: http://your-server-ip:8000/mcp </details>

Available MCP Capabilities

Type Name Description
šŸ”§ Tool generate_tfl Generate .tfl file from flow definition
šŸ”§ Tool list_supported_operations List all supported node types
šŸ”§ Tool validate_flow_definition Validate flow definition before generating
šŸ“– Resource cwprep://docs/api-reference SDK API reference
šŸ“– Resource cwprep://docs/calculation-syntax Tableau Prep calculation syntax
šŸ’¬ Prompt design_data_flow Interactive flow design assistant
šŸ’¬ Prompt explain_tfl_structure TFL file structure explanation

AI Skill Support

This project includes a specialized AI Skill for assistants like Claude or Gemini to help you build flows.

  • Location: .agents/skills/tfl-generator/
  • Features: Procedural guidance for flow construction, API reference, and Tableau Prep calculation syntax rules.

Directory Structure

cwprep/
ā”œā”€ā”€ .agents/skills/      # AI Agent skills and technical references
ā”œā”€ā”€ src/cwprep/          # SDK source code
│   ā”œā”€ā”€ builder.py       # TFLBuilder class
│   ā”œā”€ā”€ packager.py      # TFLPackager class
│   ā”œā”€ā”€ config.py        # Configuration utilities
│   └── mcp_server.py    # MCP Server (Tools, Resources, Prompts)
ā”œā”€ā”€ examples/            # Demo scripts
ā”œā”€ā”€ docs/                # Documentation
└── tests/               # Unit tests

Configuration

Create config.yaml for default settings:

database:
  host: localhost
  username: root
  dbname: mydb
  port: "3306"
  db_class: mysql

tableau_server:
  url: http://your-server
  project_name: Default

Changelog

See changelog.md for version history.

License

MIT License

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured