Skip to main content
Glama

MCP Polib Server

A Model Context Protocol (MCP) server for reading, writing, and manipulating GNU Gettext .po files.

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.

Related MCP server: Unstructured Document Processor MCP

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 stdio and http transports.

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 by msgid + msgctxt, appends new ones, and preserves unmodified entries. Auto-formats with powrap.

  • read_po_context – Fetch a specific entry by msgid plus 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 .po file)

  • 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_path and 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 --modified for 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

  1. Install dependencies:

    uv sync
  2. 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
  3. Run tests:

    uv run pytest

Docker

  1. Build the image:

    docker build -t mcp-polib:latest .
  2. Run the container with stdio transport:

    docker run -i --rm mcp-polib:latest
  3. 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 serve to 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

Available Tools

4 tools
find_fuzzyB

List every entry flagged as fuzzy in the provided PO file.

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • entries: List of fuzzy entries found in the PO file.

    • Example:

{
  "entries": [
    "unknown_type"
  ]
}
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{
  "detail": [
    "unknown_type"
  ]
}
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the .po file to read.

Output Schema

ParametersJSON Schema
NameRequiredDescription
entriesYesList of fuzzy entries found in the PO file.

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It states that the tool lists fuzzy entries and provides response details, but does not explicitly mention that it performs no mutation, whether an empty list is returned when no fuzzy entries exist, or how missing files are handled.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening sentence is concise and front-loaded, clearly stating the tool's core action. The response documentation is structured and useful, though it repeats some information that an output schema would already provide.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter read-style tool, the description covers the main behavior and response shape. It is largely complete, but could benefit from explicit notes about empty results and file-not-found behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already fully documents file_path as 'Absolute path to the .po file to read' at 100% coverage. The description adds no extra meaning about the parameter, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List', the resource 'PO file', and the filtering condition 'flagged as fuzzy'. It distinguishes the tool's purpose from generic PO readers, though it does not explicitly name or contrast any sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit guidance about when to choose this tool over read_po, read_po_context, or write_po. The use case is only implied by the word 'fuzzy', with no alternatives or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_poB

Return every entry from the requested PO file.

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • entries: List of entries parsed from the PO file.

    • Example:

{
  "entries": [
    "unknown_type"
  ]
}
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{
  "detail": [
    "unknown_type"
  ]
}
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the .po file to read.

Output Schema

ParametersJSON Schema
NameRequiredDescription
entriesYesList of entries parsed from the PO file.

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It does provide response codes and examples, which is helpful, but the example entries are plain strings like 'unknown_type' while the schema defines POEntry objects, undermining clarity. Missing-file or invalid-file behavior is not addressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening sentence is concise and front-loaded. However, the response documentation is padded with placeholder-looking examples ('unknown_type') and an empty 422 properties block, which adds noise without meaningful value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter read operation, the description plus the full input and output schemas provide enough information for correct invocation. The response examples and schema define the return shape, so the main missing piece is usage guidance, which is already penalized under that dimension.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the single parameter file_path is already fully described as 'Absolute path to the .po file to read.' The tool description adds no additional parameter context beyond that, fitting the baseline score for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific action, 'Return every entry', applied to a specific resource, the requested PO file. It is easy to understand what the tool does, though it does not explicitly contrast itself with sibling tools like read_po_context or find_fuzzy.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to choose this tool over read_po_context, write_po, or find_fuzzy. The description implies a full-file read, but it does not state any conditions, exclusions, or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

read_po_contextA

Return the target entry plus its surrounding context window.

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • target_entry: The requested entry.

      • context_before: Entries preceding the target.

      • context_after: Entries succeeding the target.

    • Example:

{
  "target_entry": "unknown_type",
  "context_before": [
    "unknown_type"
  ],
  "context_after": [
    "unknown_type"
  ]
}
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{
  "detail": [
    "unknown_type"
  ]
}
ParametersJSON Schema
NameRequiredDescriptionDefault
msgidYesThe msgid of the entry to find.
msgctxtNoOptional message context to disambiguate entries with the same msgid.
file_pathYesAbsolute path to the .po file to read.
context_sizeNoNumber of entries before and after to include.

Output Schema

ParametersJSON Schema
NameRequiredDescription
target_entryNoThe requested entry.
context_afterYesEntries succeeding the target.
context_beforeYesEntries preceding the target.

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full transparency burden. It discloses the response shape (target_entry, context_before, context_after), success status, and validation error, which gives an agent a solid picture of behavior. It does not explicitly state that it performs no modifications, but the tool name and 'Return' strongly imply a read-only operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The actual descriptive content is one sentence, but it is followed by a lengthy response-properties section and JSON examples that duplicate what the output schema already provides. Since the output schema exists, this repetition is redundant and reduces conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The one-line purpose plus fully described schema and output schema gives an agent enough to call the tool correctly. It lacks explicit usage guidance, but the rich structured metadata compensates for most missing context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the input schema fully documents all four parameters, including msgctxt disambiguation and context_size default. The description adds no parameter-level detail beyond this, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Return the target entry plus its surrounding context window.' This clearly distinguishes it from sibling tools like read_po and find_fuzzy, which likely handle single reads and fuzzy searches rather than contextual slices.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'surrounding context window' implies the tool is for reading an entry with neighboring entries, but there is no explicit statement of when to prefer this over read_po or find_fuzzy. Usage context is inferable, not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

write_poA

Create or update entries in a PO file and format it with powrap.

Responses:

  • 200 (Success): Successful Response

    • Content-Type: application/json

    • Response Properties:

      • success: Whether the write operation was successful.

      • message: Status message.

    • Example:

{
  "success": true,
  "message": "string"
}
  • 422: Validation Error

    • Content-Type: application/json

    • Response Properties:

    • Example:

{
  "detail": [
    "unknown_type"
  ]
}
ParametersJSON Schema
NameRequiredDescriptionDefault
entriesYesList of entries to write to the PO file.
file_pathYesAbsolute path to the .po file to write.

Output Schema

ParametersJSON Schema
NameRequiredDescription
messageYesStatus message.
successYesWhether the write operation was successful.

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the disclosure burden; it states that the module is modified and that powrap formatting is applied, warning of a side effect beyond the entry update. It could add detail on overwrite semantics or permissions, but the core behavioral traits are disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening sentence is front-loaded and concise, but the description then spends many lines restating HTTP response details and examples that the output schema already covers. This redundancy keeps it from being as efficient as it could be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with a full input schema and output schema, the description plus schema provides enough to call it correctly: file path, entries, success indicator, and validation errors. A small ambiguity remains about whether unlisted existing entries are preserved, but it is not blocking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents both file_path and entries with descriptions, and the description adds little beyond the schema. Per the coverage baseline, this is acceptable; no additional parameter semantics are needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific action ('Create or update') and resource ('PO file'), and adds the distinctive formatting side effect ('format it with powrap'). This clearly separates it from read-only siblings like read_po and find_fuzzy.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly positions this as the mutation tool for PO files, so an agent knows to use it when writing entries, while sibling names indicate read-only alternatives. It does not explicitly state when not to use it, but the write/read split is obvious from context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.9.5
    • First observedfind_fuzzy
    • First observedread_po
    • First observedread_po_context
    • First observedwrite_po

TDQS

A3.7/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct, clearly described purpose: read all entries, write entries, read a specific entry with context, and list fuzzy entries. There is no meaningful overlap that would cause an agent to select the wrong tool.

Naming Consistency3/5

read_po and write_po follow a consistent verb_noun pattern, but read_po_context adds a qualifier and find_fuzzy drops the resource noun entirely. The names are readable but the convention is not uniformly applied.

Tool Count5/5

With 4 tools, the server is well-scoped for a focused PO file utility. Each tool covers a meaningful operation and none feel redundant or unnecessary.

Completeness4/5

The server covers the core read/write workflow plus useful context and fuzzy-entry queries for PO file management. It lacks an explicit delete operation, but this is a minor gap that can often be worked around via update operations.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    A Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.
    28
    2,852 npm
    240
    Apache 2.0
  • A
    license
    A
    quality
    F
    maintenance
    A Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.
    21
    67
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A ModelContextProtocol server providing high-quality translation services with a three-stage translation workflow (analysis, segmented translation, full-text review) that supports multiple languages and integrates with Claude and OpenAI-compatible models.
    26
    -