Skip to main content
Glama

csvfix-mcp

English | 中文

An MCP (Model Context Protocol) server that profiles and cleans messy CSV/Excel files — the kind you get from ERP exports, WeChat/Excel handoffs and government portals.

Built for the failure modes that actually break real spreadsheets:

Problem

Handled

GBK / GB18030 / Big5 files that open as 锟斤拷

✅ auto-detected, re-encoded

Merged header cells (value only in the top-left cell)

✅ unmerged

Title rows / blank rows above the real header

✅ header row located by scoring

Header row repeated on every page of an export

✅ removed

Numbers stored as text: ¥1,200.50, 1 050, full-width 120

✅ coerced to numbers

IDs with leading zeros (001, 00123)

✅ kept as text, zeros preserved

16+ digit IDs that Excel silently rounds

⚠️ flagged in the profile report

Duplicate column names, duplicate rows, empty rows/columns

✅ fixed

Ragged CSV (unquoted comma inside a value)

⚠️ detected and reported

Read-only probing is separate from mutation: profile_table tells you what is wrong, clean_table fixes it, merge_tables combines files.

Install

Requires Python 3.9+ and uv.

uvx --from git+https://github.com/DaoYewochengla/csvfix-mcp csvfix-mcp

First run downloads pandas + numpy (~22 MB). On a slow link to PyPI, point uv at a mirror first — measured on the same machine: PyPI direct >14 min (stalled), Tsinghua mirror 3.3 s:

# China mirror, then the same command
export UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple
uvx --from git+https://github.com/DaoYewochengla/csvfix-mcp csvfix-mcp

Or from a clone:

uv run --from . csvfix-mcp

Related MCP server: contact-dedupe

Try it before installing

csvfix-mcp MCP server

The Glama listing lets you browse the tools, check the server's quality score, and try it online with MCP Inspector before installing anything locally.

Register in an MCP client

Claude Desktop / Claude Code / Cline / any stdio client (claude_desktop_config.json or mcp.json):

{
  "mcpServers": {
    "csvfix": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/DaoYewochengla/csvfix-mcp", "csvfix-mcp"]
    }
  }
}

Tools

profile_table

Read-only diagnosis. Returns detected encoding, delimiter, the real header row, row/column counts, and per-column warnings (mojibake, numbers-as-text, leading zeros, 16+ digit IDs, mixed types, duplicate rows).

{
  "path": "D:/exports/订单_2026-01.csv"
}
{
  "encoding": "gb18030",
  "delimiter": ",",
  "rows": 5,
  "columns": 4,
  "file_issues": ["1 duplicate row(s)", "rows above the real header were dropped (title/notes rows)"],
  "column_details": [
    {"name": "编号", "detected_type": "text", "nulls": 0, "sample": ["001", "002"], "issues": []},
    {"name": "金额", "detected_type": "number", "nulls": 0, "sample": ["1200.5", "980.0"], "issues": []}
  ]
}

clean_table

Writes a tidy copy plus a *.report.json audit trail.

{
  "path": "D:/exports/订单_2026-01.csv",
  "output": "D:/exports/订单_clean.csv",
  "dedupe": true,
  "format": "csv"
}
{
  "rows_in": 8,
  "rows_out": 4,
  "columns": 4,
  "duplicates_removed": 1,
  "encoding_in": "gb18030",
  "output": "D:/exports/订单_clean.csv",
  "report": "D:/exports/订单_clean.report.json"
}

format: "csv" writes UTF-8 with BOM, so double-clicking the file in Excel shows Chinese correctly instead of mojibake.

merge_tables

Aligns columns by name across files with different encodings and column orders, then optionally de-duplicates on a key.

{
  "paths": ["D:/exports/一月.csv", "D:/exports/二月.xlsx"],
  "output": "D:/exports/q1.xlsx",
  "key": "编号"
}

Deliberate limits

  • Local files only. Paths are read from the machine running the server; nothing is uploaded anywhere.

  • No header guessing beyond row 25. Past that, exports usually have a real problem rather than a long preamble.

  • Silent values are left silent. The cleaner never invents values; it reports nulls instead of filling them.

  • Not a schema validator. Use it to normalise shape, then validate semantics with your own rules.

Bulk / custom work

Cleaning thousands of files, a fixed monthly pipeline, or a format this tool does not cover yet — open an issue on this repo describing the input and what "clean" means for you; you'll get a quote.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables cleaning tabular data by detecting duplicates, placeholder nulls, type issues, spelling variants, encryption damage, outliers, and personal data, then applying safe fixes automatically while requiring human approval for risky changes.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to analyze contact exports, identify duplicate people with evidence-based matching, merge them into a cleaned CSV, and report every conflicting value.
      4
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables converting PDFs and CSV/spreadsheet files into spreadsheets, extracting bank statement or receipt data into clean CSV, cleaning messy CSV, and generating client-ready reports through an open MCP endpoint.
      -