mcp-brasil is Trending — Here's How to Add AI Image Generation to Brazilian APIs
mcp-brasil just exploded on GitHub with 373+ stars, exposing 28 Brazilian public APIs to AI assistants. Learn how to supercharge those workflows with AI image generation and Portuguese TTS using NexaAPI at $0.003/image.
⚡ TL;DR
- • mcp-brasil = 28 Brazilian public APIs (IBGE, CNPJ, TSE, DataJud, INPE...) exposed to AI assistants via MCP
- • NexaAPI = AI image generation ($0.003/image), Portuguese TTS, video generation
- • Combined: Brazilian data + AI generation = powerful apps
- • Free tier: 100 images free at rapidapi.com/user/nexaquency
What Is mcp-brasil?
mcp-brasil is a production-ready MCP (Model Context Protocol) server that exposes 28 Brazilian government APIs with 213 tools to AI assistants like Claude, GPT, and GitHub Copilot.
Brazilian developers can now ask their AI assistant natural-language questions like:
💬 "Quais os 10 maiores contratos do governo federal em 2024?"
💬 "Qual a tendência da taxa Selic nos últimos 12 meses?"
💬 "Busque processos sobre licitação irregular no TCU."
pip install mcp-brasil # or uv add mcp-brasil
The 28 APIs include IBGE (census data), Banco Central (Selic, IPCA), Câmara dos Deputados, Senado Federal, Portal da Transparência, DataJud/CNJ (court cases), TSE (elections), INPE (deforestation), BrasilAPI (CNPJ, CEP), and 19 more.
The Missing Piece: AI Generation
mcp-brasil is brilliant for reading Brazilian data. But what if you want to generate content based on that data?
For all of this, you need an AI inference layer. That's where NexaAPI fits perfectly.
Enter NexaAPI: $0.003/Image
NexaAPI is a unified AI inference API — 50+ models (Flux Pro, Stable Diffusion 3.5, Veo 3, Whisper, TTS) through a single OpenAI-compatible API key. Available on RapidAPI.
| Provider | Image | TTS (per 1K chars) |
|---|---|---|
| NexaAPI | $0.003 | $0.015 |
| OpenAI DALL-E 3 | $0.04 | $0.015 |
| Stability AI | $0.02 | N/A |
| ElevenLabs | N/A | $0.30 |
NexaAPI is 10x cheaper for image generation. Free tier: 100 images at rapidapi.com/user/nexaquency.
Python Tutorial: IBGE + AI Image
# pip install nexaapi requests
from nexaapi import NexaAPI
import requests
# Get free key: https://rapidapi.com/user/nexaquency
client = NexaAPI(api_key='YOUR_RAPIDAPI_KEY')
def get_city_info(city_code):
"""Fetch Brazilian city from IBGE (mcp-brasil pattern)"""
url = f'https://servicodados.ibge.gov.br/api/v1/localidades/municipios/{city_code}'
return requests.get(url).json()
def generate_city_image(city_name, state):
"""Generate AI image — only $0.003!"""
result = client.image.generate(
model='flux-schnell',
prompt=f'Beautiful aerial view of {city_name}, {state}, Brazil, photorealistic',
width=1024,
height=1024
)
return result.image_url
def generate_portuguese_tts(text):
"""Generate Brazilian Portuguese TTS"""
result = client.audio.tts(
text=text,
voice='pt-BR-female',
model='tts-multilingual'
)
return result.audio_url
# Combined workflow
city = get_city_info(3550308) # São Paulo
image_url = generate_city_image(city['nome'], 'São Paulo')
print(f"✅ Image: {image_url}") # Cost: $0.003
tts_url = generate_portuguese_tts(f"Bem-vindo a {city['nome']}!")
print(f"✅ TTS: {tts_url}")JavaScript Tutorial: CNPJ + Company Image
// npm install nexaapi axios
import NexaAPI from 'nexaapi';
import axios from 'axios';
// Get free key: https://rapidapi.com/user/nexaquency
const client = new NexaAPI({ apiKey: 'YOUR_RAPIDAPI_KEY' });
async function getCNPJInfo(cnpj) {
const { data } = await axios.get(
`https://brasilapi.com.br/api/cnpj/v1/${cnpj}`
);
return data;
}
async function generateCompanyImage(companyName, city) {
const result = await client.image.generate({
model: 'flux-schnell',
prompt: `Professional headquarters of ${companyName} in ${city}, Brazil, modern architecture`,
width: 1024,
height: 768
});
return result.imageUrl; // Only $0.003!
}
// Run it
const company = await getCNPJInfo('33000167000101');
const imageUrl = await generateCompanyImage(
company.razao_social,
company.municipio
);
console.log(`Generated: ${imageUrl}`);Resources
Start Building with Brazilian APIs + AI
Free tier: 100 images, no credit card required.