Vai al contenuto
TerraLabTerraLabDocs

Per iniziare

Markdown

Quickstart

Due percorsi: chiamare l'API REST dal codice, oppure aggiungere il server MCP a un agente AI. Entrambi usano lo stesso account e le stesse 100 chiamate gratuite al mese.

Chiamare l'API dal codice

Creare una chiave API

  1. Accedi su terra-lab.ai/login. Un account è gratuito e non richiede carta.
  2. Apri Dashboard, MCP, poi Advanced, API keys.
  3. Dai un nome alla chiave, accetta i termini dell'API e clicca Create key.
  4. Copia subito la chiave: inizia con tlk_ e viene mostrata una sola volta.

Conservala in una variabile d'ambiente, mai nel codice:

export TERRALAB_API_KEY="tlk_your_key_here"

Verificare la chiave

GET /v1/me restituisce il tuo account e le chiamate che ti restano questo mese.

curl https://mcp.terra-lab.ai/v1/me \
  -H "Authorization: Bearer $TERRALAB_API_KEY"

Un 401 significa che la chiave manca, contiene un errore o è stata revocata.

Fare la prima chiamata a un tool

Trova le coordinate di un indirizzo con find_places:

curl -X POST https://mcp.terra-lab.ai/v1/tools/find_places \
  -H "Authorization: Bearer $TERRALAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"12 rue de la Paix, Annecy"}'
import os
import requests

response = requests.post(
    "https://mcp.terra-lab.ai/v1/tools/find_places",
    headers={"Authorization": f"Bearer {os.environ['TERRALAB_API_KEY']}"},
    json={"query": "12 rue de la Paix, Annecy"},
    timeout=120,
)
response.raise_for_status()
print(response.json()["structuredContent"])
const response = await fetch('https://mcp.terra-lab.ai/v1/tools/find_places', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.TERRALAB_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ query: '12 rue de la Paix, Annecy' }),
});
const data = await response.json();
console.log(data.structuredContent);

La risposta è un oggetto JSON: structuredContent contiene il risultato con le sue sources, content lo stesso risultato come testo, e isError indica se il tool ha rifiutato la richiesta.

Andare oltre

Aggiungere TerraLab a un agente AI

In Claude Code, un solo comando:

claude mcp add --transport http terralab https://mcp.terra-lab.ai/mcp

Poi esegui /mcp in Claude Code e accedi a TerraLab. Per Claude, ChatGPT, Cursor, Codex e VS Code, vedi Server MCP.

Prova a chiedere, per esempio: "Mostra gli edifici entro 500 m dalla stazione di Lyon Part-Dieu e dammi un GeoPackage."

Aggiornato il 2026-10-27