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 파일 병합 |
조인 |
| 왼쪽/오른쪽/내부/전체 조인 (단일 또는 다중 열) |
유니온 |
| 여러 테이블 병합 |
필터 |
| 표현식 기반 필터 |
값 필터 |
| 값에 따라 유지/제외 |
열 유지 |
| 열 선택 |
열 제거 |
| 열 삭제 |
이름 변경 |
| 열 이름 변경 |
계산 |
| 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 라이선스
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate Tableau .twb/.twbx workbooks: 47 tools for charts, dashboards, rules, CSV pipelines.
Automate production-ready PDF, Word, Excel and PowerPoint documents from templates and JSON data
Postgres + Kafka Stack Generator
Debug, build, and manage Power Automate cloud flows with AI agents
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.9MIT
- 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