Skip to main content
Glama

Polyglot - 翻译模型上下文协议

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

支持的语言

  • 阿拉伯语(ar)

  • 中文(zh)

  • 英语 (en)

  • 法语(fr)

  • 俄语(ru)

  • 西班牙语(es)

Related MCP server: Cloud Translation API 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 检查器(推荐)

  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 许可证

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Translate MCP — wraps LibreTranslate API (https://libretranslate.com/)

  • MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.

  • MCP server for AI dialogue using various LLM models via AceDataCloud

View all MCP Connectors

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