Skip to main content
Glama

ポリグロット - 翻訳のためのモデルコンテキストプロトコル

Polyglotは、翻訳サービスに特化したModel Contexts Protocol(MCP)のオープンソース実装です。Claude Sonnet 3.5を用いて、複数言語間の翻訳リクエストを処理するための標準化された方法を提供します。

サポートされている言語

  • アラビア語(ar)

  • 中国語(zh)

  • 英語 (en)

  • フランス語(fr)

  • ロシア語(ru)

  • スペイン語(es)

Related MCP server: Lara Translate MCP Server

特徴

  • 標準化された翻訳依頼フォーマット

  • 複数のドメイン(法律、医療、一般)のサポート

  • 形式レベルの制御(形式的/非形式的)

  • Claude Sonnet 3.5 の統合

  • MCP プロトコル サーバー (FastMCP 経由)

  • APIキー認証

インストール

uvの使用(推奨)

# 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]"

pipの使用

# Install the package and its dependencies
pip install .

# For development, install with dev dependencies
pip install ".[dev]"

構成

  1. プロジェクト ルートに.envファイルを作成します。

ANTHROPIC_API_KEY=your_api_key_here
  1. API キーは必ず安全に保管し、バージョン管理にコミットしないでください。

MCPサーバーの実行

Polyglot MCP サーバーはFastMCPを使用して、MCP プロトコル (SSE トランスポート) 経由で翻訳ツールとリソースを公開します。

サーバーを起動するには:

python -m polyglot.server

デフォルトでは、サーバーは SSE トランスポートを使用してポート 8001 で実行されます。

MCPサーバーのテスト

MCP Inspector の使用 (推奨)

  1. MCP Inspector をインストールします。

    npx @modelcontextprotocol/inspector
  2. Inspector UI を開きます (ターミナルにローカル アドレスが表示されます)。

  3. Inspector UI で以下を設定します。

    • 輸送タイプ: SSE

    • URL: http://localhost:8001/sse

    • (オプション) 必要に応じてインスペクターのプロキシアドレスを設定する

  4. Inspector UI を介して翻訳ツールおよびリソースを操作できるようになりました。

Python MCPクライアントの使用

MCP Python SDK を使用してプログラムでサーバーと対話することもできます。

from mcp.client.sse import sse_client
import asyncio

async def main():
    async with sse_client(url="http://localhost:8001/sse") as (read, write):
        # Example: call the translate tool
        request = {
            "tool": "translate",
            "args": {
                "request": {
                    "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."}
                }
            }
        }
        await write(request)
        response = await read()
        print(response)

asyncio.run(main())

プロトコル仕様

翻訳リクエストは次の JSON 構造に従います。

{
  "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."
  }
}

発達

開発環境をセットアップするには:

# 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ライセンス

-
security - not tested
A
license - permissive license
-
quality - not tested

Appeared in Searches

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/namiraprita/polyglot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server