Encoding MCP
create or convert with file encoding
Installation
npx encoding-mcpAsk AI about Encoding MCP
Powered by Claude ยท Grounded in docs
I know everything about Encoding MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Encoding MCP Server v2.0.1
์ ํ์ํ๊ฐ
๋ฌธ์ : AI Agent(Claude, GPT ๋ฑ)๊ฐ ํ์ผ์ ์์ฑํ ๋ UTF-8 without BOM์ผ๋ก ์์ฑํฉ๋๋ค. ์ด๋ Agent์ write ๋๊ตฌ๊ฐ BOM์ ์ฒ๋ฆฌํ์ง ์๊ธฐ ๋๋ฌธ์ ๋๋ค.
์ํฅ: Windows MSVC ์ปดํ์ผ๋ฌ๋ BOM ์์ด๋ ํ๊ธ ์ฃผ์/๋ฌธ์์ด์ ์๋ชป ํด์ํฉ๋๋ค. ๋น๋ ์คํจ๋ ๊นจ์ง ๋ฌธ์๊ฐ ๋ฐ์ํฉ๋๋ค.
ํด๊ฒฐ: ์ด MCP ์๋ฒ๋ Agent๊ฐ ํ์ผ์ ์ฐ๊ธฐ ์ ์ ์ฌ๋ฐ๋ฅธ ์ธ์ฝ๋ฉ(UTF-8 with BOM)์ผ๋ก ๋น ํ์ผ์ ๋จผ์ ์์ฑํฉ๋๋ค. Agent์ ๊ตฌ์กฐ์ ํ๊ณ๋ฅผ ์ฐํํ๋ ๋ฐฉ์์ ๋๋ค.
์๋ก์ด ๊ธฐ๋ฅ
ํ์ผ๋ช /๊ฒฝ๋ก ๋ถ๋ฆฌ ์ธํฐํ์ด์ค
- Agent๊ฐ ์์ฐ์ค๋ฝ๊ฒ ํ์ฌ ์์ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ธ์
- ํ์ผ๋ช ๊ณผ ๋๋ ํฐ๋ฆฌ ๊ฒฝ๋ก๋ฅผ ๋ช ํํ ๋ถ๋ฆฌ
- ๊ฒฝ๋ก ๊ด๋ จ ์ฌ์ฉ์ฑ ๋ฌธ์ ์์ ํด๊ฒฐ
์ธ์ฝ๋ฉ ๊ฐ์ง
- charset-normalizer: ์ต์ ๊ณ ์ฑ๋ฅ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- chardet: ์ ํต์ ์ด์ง๋ง ์์ ์
- fallback: ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ ๋ ๊ฐ์ ๋ ํด๋ฆฌ์คํฑ
- 95%+ ์ ํ๋ ๋ฌ์ฑ
Agent์์ ํ์
- MCP: ์ ํํ ์ธ์ฝ๋ฉ์ผ๋ก ๋น ํ์ผ ์์ฑ
- Agent: write ๋๊ตฌ๋ก ๋ด์ฉ ์ฑ์
- ๊ฒฐ๊ณผ: UTF-8 BOM ๋ณด์กด
๋น ๋ฅธ ์์
์ค์น
PyPI์์ ์ค์น (๊ถ์ฅ)
pip install encoding-mcp
๊ฐ๋ฐ์ ๋ชจ๋ ์ค์น
git clone https://github.com/whyjp/encoding_mcp.git
cd encoding_mcp
pip install -e .[dev,test]
์ค์น ํ์ธ
# ํจํค์ง ์ ๋ณด ํ์ธ
pip show encoding-mcp
# ๋ฒ์ ํ์ธ
python -c "import encoding_mcp; print(encoding_mcp.__version__)"
# MCP ์๋ฒ ์คํ ํ
์คํธ
python -m encoding_mcp
Cursor ์ฐ๊ฒฐ
Cursor ์ค์ โ Extensions โ MCP โ ์ค์ ํ์ผ์ ์ถ๊ฐ:
{
"mcpServers": {
"encoding-mcp": {
"command": "python",
"args": ["-m", "encoding_mcp"],
"env": {
"DEBUG": "false"
}
}
}
}
Cursor ์ฌ์์ ํ ์ฌ์ฉ ๊ฐ๋ฅ.
ํ ์คํธ
npx @modelcontextprotocol/inspector python -m encoding_mcp
์ฃผ์ ๋๊ตฌ
create_empty_file
์ง์ ๋ ์ธ์ฝ๋ฉ์ผ๋ก ๋น ํ์ผ์ ์์ฑํฉ๋๋ค. Agent๊ฐ ๋ด์ฉ์ ์ฑ์ธ ์ ์๋๋ก ๋น ํ์ผ๋ง ์์ฑํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_name: ์์ฑํ ํ์ผ๋ช (์: hello.cpp, test.h)directory_path: ํ์ผ์ ์์ฑํ ๋๋ ํฐ๋ฆฌ์ ์ ๋ ๊ฒฝ๋กencoding: ํ์ผ ์ธ์ฝ๋ฉ (utf-8-bom, utf-8, cp949, euc-kr, ascii)
detect_file_encoding
ํ์ผ์ ์ธ์ฝ๋ฉ์ ์ ํํ๊ฒ ๊ฐ์งํฉ๋๋ค.
๋งค๊ฐ๋ณ์:
file_name: ํ์ธํ ํ์ผ๋ช (์: hello.cpp, test.h)directory_path: ํ์ผ์ด ์๋ ๋๋ ํฐ๋ฆฌ์ ์ ๋ ๊ฒฝ๋กmax_bytes: ๋ถ์ํ ์ต๋ ๋ฐ์ดํธ ์ (๊ธฐ๋ณธ๊ฐ: 8192)
convert_file_encoding
ํ์ผ์ ์ง์ ๋ ์ธ์ฝ๋ฉ์ผ๋ก ๋ณํํฉ๋๋ค. ์๋ ๋ฐฑ์ ์ง์.
๋งค๊ฐ๋ณ์:
file_name: ๋ณํํ ํ์ผ๋ช (์: hello.cpp, test.h)directory_path: ํ์ผ์ด ์๋ ๋๋ ํฐ๋ฆฌ์ ์ ๋ ๊ฒฝ๋กtarget_encoding: ๋ชฉํ ์ธ์ฝ๋ฉ (utf-8-bom, utf-8, cp949, euc-kr, ascii)backup: ์๋ณธ ํ์ผ ๋ฐฑ์ ์ฌ๋ถ (๊ธฐ๋ณธ๊ฐ: false)
get_system_info
Encoding MCP ์์คํ ์ ๋ณด๋ฅผ ํ์ธํฉ๋๋ค. ์ฌ์ฉ ๊ฐ๋ฅํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ง์ ์ธ์ฝ๋ฉ์ ๋ณด์ฌ์ค๋๋ค.
์ฌ์ฉ ์์
๊ธฐ๋ณธ ์ํฌํ๋ก์ฐ
1. ๋น UTF-8 BOM ํ์ผ ์์ฑ
# MCP ํธ์ถ
mcp_encoding_create_empty_file(
file_name="hello.cpp",
directory_path="D:/my_project/src",
encoding="utf-8-bom"
)
2. Agent๊ฐ ๋ด์ฉ ์ฑ์ฐ๊ธฐ
# Agent write ๋๊ตฌ ์ฌ์ฉ
write(
file_path="D:/my_project/src/hello.cpp",
contents="#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\" << std::endl;\n return 0;\n}"
)
3. ์ธ์ฝ๋ฉ ๊ฒ์ฆ
# ์ธ์ฝ๋ฉ ๊ฐ์ง
mcp_encoding_detect_file_encoding(
file_name="hello.cpp",
directory_path="D:/my_project/src"
)
4. ํ์์ ์ธ์ฝ๋ฉ ๋ณํ
# ์์ ํ ๋ณํ (์๋ ๋ฐฑ์
)
mcp_encoding_convert_file_encoding(
file_name="hello.cpp",
directory_path="D:/my_project/src",
target_encoding="utf-8",
backup=true
)
๋ค์ํ ์ธ์ฝ๋ฉ
# UTF-8 BOM (Windows C++ ์ต์ ํ)
create_empty_file(file_name="main.cpp", directory_path="D:/project", encoding="utf-8-bom")
# UTF-8 (๋ฒ์ฉ)
create_empty_file(file_name="script.py", directory_path="D:/project", encoding="utf-8")
# CP949 (Windows ํ๊ธ)
create_empty_file(file_name="korean.txt", directory_path="D:/project", encoding="cp949")
# ASCII (ํธํ์ฑ)
create_empty_file(file_name="config.txt", directory_path="D:/project", encoding="ascii")
์ง์ ์ธ์ฝ๋ฉ
| ์ธ์ฝ๋ฉ | ์ค๋ช | Windows ํธํ | ์ฉ๋ |
|---|---|---|---|
| utf-8-bom | UTF-8 with BOM | ๐ช โ | C++, PowerShell |
| utf-8 | UTF-8 without BOM | ๐ง โ | ๋ฒ์ฉ์ ์ฌ์ฉ |
| cp949 | Windows ํ๊ธ | ๐ช โ | ๋ ๊ฑฐ์ ํ๊ธ |
| euc-kr | Unix/Linux ํ๊ธ | ๐ง โ | Unix ํ๊ฒฝ |
| ascii | 7๋นํธ ASCII | ๐ โ | ํธํ์ฑ ์ต๊ณ |
์ธ์ฝ๋ฉ ๊ฐ์ง
๊ฐ์ง ๋ฐฉ๋ฒ ์ฐ์ ์์
- BOM ๊ฐ์ง (100% ์ ํ๋)
- charset-normalizer (ํ๋์ , ๊ณ ์ฑ๋ฅ)
- chardet (์ ํต์ , ์์ ์ )
- fallback (๊ฐ์ ๋ ํด๋ฆฌ์คํฑ)
๊ฐ์ง ์ ํ๋
- BOM ์๋ ํ์ผ: 100%
- UTF-8: 94%+
- CP949/EUC-KR: 82%+
- ASCII: 98%+
Windows ๋น๋ ๋ฌธ์ ํด๊ฒฐ
โ ๋ฌธ์ ์ํฉ
- C++ ํ์ผ: UTF-8 without BOM โ ํ๊ธ ์ฃผ์ ๊นจ์ง
- PowerShell ์คํฌ๋ฆฝํธ: UTF-8 without BOM โ ํ๊ธ ์ถ๋ ฅ ๊นจ์ง
- ๋ฐฐ์น ํ์ผ: ์ธ์ฝ๋ฉ ๋ฌธ์ โ ์คํฌ๋ฆฝํธ ์คํ ์คํจ
โ ํด๊ฒฐ ๊ฒฐ๊ณผ
- ๋ชจ๋ ํ์ผ์ด UTF-8 with BOM์ผ๋ก ์์ฑ
- Windows ํ๊ฒฝ์์ ์์ ์ ์๋
- ํ๊ธ ํฌํจ ์์ค์ฝ๋ ์ง์
๊ณ ๊ธ ์ค์
๊ฐ๋ฐ์ ๋ชจ๋
{
"mcpServers": {
"encoding-mcp-dev": {
"command": "python",
"args": ["-m", "encoding_mcp"],
"env": {
"DEBUG": "true",
"LOG_LEVEL": "DEBUG"
}
}
}
}
ํน์ Python ๋ฒ์
{
"mcpServers": {
"encoding-mcp": {
"command": "python3.11",
"args": ["-m", "encoding_mcp"],
"env": {
"DEBUG": "false"
}
}
}
}
๊ฐ์ํ๊ฒฝ
{
"mcpServers": {
"encoding-mcp": {
"command": "/path/to/venv/bin/python",
"args": ["-m", "encoding_mcp"],
"env": {
"DEBUG": "false"
}
}
}
}
์ง์ ์คํ (๊ฐ๋ฐ์ฉ)
{
"mcpServers": {
"encoding-mcp-dev": {
"command": "python",
"args": ["/path/to/encoding_mcp/encoding_mcp/server.py"],
"env": {
"DEBUG": "true"
}
}
}
}
์ํคํ ์ฒ
๋ชจ๋ ๊ตฌ์กฐ
encoding_mcp/
โโโ server.py # ๋ฉ์ธ MCP ์๋ฒ
โโโ encoding_detector.py # ์ธ์ฝ๋ฉ ๊ฐ์ง
โโโ file_operations.py # ํ์ผ ์์ฑ/๋ณํ ๋ก์ง
โโโ __main__.py # ๋ชจ๋ ์คํ ์ํธ๋ฆฌ ํฌ์ธํธ
โโโ __init__.py # ํจํค์ง ์ด๊ธฐํ
์ํฌํ๋ก์ฐ
1. MCP: ์ ํํ ์ธ์ฝ๋ฉ์ผ๋ก ๋น ํ์ผ ์์ฑ
2. Agent: write ๋๊ตฌ๋ก ๋ด์ฉ ์ฑ์
3. ๊ฒฐ๊ณผ: UTF-8 BOM ๋ณด์กด
Agent ํ์ ํจํด
# 1๋จ๊ณ: MCP๋ก ๋น ํ์ผ ์์ฑ
mcp_encoding_create_empty_file(
file_name="hello.cpp",
directory_path=os.getcwd(), # Agent๊ฐ ์๋ ์ธ์
encoding="utf-8-bom"
)
# 2๋จ๊ณ: Agent๊ฐ ๋ด์ฉ ์ฑ์
write(
file_path="hello.cpp",
contents="C++ ์์ค ์ฝ๋..."
)
# ๊ฒฐ๊ณผ: UTF-8 BOM ๋ณด์กด๋ ํ์ผ
๊ธฐ์ ์ธ๋ถ์ฌํญ
์์คํ ์๊ตฌ์ฌํญ
- Python 3.10+ (MCP ๋ชจ๋์ pattern matching ๊ธฐ๋ฅ ์ฌ์ฉ)
- Windows, macOS, Linux ์ง์
์์กด์ฑ
mcp>=1.0.0: Model Context Protocolcharset-normalizer>=3.0.0: ํ๋์ ์ธ์ฝ๋ฉ ๊ฐ์งchardet>=5.0.0: ์ ํต์ ์ธ์ฝ๋ฉ ๊ฐ์ง
๊ณ ๊ธ ๊ธฐ๋ฅ
- BOM ๊ฐ์ง: ๋ฐ์ดํธ ์ํ์ค ๋ถ์
- ๋ฐฑ์ ์์คํ : ์๋ณธ ํ์ผ ์๋ ๋ณด์กด
- ์ค๋ฅ ๋ณต๊ตฌ: ์คํจ ์ ๋ฐฑ์ ์์ ๋ณต์
๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค ํ์ ๋ฐฐํฌ๋ฉ๋๋ค.
๊ธฐ์ฌ
๋ฒ๊ทธ ๋ฆฌํฌํธ, ๊ธฐ๋ฅ ์์ฒญ, ํ ๋ฆฌํ์คํธ๋ฅผ ํ์ํฉ๋๋ค.
