Polyglot
HTTP-SSEMCP server for multilingual translation services using Claude Sonnet 3.5
MCP server for multilingual translation services using Claude Sonnet 3.5
Polyglot is an open-source implementation of the Model Contexts Protocol (MCP) focused on translation services. It provides a standardized way to handle translation requests across multiple languages using Claude Sonnet 3.5.
# Install uv if you haven't already curl -LsSf https://astral.sh/uv/install.sh | sh # Install the package and its dependencies uv pip install . # For development, install with dev dependencies uv pip install ".[dev]"
# Install the package and its dependencies pip install . # For development, install with dev dependencies pip install ".[dev]"
.env file in your project root:ANTHROPIC_API_KEY=your_api_key_here
To run the MCP server, use the following command:
uv run polyglot/server.py
This will start the server on the configured port (default: 8001).
You can test the MCP server using a simple client script. For example, to test the health check resource, create a file named test_client.py with the following content:
import requests response = requests.get("http://localhost:8001/health") print(response.text)
Run the test client with:
uv run test_client.py
You should see the output: "Service is healthy".
Make sure to set your Anthropic API key in a .env file in the project root:
ANTHROPIC_API_KEY=your_api_key_here
uv or pip.The translation request follows this JSON structure:
{ "version": "1.0", "type": "translation_request", "metadata": { "source_language": "fr", "target_language": "en", "domain": "legal", "formality": "formal", "api_key": "your_api_key_here" // Required for authentication }, "data": { "text": "Le contrat a été signé hier à Genève." } }
To set up the development environment:
# Install uv if you haven't already curl -LsSf https://astral.sh/uv/install.sh | sh # Create and activate a virtual environment uv venv source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On Windows # Install development dependencies uv pip install ".[dev]"
MIT License