Translate Text From an AI Agent (MCP and UTCP)¶
Connect an AI agent to the OVOS translate server, so the agent can translate text and detect its language. Use the translate server when Claude Code, Claude Desktop, opencode, Mistral Vibe, or your own MCP or UTCP agent must translate through a translation plugin that you choose.
What you get¶
- The MCP tools
translateanddetect_languageathttp://localhost:9686/mcp. - A UTCP manual at
http://localhost:9686/utcpwith five tools:translate,translate_with_source,detect_language,classify_languageandsupported_languages.
Start the server¶
Alpha channel only
The mcp extra is only in the prerelease channel. Install the server
from that channel:
-
Start the server with a translation plugin, a language detection plugin and the
--mcpflag:
The ovos-google-translate-plugin package also installs the ovos-google-lang-detector-plugin detector. Both send the text to Google.
Translate from Claude Code¶
-
Add the server to Claude Code:
-
Make sure that Claude Code can connect:
Translate from Claude Desktop¶
Add the mcp-remote bridge to claude_desktop_config.json, then restart Claude Desktop. The bridge needs Node.js.
{
"mcpServers": {
"ovos-translate": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:9686/mcp"]
}
}
}
Translate from opencode¶
-
Add the server to
opencode.jsonin your project folder: -
Make sure that opencode can connect:
Translate from Mistral Vibe¶
-
Add the server to
~/.vibe/config.toml:[[mcp_servers]] name = "ovos-translate" transport = "streamable-http" url = "http://localhost:9686/mcp"Write the entry in the file. Do not use
vibe mcp addfor this server: that command sets OAuth login for an HTTP server, and the OVOS server does not use OAuth. -
Start
vibe. Vibe loads the tools of the server when it starts. It gives each tool the server name as a prefix and changes each hyphen to_, for exampleovos_translate_translateandovos_translate_detect_language.
Translate from your own MCP client¶
import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamable_http_client
async def main():
async with streamable_http_client("http://localhost:9686/mcp") as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
print([t.name for t in (await session.list_tools()).tools])
result = await session.call_tool("translate", {"text": "good morning", "target_lang": "pt"})
print(result.content[0].text)
result = await session.call_tool("detect_language", {"text": "bonjour tout le monde"})
print(result.content[0].text)
asyncio.run(main())
Without source_lang, the server detects the source language before it translates.
Translate from a UTCP agent¶
import asyncio
from utcp.utcp_client import UtcpClient
async def main():
client = await UtcpClient.create(config={"manual_call_templates": [{
"name": "ovos_translate", "call_template_type": "http",
"url": "http://localhost:9686/utcp", "http_method": "GET"}]})
print(await client.call_tool("ovos_translate.translate_with_source",
{"src_lang": "en", "tgt_lang": "de", "utterance": "is 1/2 the answer?"}))
print(await client.call_tool("ovos_translate.classify_language",
{"utterance": "bonjour tout le monde"}))
asyncio.run(main())
The translate server names its UTCP tools ovos_translate.<tool>. When the manual has another name in the client config, the client puts that name in front, for example tx.ovos_translate.translate. MCP tool names have no prefix (translate).
Tool reference¶
| Tool | Protocol | Arguments | Result |
|---|---|---|---|
translate |
MCP | text, target_lang, source_lang (optional) |
Translated text |
detect_language |
MCP | text |
A language tag, for example fr |
ovos_translate.translate |
UTCP | tgt_lang, utterance |
Translated text |
ovos_translate.translate_with_source |
UTCP | src_lang, tgt_lang, utterance |
Translated text |
ovos_translate.detect_language |
UTCP | utterance |
A language tag |
ovos_translate.classify_language |
UTCP | utterance |
A map of language tag to score |
ovos_translate.supported_languages |
UTCP | none | {"plugin", "langs"} |
If it fails¶
| What you see | Cause | What to do |
|---|---|---|
detect_language fails with has no attribute 'detect' |
The server started without --detect-engine, and the translation plugin cannot detect languages |
Start the server with a detection plugin, for example --detect-engine ovos-google-lang-detector-plugin. |
/mcp returns 404 |
The server started without --mcp, or the mcp extra is not installed |
Install the mcp extra. Start the server with --mcp. The server log shows a warning when the extra is missing. |
The UTCP client registers no tools for http |
utcp-http is not installed |
Install utcp-http. |
More information¶
- AI agent integration in the
ovos-translate-serverREADME. - Translate Server for all endpoints and plugins.
Read next: Talk to an OVOS persona over A2A Related: AI Agents · Give a persona MCP and UTCP tools · Translate Server