mcp-polib
A Model Context Protocol server for reading, writing, and managing GNU Gettext .po translation files, enabling language models to perform file operations, entry management, partial updates, and fuzzy entry detection.
README
MCP Polib Server
A Model Context Protocol (MCP) server for reading, writing, and manipulating GNU Gettext
.pofiles.
Overview
This project provides a FastAPI-based MCP server that exposes a set of tools for working with PO (Portable Object) translation files using the polib library. It integrates with FastMCP to expose all operations as MCP-compatible tools, enabling seamless integration with language models and AI agents.
Key Features
- File Operations: Read complete PO files or look up specific entries by context.
- Entry Management: Create, update, and modify PO entries with full context support (msgid, msgstr, comments, flags, occurrences).
- Partial Updates: Merge new entries into existing PO files without overwriting unrelated data.
- Fuzzy Entry Detection: Identify and list all entries flagged as "fuzzy" for review.
- Automatic Formatting: Apply powrap formatting after writes to maintain PO file standards.
- Dockerized Deployment: Ready-to-use Docker image with Python 3.12 and all dependencies pre-installed.
- MCP Transport Flexibility: Support for both
stdioandhttptransports.
Available Tools
All endpoints operate on absolute file paths to PO files:
read_po– Load all entries from a PO file.write_po– Create or update entries in a PO file. Merges intelligently: updates existing entries bymsgid+msgctxt, appends new ones, and preserves unmodified entries. Auto-formats withpowrap.read_po_context– Fetch a specific entry bymsgidplus surrounding context (configurable window size).find_fuzzy– Return all entries marked with the "fuzzy" flag.
Tool Details
read_po
- Input:
file_path(absolute path to.pofile) - Output: List of all PO entries with msgid, msgstr, comments, flags, and occurrences
- Use Case: Extract all translations from a file for review or processing
write_po
- Input:
file_pathand list of entries with msgid, msgstr, optional metadata - Behavior:
- If entry exists (same msgid + msgctxt), updates it
- Otherwise, appends as new entry
- Unmodified entries remain unchanged
- Runs
powrap --modifiedfor automatic formatting
- Output: Success status and message (includes powrap errors if any)
- Use Case: Batch update or create translations
read_po_context
- Input:
file_path,msgid,context_size(default: 1) - Output: Target entry with surrounding entries before/after
- Use Case: View a translation with its neighboring context for better understanding
find_fuzzy
- Input:
file_path - Output: All entries marked as "fuzzy"
- Use Case: Find incomplete or uncertain translations for review
Getting Started
Local Development
-
Install dependencies:
uv sync -
Run the MCP server:
# stdio transport (default) uv run fastmcp run mcp_tools/main.py# http transport uv run fastmcp run mcp_tools/main.py --transport http -
Run tests:
uv run pytest
Docker
-
Build the image:
docker build -t mcp-polib:latest . -
Run the container with stdio transport:
docker run -i --rm mcp-polib:latest -
Run the container with http transport:
docker run --rm -p 8000:8000 mcp-polib:latest uv run fastmcp run mcp_tools/main.py --transport http
Configure in Claude Desktop
To use this server with Claude Desktop, add the following to your claude_desktop_config.json:
macOS:
{
"mcpServers": {
"mcp-polib": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v",
"/Users:/Users",
"mcp-polib:latest"
]
}
}
}
Linux:
{
"mcpServers": {
"mcp-polib": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v",
"/home:/home",
"mcp-polib:latest"
]
}
}
}
Windows:
{
"mcpServers": {
"mcp-polib": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v",
"C:\\Users:C:\\Users",
"mcp-polib:latest"
]
}
}
}
Project Structure
mcp-polib/
├── mcp_tools/
│ ├── main.py # FastAPI app and MCP tool implementations
│ ├── schemas.py # Pydantic models for request/response validation
│ └── __init__.py
├── tests/
│ ├── test_po_tools.py # Comprehensive test suite
│ └── test.po # Sample PO file for testing
├── scripts/
│ ├── build_docs.sh # Documentation build script
│ ├── build_image.sh # Docker image build helper
│ ├── export_openapi.py # Extract OpenAPI spec
│ └── openapi_to_markdown.py # Convert OpenAPI to Markdown
├── docs/ # MkDocs documentation
├── Dockerfile # Production-ready Docker image
├── pyproject.toml # Project metadata and dependencies
└── README.md # This file
Documentation
Full API documentation is available in:
- OpenAPI Spec:
docs/reference/endpoints_swagger.md - MkDocs: Run
uv run mkdocs serveto view locally
To rebuild documentation:
chmod +x scripts/build_docs.sh
scripts/build_docs.sh
uv run mkdocs build
Technical Stack
- Framework: FastAPI + FastMCP
- PO File Handling: polib
- Package Manager: uv
- Container: Docker (Python 3.12, Bookworm slim)
- Formatting: powrap
- Testing: pytest
- Documentation: MkDocs
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。