Data Cleaner Agent

io.github.wesseltl由 GitHub 帳號 wesseltl 發布v0.1.3更新於 Oct 24, 2026

Clean messy CSVs: an LLM picks the steps, tested code does the work. Data untouched by the model.

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,用經過測試的 Python 函式清理雜亂的 CSV 文字,回傳清理後的 CSV 與逐步處理報告。

可以做什麼
清理 CSV 文字:執行表頭正規化、去除空白、數值轉換、日期標準化、類別標準化與去除重複,回傳清理後的 CSV 以及每一步實際操作的報告,包括無法乾淨解析的值。
適用情境
當助理拿到表頭不一致、日期格式混雜、金額帶貨幣符號或含有重複列的雜亂 CSV 資料,且希望由確定性程式碼而非在提示中逐詞重排來完成清理時適用。
執行需求
以本機程序執行;安裝帶 mcp 附加項的 PyPI 套件,並以 python -m cleaner.mcp_server 啟動。預設離線執行,無需 API 金鑰;選用的 LLM 規劃器需要 llm 附加項與 ANTHROPIC_API_KEY 環境變數。
安裝前請注意
預設規劃器離線執行,不需要憑證。若啟用 LLM 規劃器,資料概況與工具清單會透過 ANTHROPIC_API_KEY 傳送給外部 LLM 供應商。此工具回傳轉換後的資料與報告;依賴輸出前請查看報告中無法解析或對應的值。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Data Cleaner Agent,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

data-cleaner-agent

Clean a messy CSV with an agentic workflow. An LLM decides which cleaning steps the data needs, and tested Python functions do the actual work. The model plans the cleanup, it never touches your data values, so nothing gets hallucinated or silently rewritten.

Works offline out of the box (no API key). Can be driven by an LLM, and other AI agents can call it as an MCP tool.

Before / after

Full Name , Country, Signup Date, Amount Paid          full_name    country  signup_date  amount_paid Alice  ,Netherlands,2023-01-05,"€1.200,50"                Alice  Netherlands   2023-01-05       1200.5Bob,nederland,05/01/2023,"$900"              ─────▶          Bob  Netherlands   2023-01-05        900.0 Alice  ,NL,2023-01-05,"€1.200,50"                         Carol      Germany   2023-02-10       1000.0Carol , Germany ,2023-02-10,1000                             Dan      Belgium   2023-03-01        750.0Dan,belgie,2023/03/01,"€ 750,00"

In one pass it fixed the headers, trimmed whitespace, parsed three different date formats to ISO, turned €1.200,50 / $900 / € 750,00 into numbers, standardized the country names, and dropped the duplicate Alice row.

Install & run

bash
pip install agentic-csv-cleaner
clean-csv messy.csv cleaned.csv       # clean a fileclean-csv messy.csv                   # or just print the result

No API key needed. The default planner is a set of offline heuristics.

The idea

An "agentic workflow" is just software with a few parts:

   look at the data   ->   planner picks the steps   ->   run the steps   ->   report                           (rules, or an LLM)             (tested code)

The decision that makes it safe to trust:

The planner decides which tool runs on which column. The tools do the transformation. A language model is good at judgment ("this column looks like money") and bad at being a reliable calculator. So the LLM only ever picks operations from a fixed set. It never reads a value and writes back a "cleaned" one, which is where LLM data-cleaning usually goes wrong.

Two planners, one loop

PlannerWhat it isNeeds
RuleBasedPlannerOffline heuristics from a quick data profile. The default.nothing
LLMPlannerSends the profile + tool list to an LLM, gets back a JSON plan.pip install "agentic-csv-cleaner[llm]" + ANTHROPIC_API_KEY

Both return the same list of steps, so the loop is identical. You swap the brain, not the plumbing.

The log reports what each step actually did, including where a conversion could not produce a clean result (unparseable numbers/dates, unmapped categories), so a clean parse is distinguishable from a confident guess.

Use it from other code or agents

python
from cleaner.api import clean_csv_text
result = clean_csv_text(open("messy.csv").read())print(result["cleaned_csv"])print(result["steps"])

As an MCP tool (Claude Desktop)

Other AI agents can call the cleaner as a tool, so they clean a CSV properly instead of reformatting it token by token in the prompt. Three steps:

1. Install it

bash
pip install "agentic-csv-cleaner[mcp]"

2. Add it to your client's config (Claude Desktop's config lives at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, or %APPDATA%\Claude\claude_desktop_config.json on Windows):

json
{  "mcpServers": {    "csv-cleaner": { "command": "python", "args": ["-m", "cleaner.mcp_server"] }  }}

3. Restart Claude Desktop. The agent now has a clean_csv tool that takes CSV text and returns the cleaned CSV plus a report of what it did.

Use it with other MCP clients

The same server works in any MCP client, only the config differs. The command is python -m cleaner.mcp_server.

Cursor — ~/.cursor/mcp.json (global) or .cursor/mcp.json (per project), hot-reloads:

json
{ "mcpServers": { "csv-cleaner": { "command": "python", "args": ["-m", "cleaner.mcp_server"] } } }

VS Code / GitHub Copilot — .vscode/mcp.json. Note the different key (servers, not mcpServers) and the required type. Tools only run in Copilot Agent mode:

json
{ "servers": { "csv-cleaner": { "type": "stdio", "command": "python", "args": ["-m", "cleaner.mcp_server"] } } }

Windsurf — ~/.codeium/windsurf/mcp_config.json (create it if missing):

json
{ "mcpServers": { "csv-cleaner": { "command": "python", "args": ["-m", "cleaner.mcp_server"] } } }

Cline — add it from the extension's MCP settings panel in VS Code.

Understanding the report

The tool doesn't just hand back tidy data, it tells you what each step actually did, including where it couldn't get a clean result, so you can tell a clean parse from a confident guess:

- coerce_numeric(amount): all 4 value(s) parsed cleanly- standardize_dates(signup): 1/3 value(s) could not be parsed, set to null- standardize_categorical(country): 1 value(s) not in the mapping, left unchanged: ['MARS']

So instead of silently dropping a value or leaving a wrong category, it surfaces it, and you know exactly which cells to double-check.

What's in the box

cleaner/tools.py holds the transformations: snake_case_headers, strip_whitespace, coerce_numeric, standardize_dates, standardize_categorical, drop_duplicate_rows.

Take standardize_dates. 2023-01-05 (year first, month in the middle) and 05/01/2023 (day first) need opposite parsing rules, and one global setting corrupts one or the other, so the tool decides per value. Mixed dates are genuinely ambiguous, and this handles them explicitly instead of guessing.

Tests

bash
python -m unittest discover -s tests

License

MIT.

來源:README.md,提交 0623109

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.3最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分