MCP Portal Transparencia logo

MCP Portal Transparencia

Community
dutradotdev

MCP para orquestração automatizada de chamadas à API do Portal da Transparência do Governo Federal brasileiro

Publisherdutradotdev
Repositorymcp-portal-transparencia
LanguageHTML
Forks
35
Stars
224
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MCP Portal Transparencia exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    224 stars and 35 forks from the linked repository.

MCP Portal da Transparência Brasil

npm version License: MIT TypeScript

Um MCP Server que fornece acesso programático à API do Portal da Transparência do Governo Federal brasileiro através do protocolo MCP.

Este projeto apenas consome dados públicos disponibilizados pelo governo federal. Nenhum dado privado é armazenado ou exposto além do que já é acessível por qualquer cidadão via Portal da Transparência.

📋 Sobre o Projeto

Este projeto implementa um MCP Server que oferece acesso inteligente e estruturado a todos os endpoints disponíveis na API do Portal da Transparência (https://api.portaldatransparencia.gov.br/v3/api-docs). O sistema oferece:

  • Integração MCP Completa com suporte a Claude Desktop, Cursor e outras UIs compatíveis
  • Geração Dinâmica de Ferramentas a partir do Swagger/OpenAPI
  • Autenticação Simplificada com suporte a API Key via variáveis de ambiente
  • Tratamento Robusto de Erros com mensagens amigáveis em português
  • Logs Estruturados em JSON para monitoramento
  • Suporte a NPX para execução direta sem instalação

🚀 Funcionalidades

✅ Características Principais

  • 🔄 Geração Dinâmica de Ferramentas MCP a partir do Swagger V3
  • 🏗️ Categorização Inteligente de endpoints por área (servidores, contratos, etc.)
  • 🔐 Sistema de Autenticação via variável de ambiente PORTAL_API_KEY
  • 📊 Logging Estruturado com métricas detalhadas
  • 🔧 Tratamento de Erros com mensagens amigáveis em português
  • 📚 Documentação Completa e exemplos práticos

🎯 Endpoints Suportados

O MCP Server fornece acesso a todos os endpoints do Portal da Transparência, incluindo:

  • Servidores - Dados do Poder Executivo Federal
  • Viagens - Consultas de viagens a serviço
  • Licitações - Informações sobre processos licitatórios
  • Contratos - Contratos do Poder Executivo Federal
  • Despesas - Gastos e empenhos governamentais
  • Benefícios - Programas sociais e beneficiários
  • Sanções - CNEP, CEIS e CEPIM
  • Convênios - Acordos e transferências
  • Imóveis - Imóveis funcionais
  • Emendas - Emendas parlamentares
  • Notas Fiscais - Documentos fiscais
  • Coronavírus - Dados específicos da pandemia

🛠️ Instalação

Uso via npx (Recomendado para MCP Server)

bash
# Executar MCP Server diretamente (para Claude Desktop, Cursor, etc.)
npx mcp-portal-transparencia-brasil

# Ou instalar globalmente
npm install -g mcp-portal-transparencia-brasil
mcp-portal-transparencia-brasil

Instalação local

bash
# Instalar via npm
npm install mcp-portal-transparencia-brasil

# Ou via yarn
yarn add mcp-portal-transparencia-brasil

⚙️ Configuração

Pré-requisitos

  • Node.js >= 16.0
  • Uma chave de API do Portal da Transparência (obrigatória)
  • Cliente MCP compatível (Claude Desktop, Cursor, etc.)

Configuração para Cursor

Adicione ao seu .cursor/mcp.json:

json
{
  "mcpServers": {
    "portal-transparencia": {
      "command": "npx",
      "args": ["mcp-portal-transparencia-brasil"],
      "env": {
        "PORTAL_API_KEY": "sua_api_key_aqui"
      }
    }
  }
}

Configuração para Claude Desktop

Adicione ao seu claude_desktop_config.json:

json
{
  "mcpServers": {
    "portal-transparencia": {
      "command": "npx",
      "args": ["mcp-portal-transparencia-brasil"],
      "env": {
        "PORTAL_API_KEY": "sua_api_key_aqui"
      }
    }
  }
}

🔍 Desenvolvimento com MCP Inspector

O MCP Inspector é uma ferramenta oficial que permite testar e desenvolver visualmente todas as ferramentas MCP em uma interface web interativa. É essencial para o desenvolvimento e debugging do projeto.

🚀 Como Usar o Inspector

  1. Obtenha uma API Key:

  2. Execute o Inspector:

    bash
    # Clone o repositório
    git clone https://github.com/dutradotdev/mcp-portal-transparencia
    cd mcp-portal-transparencia
    
    # Instale as dependências
    npm install
    
    # Execute o Inspector
    npm run inspector:direct
  3. Conecte ao Inspector:

    • Clique no link que aparece no terminal: Open inspector with token pre-filled
    • No navegador, com o link aberto, procure Add Environment Variable
    • Adicione a Key PORTAL_API_KEY e Value gerado no portal da transparência
    • Aperte connect
  4. Recursos do Inspector para Desenvolvimento:

    • 🔍 Filtros: Encontre ferramentas específicas rapidamente
    • 📝 Documentação: Veja detalhes de cada ferramenta
    • 🧪 Teste: Execute chamadas com diferentes parâmetros
    • 🐛 Debug: Visualize erros e respostas detalhadas
    • 💾 Histórico: Mantenha registro das chamadas realizadas

📝 Scripts NPM Disponíveis

bash
# Desenvolvimento
npm run dev          # Executar em modo desenvolvimento
npm run build        # Compilar TypeScript
npm run test        # Executar testes
npm run lint        # Verificar código
npm run format      # Formatar código

# MCP Inspector
npm run inspector          # Executar com arquivo de configuração
npm run inspector:direct   # Executar diretamente

🧪 Testes

bash
# Testes unitários
npm run test:unit

# Testes de integração
npm run test:integration

# Cobertura de testes
npm run test:coverage

📖 Uso via MCP (Recomendado)

O MCP Server permite usar o Portal da Transparência diretamente através de ferramentas como Claude Desktop, Cursor, e outras interfaces compatíveis com MCP.

Ferramentas Disponíveis

Após configurar o MCP Server, você terá acesso a todas as ferramentas geradas automaticamente:

  • portal_check_api_key - Verificar se a API key está configurada
  • portal_servidores_* - Consultar dados de servidores públicos
  • portal_viagens_* - Consultar viagens a serviço
  • portal_contratos_* - Consultar contratos públicos
  • portal_despesas_* - Consultar despesas públicas
  • portal_beneficios_* - Consultar programas sociais
  • E muitas outras...

Exemplos de Uso no Claude

🔍 Consultar servidores do Ministério da Fazenda
🎯 Buscar contratos acima de R$ 1 milhão
📊 Analisar despesas por órgão no último trimestre
🏛️ Verificar benefícios sociais por região

📖 Uso Programático (Biblioteca)

Importante: Não testei esse projeto como biblioteca. O foco era o MCP. Use como biblioteca por sua conta e risco. (PRs são bem-vindos)

typescript
import { PortalTransparenciaClient } from 'mcp-portal-transparencia-brasil';

// Inicializar o cliente
const client = new PortalTransparenciaClient({
  apiKey: process.env.PORTAL_API_KEY,
  enableRateLimitAlerts: true,
  logLevel: 'info',
});

// Exemplo: Consultar viagens por período
const viagens = await client.viagens.consultar({
  dataIdaDe: '01/01/2024',
  dataIdaAte: '31/01/2024',
  dataRetornoDe: '01/01/2024',
  dataRetornoAte: '31/01/2024',
  codigoOrgao: '26000',
  pagina: 1,
});

// Exemplo: Consultar servidores
const servidores = await client.servidores.consultar({
  orgaoServidorLotacao: '26000',
  pagina: 1,
});

// Exemplo: Buscar licitações
const licitacoes = await client.licitacoes.consultar({
  dataInicial: '01/01/2024',
  dataFinal: '31/01/2024',
  codigoOrgao: '26000',
  pagina: 1,
});

🤝 Contribuindo

  1. Faça um fork do projeto
  2. Crie uma branch para sua feature (git checkout -b feature/AmazingFeature)
  3. Commit suas mudanças (git commit -m 'Add some AmazingFeature')
  4. Push para a branch (git push origin feature/AmazingFeature)
  5. Abra um Pull Request

📄 Licença

Este projeto está licenciado sob a Licença MIT - veja o arquivo LICENSE para detalhes.

🔗 Links Úteis

Installation

TypingMind
{
  "mcpServers": {
    "mcp-portal-transparencia": {
      "command": "npx",
      "args": [
        "mcp-portal-transparencia-brasil"
      ],
      "env": {
        "PORTAL_API_KEY": "<PORTAL_API_KEY>"
      }
    }
  }
}

Use MCP Portal Transparencia MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Portal Transparencia is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Portal Transparencia as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Portal Transparencia MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-portal-transparencia": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-portal-transparencia-brasil"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Portal Transparencia MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Portal Transparencia MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Portal Transparencia to help me with this task?
MCP Portal Transparencia
Sure. I read it.
Here is what I found using MCP Portal Transparencia.

Frequently asked questions

What is the MCP Portal Transparencia MCP server used for?

MCP Portal Transparencia is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Portal Transparencia MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Portal Transparencia with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Portal Transparencia MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Portal Transparencia connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Portal Transparencia MCP to TypingMind?

MCP Portal Transparencia runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP Portal Transparencia MCP provide in TypingMind?

MCP Portal Transparencia exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Portal Transparencia MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Portal Transparencia requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇