cwprep-mcp
cwprep - Text-to-PrepFlow エンジン
cwprep は、Text-to-PrepFlow 生成を可能にする Python ベースのエンジンです。
.tfl JSON 構造をリバースエンジニアリングし、組み込みの MCP (Model Context Protocol) サーバーを提供することで、cwprep は LLM (Claude、Gemini など) と Tableau Prep の間の架け橋として機能します。GUI を開くことなく、自然言語での会話や Python スクリプトを通じて、データクリーニングフローの生成、変更、構築が可能になりました!
作成者: Cooper Wenhua imgwho@gmail.com
インストール
pip install cwprepRelated MCP server: cwtwb
クイックスタート
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)デフォルトでは、SDK と MCP の両方が最終的な .tfl/.tflx アーカイブのみを出力します。検証のために展開されたフォルダーが必要な場合にのみ save_to_folder() を使用してください。
機能
機能 | メソッド | 説明 |
データベース接続 |
| MySQL/PostgreSQL/SQL Server に接続 |
ファイル接続 |
| Excel (.xlsx/.xls) または CSV ファイルに接続 |
SQL 入力 |
| カスタム SQL クエリ入力 |
テーブル入力 |
| 直接テーブル接続 |
Excel 入力 |
| Excel ワークシートから読み込み |
CSV 入力 |
| CSV ファイルから読み込み |
CSV ユニオン |
| 複数の CSV ファイルを結合 |
結合 (Join) |
| 左/右/内部/完全結合 (単一または複数列) |
ユニオン (Union) |
| 複数のテーブルを結合 |
フィルター |
| 式ベースのフィルター |
値フィルター |
| 値による保持/除外 |
列の保持 |
| 列を選択 |
列の削除 |
| 列を削除 |
名前変更 |
| 列名を変更 |
計算 |
| Tableau 計算フィールド |
クイック計算 |
| クイッククリーン (小文字/大文字/トリム/削除) |
型変更 |
| 列のデータ型を変更 |
列の複製 |
| 列を複製 (コピー) |
集計 |
| SUM/AVG/COUNT を使用した GROUP BY |
ピボット |
| 行を列に変換 |
アンピボット |
| 列を行に変換 |
出力 |
| Tableau Server にパブリッシュ |
TFLX パッケージ化 |
| データファイルを埋め込んだ .tflx を生成 |
SQL 変換 |
| TFL フローを同等の ANSI SQL に変換 |
例
完全なデモについては examples/ ディレクトリを参照してください:
demo_basic.py- 入力、結合、出力demo_cleaning.py- フィルター、計算、名前変更demo_field_operations.py- クイック計算、型変更、列の複製demo_aggregation.py- ユニオン、集計、ピボットdemo_comprehensive.py- すべての機能を組み合わせた例prompts.md- AI 主導のフロー生成のためのすぐに使える 8 つの MCP プロンプトテンプレート
MCP サーバー
cwprep には組み込みの Model Context Protocol サーバーが含まれており、AI クライアント (Claude Desktop、Cursor、Gemini CLI など) が TFL ファイルを直接生成できるようになります。
前提条件
メソッド | 要件 |
| uv をインストール — 分離された環境で |
| Python ≥ 3.8 + |
クイックスタート
# Local (stdio)
cwprep-mcp
# Remote (Streamable HTTP)
cwprep-mcp --transport streamable-http --port 8000[!TIP] アップグレードする場合: 以前のバージョンの
uvxを使用していた場合は、キャッシュをクリアして最新リリースを取得してください:uv cache clean cwprep
クライアント設定
以下のすべてのクライアントは uvx メソッド (推奨) を使用します。ローカルの pip install を好む場合は uvx を cwprep-mcp に置き換えてください。
設定ファイルを編集:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"cwprep": {
"command": "uvx",
"args": ["--from", "cwprep", "cwprep-mcp"]
}
}
}設定 → MCP → 新しい MCP サーバーを追加、または ~/.cursor/mcp.json を編集:
{
"mcpServers": {
"cwprep": {
"command": "uvx",
"args": ["--from", "cwprep", "cwprep-mcp"]
}
}
}プロジェクトルートに .vscode/mcp.json を作成:
{
"servers": {
"cwprep": {
"command": "uvx",
"args": ["--from", "cwprep", "cwprep-mcp"]
}
}
}~/.codeium/windsurf/mcp_config.json を編集:
{
"mcpServers": {
"cwprep": {
"command": "uvx",
"args": ["--from", "cwprep", "cwprep-mcp"]
}
}
}claude mcp add cwprep -- uvx --from "cwprep" cwprep-mcp~/.gemini/settings.json を編集:
{
"mcpServers": {
"cwprep": {
"command": "uvx",
"args": ["--from", "cwprep", "cwprep-mcp"]
}
}
}~/.continue/config.yaml を編集:
mcpServers:
- name: cwprep
command: uvx
args:
- --from
- cwprep
- cwprep-mcpサーバーを起動:
cwprep-mcp --transport streamable-http --port 8000次に、クライアントをエンドポイント http://your-server-ip:8000/mcp で設定します。
利用可能な MCP 機能
タイプ | 名前 | 説明 |
🔧 ツール |
| フロー定義から .tfl/.tflx ファイルを生成 |
🔧 ツール |
| フロー定義または .tfl ファイルを ANSI SQL に変換 |
🔧 ツール |
| サポートされているすべてのノードタイプを一覧表示 |
🔧 ツール |
| 生成前にフロー定義を検証 |
📖 リソース |
| SDK API リファレンス |
📖 リソース |
| Tableau Prep 計算構文 |
📖 リソース |
| 一般的な落とし穴とフロー設計ルール |
💬 プロンプト |
| インタラクティブなフロー設計アシスタント |
💬 プロンプト |
| TFL ファイル構造の説明 |
AI スキルサポート
このプロジェクトには、Claude や Gemini などのアシスタントがフローを構築するのを支援するための専門的な AI スキルが含まれています。
場所:
.agents/skills/tfl-generator/機能: フォールバック SDK 使用ガイド付きの MCP サーバーインデックス。詳細な API および構文リファレンスは、
src/cwprep/references/から MCP リソース経由で提供されます。
ディレクトリ構造
cwprep/
├── .agents/skills/ # AI Agent skills (MCP index)
├── src/cwprep/ # SDK source code
│ ├── builder.py # TFLBuilder class
│ ├── packager.py # TFLPackager class
│ ├── translator.py # SQLTranslator class
│ ├── expression_translator.py # ExpressionTranslator class
│ ├── config.py # Configuration utilities
│ ├── mcp_server.py # MCP Server (Tools, Resources, Prompts)
│ └── references/ # MCP Resource documents (.md)
├── examples/ # Demo scripts
├── docs/ # Documentation
└── tests/ # Unit tests設定
デフォルト設定用に config.yaml を作成します:
# MySQL (default)
database:
host: localhost
port: 3306
dbname: mydb
type: mysql
# SQL Server (Windows Authentication)
# database:
# host: localhost
# type: sqlserver
# authentication: sspi
# schema: dbo
# PostgreSQL
# database:
# host: localhost
# port: 5432
# dbname: mydb
# type: postgres
tableau_server:
url: http://your-server
default_project: Default変更履歴
バージョン履歴については changelog.md を参照してください。
ライセンス
AGPL-3.0 ライセンス
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Postgres + Kafka Stack Generator
Debug, build, and manage Power Automate cloud flows with AI agents
Postgres + Kafka + Prometheus Stack Generator
Postgres + Grafana Stack Generator
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables discovery, querying, and exporting of Tableau Cloud dashboards and data sources. Supports searching workbooks, filtering data, and exporting views as PDF, PNG, PowerPoint, CSV, or JSON.-
- AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to programmatically read, modify, and query Tableau workbook files (.twb and .twbx) on the local filesystem via 80 tools.7MIT
- AlicenseNot gradedqualityCmaintenanceA local MCP server that allows LLMs to inspect and safely edit Tableau Desktop workbooks (.twb) via XML, including creating native calculated fields using Tableau formula syntax.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/aidatacooper/cwprep'
If you have feedback or need assistance with the MCP directory API, please join our Discord server