Skip to main content
Glama
GalvinGao

SimpleLocalize MCP Server

by GalvinGao

publish_translations

Publish translations from the editor to hosting environments or between environments using environment keys like '_latest' or '_production'.

Instructions

Publish translations to a specified environment.

This endpoint publishes translations from the translation editor to hosting environments or from one hosting environment to another. Please note that this endpoint requires authorization and is only available for paid plans.

Common environment keys:

  • "_latest": Publish from Translation Editor

  • "_production": Publish to production environment (from _latest by default)

  • Custom environment key: Publish to custom environment

Args: environment_key: The environment key to publish to (e.g., "_latest", "_production", or custom key)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environment_keyYes

Implementation Reference

  • main.py:145-172 (handler)
    The handler function for the 'publish_translations' tool. It is decorated with @mcp.tool() for registration and implements the logic to publish translations to a SimpleLocalize environment by making a POST API request.
    @mcp.tool() async def publish_translations(environment_key: str) -> str: """Publish translations to a specified environment. This endpoint publishes translations from the translation editor to hosting environments or from one hosting environment to another. Please note that this endpoint requires authorization and is only available for paid plans. Common environment keys: - "_latest": Publish from Translation Editor - "_production": Publish to production environment (from _latest by default) - Custom environment key: Publish to custom environment Args: environment_key: The environment key to publish to (e.g., "_latest", "_production", or custom key) """ if not environment_key: raise ValueError("Environment key is required") try: result = await make_simplelocalize_request( "POST", f"/api/v2/environments/{environment_key}/publish" ) return f"Successfully initiated publishing to environment '{environment_key}'. Status: {result.get('msg', 'OK')}" except SimpleLocalizeError as e: return str(e)
  • main.py:19-43 (helper)
    Helper function used by publish_translations to make authenticated HTTP requests to the SimpleLocalize API.
    async def make_simplelocalize_request(method: str, endpoint: str, json_data: dict | None = None) -> dict[str, Any]: """Make a request to the SimpleLocalize API with proper error handling.""" headers = { "X-SimpleLocalize-Token": SIMPLELOCALIZE_API_KEY, "Content-Type": "application/json" } url = f"{SIMPLELOCALIZE_API_BASE}{endpoint}" async with httpx.AsyncClient() as client: try: if method.upper() == "POST": response = await client.post(url, headers=headers, json=json_data, timeout=30.0) elif method.upper() == "PATCH": response = await client.patch(url, headers=headers, json=json_data, timeout=30.0) elif method.upper() == "GET": response = await client.get(url, headers=headers, timeout=30.0) else: raise ValueError(f"Unsupported HTTP method: {method}") response.raise_for_status() return response.json() except httpx.HTTPError as e: raise SimpleLocalizeError(f"SimpleLocalize API error: {str(e)}")
  • main.py:145-145 (registration)
    The @mcp.tool() decorator registers the publish_translations function as an MCP tool.
    @mcp.tool()

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/GalvinGao/mcp-simplelocalize'

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