# Server MCP

LibreTranslate può fornire capacità di traduzione automatica agli agenti AI che supportano il protocollo [MCP](https://modelcontextprotocol.io/docs/getting-started/intro).


## Configurazione {#configurazione}


Aggiungi questo alla configurazione del tuo client:


### OpenCode {#opencode}


```json
{
  "mcp": {
    "LibreTranslate": {
      "type": "local",
      "command": ["npx", "-y", "@libretranslate/mcp"],
      "environment": {
        "LIBRETRANSLATE_API_URL": "https://libretranslate.com",
        "LIBRETRANSLATE_API_KEY": "your-api-key"
      }
    }
  }
}
```


### Claude {#claude}


```json
{
  "mcpServers": {
    "libretranslate": {
      "command": "npx",
      "args": ["-y", "@libretranslate/mcp"],
      "env": {
        "LIBRETRANSLATE_API_URL": "https://libretranslate.com",
        "LIBRETRANSLATE_API_KEY": "your-api-key"
      }
    }
  }
}
```

| Variabile                | Descrizione                                                                      |
| ------------------------ | -------------------------------------------------------------------------------- |
| `LIBRETRANSLATE_API_URL` | URL dell'API di LibreTranslate (predefinito: `https://libretranslate.com`)         |
| `LIBRETRANSLATE_API_KEY` | Chiave API per il servizio LibreTranslate (richiesta per `libretranslate.com`) |



## Strumenti disponibili {#strumenti-disponibili}



### [`detect`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-detect-tool) {#detect}


Rileva la lingua di un dato testo.


### [`translate`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-translate-tool) {#translate}


Traduci il testo da una lingua all'altra.


### [`languages`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-languages-tool) {#languages}


Elenca tutte le lingue supportate per la traduzione.

Vedi [LibreTranslate-MCP](https://github.com/LibreTranslate/LibreTranslate-MCP) per i dettagli d'implementazione.



## Strumenti ed endpoint HTTP {#strumenti-ed-endpoint-http}


| MCP | Argomenti | Richiesta HTTP |
| --- | --- | --- |
| [`detect`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-detect-tool) | `text` | [`POST /detect`](https://sourcey-libretranslate.pages.dev/it/api/operations/detect/index.md) |
| [`translate`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-translate-tool) | `text`, `source`, `target` | [`POST /translate`](https://sourcey-libretranslate.pages.dev/it/api/operations/translate/index.md) |
| [`languages`](https://sourcey-libretranslate.pages.dev/it/mcp/index.md#operation-languages-tool) | None | [`GET /languages`](https://sourcey-libretranslate.pages.dev/it/api/operations/languages/index.md) |

Lo strumento `translate` richiede tre traduzioni alternative. Gli strumenti restituiscono JSON come testo in un blocco di contenuto MCP; le richieste non riuscite riportano `isError: true`.



> [!NOTE]
> **Dove avviene la traduzione**
>
> Il processo MCP viene eseguito sul tuo computer. La traduzione avviene sull’istanza LibreTranslate indicata da `LIBRETRANSLATE_API_URL`. Per usare una tua istanza, imposta il suo indirizzo; consulta la [guida all’hosting autonomo](https://sourcey-libretranslate.pages.dev/it/guides/installation/index.md).
