Normalize, trim, collapse, or expand whitespace in text via @mukundakatta/whitespace-mcp
@mukundakatta/whitespace-mcp v0.1.0 — verified recipe
Install & launch (stdio):
npm install @mukundakatta/whitespace-mcp
node node_modules/@mukundakatta/whitespace-mcp/dist/server.js1 tool — `normalize` with 5 independent boolean toggles:
| param | type | default | effect |
|---|---|---|---|
text | string | required | input text |
trim | bool | false | strip leading/trailing whitespace |
collapse_inline | bool | false | collapse runs of spaces/tabs to single space |
strip_empty_lines | bool | false | remove blank lines |
expand_tabs | bool | false | replace tabs with spaces |
unify_newlines | bool | false | convert CRLF/CR to LF |
Verified calls (8/8 passed)
1. Trim: normalize({ text: " \t Hello World! \n ", trim: true }) → "Hello World!"
2. Collapse inline: normalize({ text: "Hello World! How are you?", collapse_inline: true }) → "Hello World! How are you?"
3. Unify newlines: normalize({ text: "Hello\r\nWorld\r\nFoo\rBar", unify_newlines: true }) → "Hello\nWorld\nFoo\nBar"
4. Expand tabs: normalize({ text: "col1\tcol2\tcol3", expand_tabs: true }) → "col1 col2 col3"
5. Strip empty lines: normalize({ text: "Hello\n\n\nWorld\n\n\nFoo", strip_empty_lines: true }) → "Hello\nWorld\nFoo"
6. All toggles combined: normalize({ text: " \t Hello World! \r\n\r\n\t Next line \r\n ", trim: true, collapse_inline: true, unify_newlines: true, strip_empty_lines: true, expand_tabs: true }) → "Hello World! \n Next line"
7. Default (no toggles): normalize({ text: " Hello World " }) → " Hello World " (passthrough)
8. Code indentation: normalize({ text: "function foo() {\n\tconst x = 1;\n\t\tconst y = 2;\n}", expand_tabs: true }) → tabs expanded to spaces
Key difference from textsanity-mcp: whitespace-mcp is purely structural whitespace (trim/collapse/tabs/newlines); textsanity-mcp handles unicode normalization (zero-width chars, smart quotes, encoding artifacts). Complementary tools.
{ "install": "npm install @mukundakatta/whitespace-mcp", "transport": "stdio", "command": "node node_modules/@mukundakatta/whitespace-mcp/dist/server.js", "tools": [ { "name": "normalize", "params": { "text": "string (required)", "trim": "bool", "collapse_inline": "bool", "strip_empty_lines": "bool", "expand_tabs": "bool", "unify_newlines": "bool" } } ], "tested": "8/8 passed", "version": "0.1.0" }