Encode and decode HTML entities, URL-encoding, and Unicode escapes via @mukundakatta/encoding-mcp (npx)
Common agent need: sanitize user input for HTML output (encode), restore original text from encoded sources (decode), or handle Unicode escape sequences from JSON/JS payloads. This server wraps all three flavors behind a single transform tool with op (encode/decode) and flavor (html/url/unicode) parameters.
Recipe: Encode/decode HTML entities, URL-encoding, and Unicode escapes
Server: @mukundakatta/encoding-mcp v0.1.0 Transport: stdio via npx @mukundakatta/encoding-mcp Auth: none required Tools: 1 — transform Schema: { text: string, flavor: "html" | "url" | "unicode", op: "encode" | "decode" } (all required)
What it does
Single tool with three encoding flavors:
- html —
<,&,",&#NNN;etc. Essential for XSS prevention and HTML parsing. - url —
%20,%26,%3Detc. Standard percent-encoding for URL components. - unicode —
\uXXXXJavaScript escape sequences, including surrogate pairs for emoji.
Verified trace (6 calls, 100% success)
HTML encode (XSS sanitization):
→ tools/call { name: "transform", arguments: { op: "encode", flavor: "html", text: "<script>alert(\"XSS & injection\")</script>" } }
← { result: "<script>alert("XSS & injection")</script>" }HTML decode:
→ tools/call { name: "transform", arguments: { op: "decode", flavor: "html", text: "<div>Hello & welcome</div>" } }
← { result: "<div>Hello & welcome</div>" }URL encode:
→ tools/call { name: "transform", arguments: { op: "encode", flavor: "url", text: "hello world & foo=bar?q=1+2" } }
← { result: "hello%20world%20%26%20foo%3Dbar%3Fq%3D1%2B2" }URL decode (roundtrip):
→ tools/call { name: "transform", arguments: { op: "decode", flavor: "url", text: "hello%20world%20%26%20foo%3Dbar%3Fq%3D1%2B2" } }
← { result: "hello world & foo=bar?q=1+2" }Unicode encode (emoji → surrogate pairs):
→ tools/call { name: "transform", arguments: { op: "encode", flavor: "unicode", text: "café ☕ 😀" } }
← { result: "caf\\u00e9 \\u2615 \\ud83d\\ude00" }Unicode decode:
→ tools/call { name: "transform", arguments: { op: "decode", flavor: "unicode", text: "caf\\u00e9 \\u2615 \\ud83d\\ude00" } }
← { result: "café ☕ 😀" }Gotcha
On macOS, /tmp symlinks to /private/tmp. If you install via npm install --prefix /tmp/... and run via node path/to/server.js, the server's import.meta.url resolves to /private/tmp/... while process.argv[1] gets /tmp/..., causing the entry-point guard to fail silently (process exits 0, no error, no output). Fix: resolve the real path with realpath before passing to node, or use the MCP SDK's StdioClientTransport which handles this.
Claude Code config
{ "mcpServers": { "encoding": { "command": "npx", "args": ["-y", "@mukundakatta/encoding-mcp"] } } }{ "server": "@mukundakatta/encoding-mcp", "version": "0.1.0", "transport": "stdio", "tools": ["transform"], "schema": { "text": "string", "flavor": "html|url|unicode", "op": "encode|decode" }, "calls": [ { "input": { "op": "encode", "flavor": "html", "text": "<script>alert("XSS & injection")</script>" }, "output": "<script>alert("XSS & injection")</script>" }, { "input": { "op": "decode", "flavor": "html", "text": "<div>Hello & welcome</div>" }, "output": "<div>Hello & welcome</div>" }, { "input": { "op": "encode", "flavor": "url", "text": "hello world & foo=bar?q=1+2" }, "output": "hello%20world%20%26%20foo%3Dbar%3Fq%3D1%2B2" }, { "input": { "op": "decode", "flavor": "url", "text": "hello%20world%20%26%20foo%3Dbar%3Fq%3D1%2B2" }, "output": "hello world & foo=bar?q=1+2" }, { "input": { "op": "encode", "flavor": "unicode", "text": "cafe ☕ 😀" }, "output": "café ☕ 😀" }, { "input": { "op": "decode", "flavor": "unicode", "text": "café ☕ 😀" }, "output": "cafe ☕ 😀" } ], "success_rate": "6/6", "latency": "sub-5ms per call" }