An AI agent that answers questions about Chile or Latin America needs real data: today's UF, the observed dollar, the monetary policy rate, Colombia's TRM. Instead of writing one integration per source, you can connect your agent to the Better Llama MCP and get 15 ready-made tools, with the official source and date in every answer. This tutorial shows how in the three most used agent frameworks: LangChain (and LangGraph), the OpenAI Agents SDK and the Vercel AI SDK.
All the code comes verbatim from our examples repository on GitHub, and every output comes from real runs against the production MCP on November 26, 2026 at 10:20 (Chile time). No invented numbers.
What you need
- The MCP:
https://mcp.betterllama.com/mcp(Streamable HTTP). The beta is free and needs no sign-up or key for these tools. - Python (with one virtual environment per example) or Node.js 18 or later for the Vercel AI SDK.
- A model provider key (for example
OPENAI_API_KEY) only for the agent step. Listing tools and calling them directly needs none.
The three examples follow the same pattern: (1) connect and list the tools, (2) call get_chile_financial_indicators directly, without a model, to see the data, and (3) hand the tools to an agent so it picks which one to use.
LangChain and LangGraph
The langchain-mcp-adapters package turns every MCP tool into a LangChain tool. Install it in its own environment, because it depends on version 1.x of the MCP SDK:
pip install -r requirements-langchain.txtConnection, tool list and direct call (excerpt from python/langchain_agent.py):
from langchain_mcp_adapters.client import MultiServerMCPClient
URL = "https://mcp.betterllama.com/mcp"
client = MultiServerMCPClient({
"better-llama": {"transport": "streamable_http", "url": URL},
})
tools = await client.get_tools()
by_name = {t.name: t for t in tools}
print(f"{len(tools)} LangChain tools from {URL}:")
for source in ("uf", "dolar"):
data = as_json(await by_name["get_chile_financial_indicators"].ainvoke({"source": source}))
row = data["results"][-1]
print(f"CMF {source:5} {row['date']} {row['value']}")Real output of python langchain_agent.py:
15 LangChain tools from https://mcp.betterllama.com/mcp:
chile_calendar_and_rut, chilexpress_shipping, colombia_secop_search, colombia_trm, find_chile_fuel_prices, get_chile_central_bank_series, get_chile_earthquakes, get_chile_electricity_market, get_chile_financial_indicators, get_santiago_stock_exchange_data, mexico_banxico_indicators, peru_bcrp_series, search_chile_official_gazette, search_chile_public_tenders, search_tools
CMF uf 2026-11-26 41412.34
CMF dolar 2026-11-26 1044.08
BCCh TPM 2026-11-26 4.5 %
Set OPENAI_API_KEY (or LLM_MODEL + your provider key) to run the agent step.For the agent, the same tool list goes into LangChain 1.x create_agent, which runs on LangGraph. Pick the model with LLM_MODEL (any init_chat_model id):
from langchain.agents import create_agent # pip install langchain
agent = create_agent(model, tools, system_prompt=(
"Answer with data from the Better Llama tools. If unsure which tool to use, call search_tools first. "
"Always state the date of each value and the source."))
out = await agent.ainvoke({"messages": [{"role": "user", "content": question}]})OpenAI Agents SDK
The OpenAI Agents SDK ships its own MCP client. With MCPServerStreamableHttp you connect to the server and pass it to the agent in mcp_servers; the SDK discovers the tools by itself.
pip install -r requirements-openai-agents.txtExcerpt from python/openai_agents_sdk.py:
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp
URL = "https://mcp.betterllama.com/mcp"
async with MCPServerStreamableHttp(
name="better-llama",
params={"url": URL},
cache_tools_list=True,
client_session_timeout_seconds=60,
) as server:
tools = await server.list_tools()
print(f"{len(tools)} MCP tools from {URL}:")
for source in ("uf", "dolar"):
data = as_json(await server.call_tool("get_chile_financial_indicators", {"source": source}))
row = data["results"][-1]
print(f"CMF {source:5} {row['date']} {row['value']}")Real output of python openai_agents_sdk.py:
15 MCP tools from https://mcp.betterllama.com/mcp:
chile_calendar_and_rut, chilexpress_shipping, colombia_secop_search, colombia_trm, find_chile_fuel_prices, get_chile_central_bank_series, get_chile_earthquakes, get_chile_electricity_market, get_chile_financial_indicators, get_santiago_stock_exchange_data, mexico_banxico_indicators, peru_bcrp_series, search_chile_official_gazette, search_chile_public_tenders, search_tools
CMF uf 2026-11-26 41412.34
CMF dolar 2026-11-26 1044.08
BCCh TPM 2026-11-26 4.5 %
Set OPENAI_API_KEY to run the agent step.With OPENAI_API_KEY set, the script builds the agent and passes it the server:
agent = Agent(
name="Chile data assistant",
instructions=(
"Answer with data from the Better Llama tools. If unsure which tool to use, call search_tools first. "
"Always state the date of each value and the source."),
model=os.environ.get("LLM_MODEL", "gpt-4.1-mini"),
mcp_servers=[server],
)
result = await Runner.run(agent, question)Vercel AI SDK
In the Vercel AI SDK (version 7) the MCP client lives in @ai-sdk/mcp. client.tools() returns the server tools as AI SDK tools, with their schemas, ready for generateText or streamText. In AI SDK 5 the function was called experimental_createMCPClient and shipped in ai.
cd node && npm installExcerpt from node/vercel_ai_sdk.mjs:
import { createMCPClient } from "@ai-sdk/mcp";
import { generateText, stepCountIs } from "ai";
const MCP = "https://mcp.betterllama.com/mcp";
const client = await createMCPClient({ transport: { type: "http", url: MCP } });
try {
const tools = await client.tools();
const names = Object.keys(tools);
console.log(`${names.length} tools: ${names.join(", ")}\n`);
const opts = { toolCallId: "direct", messages: [] };
for (const source of ["uf", "dolar"]) {
data = toolJson(await tools.get_chile_financial_indicators.execute({ source, period: "current" }, opts));
const result = await generateText({ model, tools, prompt, stopWhen: stepCountIs(5) });
} finally {
await client.close();
}Real output of node vercel_ai_sdk.mjs --mock. Since this run used no model key, --mock swaps the model for the mock from ai/test: the tool call is real against the MCP and the mock writes the final answer from the value it got back.
15 tools: search_tools, search_chile_public_tenders, get_chile_financial_indicators, get_chile_central_bank_series, find_chile_fuel_prices, chilexpress_shipping, get_chile_electricity_market, search_chile_official_gazette, get_chile_earthquakes, get_santiago_stock_exchange_data, chile_calendar_and_rut, colombia_secop_search, colombia_trm, peru_bcrp_series, mexico_banxico_indicators
CMF Chile (get_chile_financial_indicators):
Unidad de Fomento (UF): 41.412,34 CLP (2026-11-26)
Dólar observado (USD): 1.044,08 CLP (2026-11-26)
Fuente: Comisión para el Mercado Financiero (CMF Chile), API CMF Bancos — https://www.cmfchile.cl
Colombia - TRM (colombia_trm):
3.630,89 COP por 1 USD, 2026-11-26 .. 2026-11-27
Fuente: Superintendencia Financiera de Colombia vía datos.gov.co (Portal de Datos Abiertos www.datos.gov.co, conjunto "Tasa de Cambio Representativa del Mercado - TRM", 32sa-8pi3). Licencia CC BY-SA 4.0. La fecha de última actualización del conjunto viene en sourceUpdatedAt.
tool call: get_chile_financial_indicators({"source":"uf","period":"current"})
tool result: {"content":[{"type":"text","text":"{\"tool\":\"get_chile_financial_indicators\",\"count\":1,\"results\":[{\"indicator\":\"uf\",\"indicatorName\":\"Unidad de Fomento (UF)\",\"date\":\"2026-11-26\",\"ye...
Answer: (mock) UF 41412.34 CLP al 2026-11-26.What the three returned
All three frameworks got the same 15 tools and the same November 26, 2026 data: UF CLP 41,412.34 and observed dollar CLP 1,044.08 (CMF), policy rate 4.5% (Central Bank of Chile) and, in the Vercel example, Colombia's TRM at 3,630.89 Colombian pesos per dollar (valid November 26 to 27, Financial Superintendence via datos.gov.co).
| Framework | Tested versions | How it connects | File |
|---|---|---|---|
| LangChain / LangGraph | langchain-mcp-adapters 0.3.2, langchain 1.5.2 | MultiServerMCPClient + get_tools() | python/langchain_agent.py |
| OpenAI Agents SDK | openai-agents 0.26.0 | MCPServerStreamableHttp + mcp_servers=[server] | python/openai_agents_sdk.py |
| Vercel AI SDK | ai 7.0.183, @ai-sdk/mcp 2.0.106 | createMCPClient + client.tools() | node/vercel_ai_sdk.mjs |
Production tips
- Answers are JSON inside a text block. That is why the examples have an
as_jsonortoolJsonhelper. Every answer includesattributionwith the official source; ask the agent to cite it along with the data date. - Use
search_toolswhen the agent does not know which tool to call: it searches by topic or country and returns the tools that fit. That way you can hand over all 15 tools without writing instructions for each. - Test without a model first. Calling the tools directly, as in step 2 of each example, separates connection problems from prompt problems.
- Some tools use your own free key (for example Mercado Público or Banxico). It is sent as an HTTP header in the MCP client config; the indicators in this tutorial do not need one.
Next steps
The examples repository also has the official MCP SDK client in Python and Node, an n8n workflow with MCP (step by step) and configs for Claude Code, Codex, Gemini CLI and Windsurf. To understand the data behind each tool, continue with the Chile economic indicators guide, the observed dollar guide, the Colombia TRM guide or the article how to connect AI agents to public data with one MCP.