Skip to main content
Glama

Polyglot - 翻译模型上下文协议

Polyglot 是模型上下文协议 (MCP) 的开源实现,专注于翻译服务。它使用 Claude Sonnet 3.5 提供了一种标准化的方式来处理跨多种语言的翻译请求。

支持的语言

  • 阿拉伯语(ar)

  • 中文(zh)

  • 英语 (en)

  • 法语(fr)

  • 俄语(ru)

  • 西班牙语(es)

特征

  • 标准化翻译请求格式

  • 支持多个领域(法律、医疗、一般)

  • 正式程度控制(正式/非正式)

  • 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 检查器(推荐)

  1. 安装 MCP 检查器:

    npx @modelcontextprotocol/inspector
  2. 打开 Inspector UI(终端将显示本地地址)。

  3. 在 Inspector UI 中设置以下内容:

    • 运输类型: SSE

    • 网址: 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

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    An MCP server implementation that integrates Claude with Salesforce, enabling natural language interactions with Salesforce data and metadata for querying, modifying, and managing objects and records.
    Last updated -
    7
    45
    14
    MIT License
    • Apple
    • Linux
  • A
    security
    A
    license
    A
    quality
    An MCP server providing machine translation capabilities via the Lara Translate API, featuring language detection and context-aware translations between numerous language pairs.
    Last updated -
    1
    79
    76
    MIT License
    • Apple
    • Linux
  • -
    security
    F
    license
    -
    quality
    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.
    Last updated -
    23
  • A
    security
    F
    license
    A
    quality
    A custom MCP protocol service that enhances AI models by providing multilingual translation capabilities and resource management, allowing for automatic text extraction and translation through external APIs.
    Last updated -
    2

View all related MCP servers

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