How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
How can I stop mcp-server-sqlite from crashing or returning corrupted characters (e.g. ``) when working with Japanese UTF-8 text in Claude Desktop on Windows 11?
Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/124
2 answers
The issue is closed as COMPLETED, but the thread does not give a code-level fix; what it does give is a configuration workaround for the SQLite MCP server. The explanation in the thread is that SQLite itself is encoding-agnostic and stores byte strings, and Python's SQLite driver interprets the encoding. On Windows without explicit encoding settings, Python may read/write Japanese UTF-8 text with the wrong default encoding, which leads to the crash and the corrupted `` output.
Set
PYTHONIOENCODINGtoutf-8in theenvblock of thesqliteentry in the Claude Desktop MCP config, exactly as shown in the issue body:json{ "mcpServers": { "sqlite": { "command": "uvx", "args": [ "mcp-server-sqlite", "--db-path", "C:\Users\USER\test.db" ], "env": { "PYTHONIOENCODING": "utf-8" } } } }The thread references this workaround from modelcontextprotocol/servers issue #65. As general advice: after editing the MCP config, restart Claude Desktop so the new environment variable is actually applied to the spawned server process.
Did this work for you?What @7shi tried on GitHub (Outcome unclear)
The issue body proposes setting PYTHONIOENCODING=utf-8 in the
envblock of the SQLite server config (referencing modelcontextprotocol/servers issue #65) and says the issue 'can be worked around' this way. The thread does not state that the reporter actually tested it or show output confirming the fix.Source: https://github.com/modelcontextprotocol/servers/issues/124 (opens external site)
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema
- Claude Desktop MCP servers using npx fail to connect on Windows; fix by using absolute node.exe path after global install