Skip to main content
Glama
daniel-filius

apuracao-2026

Apuração Eleições 2026 (TSE) — servidor MCP + bot Telegram

Resultados oficiais e parciais das eleições brasileiras, direto dos arquivos públicos da divulgação do TSE (resultados.tse.jus.br), como tools MCP para Claude, Cursor, VS Code e qualquer cliente Model Context Protocol — e, opcionalmente, como bot inline do Telegram.

  • 1º turno: domingo 04/10/2026 · 2º turno: 25/10/2026

  • Sem chave, sem cadastro: o TSE publica os JSON abertamente. Este projeto só decifra os códigos (sp-c0003-e000xxx-r.json…), faz cache respeitoso (≥ 45 s por arquivo, If-Modified-Since) e normaliza a resposta.

  • Neutralidade: só números oficiais, sempre com apurado_pct e o horário do TSE. Nenhuma projeção, nenhum comentário, nenhum anúncio.

  • Listado em awesome-mcp-brasil — hub curado e auto-verificado de servidores MCP e skills brasileiros (categoria Eleições / Governo).

Instalar

Docker (imagem publicada em ghcr.io)

docker run -i --rm ghcr.io/daniel-filius/apuracao-2026-mcp:v0.1.0

Claude Desktop (claude_desktop_config.json) / Cursor / VS Code (mcp.json):

{
  "mcpServers": {
    "apuracao-2026": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/daniel-filius/apuracao-2026-mcp:v0.1.0"]
    }
  }
}

Sem Docker (Python 3.11+ e uv)

uvx --from git+https://github.com/daniel-filius/apuracao-2026-mcp apuracao-mcp
{
  "mcpServers": {
    "apuracao-2026": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/daniel-filius/apuracao-2026-mcp", "apuracao-mcp"]
    }
  }
}

Claude Code:

claude mcp add apuracao-2026 -- uvx --from git+https://github.com/daniel-filius/apuracao-2026-mcp apuracao-mcp
# ou
claude mcp add apuracao-2026 -- docker run -i --rm ghcr.io/daniel-filius/apuracao-2026-mcp:v0.1.0

Também está no registro MCP oficial como io.github.daniel-filius/apuracao-2026.

Related MCP server: onpe-mcp

Tools

Tool

O que devolve

listar_eleicoes()

Eleições ordinárias no config oficial do TSE (ciclo, código, data, turno, cargos por abrangência) e histórico disponível

resultado(uf, cargo, turno=1, ano=None, limite=20)

Parcial oficial por UF (SP, RJ…) ou BR (só presidente)

resumo_brasil(turno=1, ano=None)

Presidente, total nacional

municipio(uf, municipio, cargo, turno=1, ano=None)

Parcial oficial por município (nome exato, código IBGE ou código TSE)

Cargos: presidente, governador, senador, deputado_federal, deputado_estadual, deputado_distrital, prefeito, vereador.

Toda resposta inclui:

{
  "fonte": "TSE – divulgação oficial, resultado parcial",
  "atualizado_em": "04/10/2026 19:32:11",
  "apurado_pct": 87.31,
  "matematicamente_definido": false,
  "eleicao": {"ano": 2026, "turno": 1, "codigo": "…", "ciclo": "ele2026"},
  "cargo": "Governador", "abrangencia": "SP",
  "totais": {"votos_validos": 0, "brancos": 0, "nulos": 0, "abstencao_pct": 0.0, "…": "…"},
  "candidatos": [
    {"posicao": 1, "nome": "…", "numero": "10", "partido": "…", "votos": 0, "pct": 0.0, "situacao": "…", "eleito": false}
  ]
}

Exemplos de pergunta ao agente: "quem está na frente para governador do RS?", "como está a apuração para presidente?", "resultado de prefeito em Campinas em 2024".

Antes de o TSE publicar o pleito de 2026

Os códigos de 2026 só aparecem no config oficial (ele-c.json) perto da votação. Até lá, as tools explicam isso e você pode usar dados históricos: ano=2022 (Eleições Gerais, 1º/2º turno) e ano=2024 (municipais).

apuracao-mcp --smoke                 # lê o config do TSE e imprime o ciclo atual
apuracao-mcp --demo SP governador    # resultado normalizado (2022) sem iniciar o MCP

Bot Telegram (opcional)

@Apuracao2026Bot em qualquer grupo: @Apuracao2026Bot SP governador ou @Apuracao2026Bot br. Comandos: /start, /br, /uf SP [cargo].

O bot só sobe se existir APURACAO_BOT_TOKEN (ver .env.example); sem token ele sai imediatamente. Long polling, stdlib apenas, métricas anônimas (ids hasheados) em metrics.jsonl.

APURACAO_BOT_TOKEN=... apuracao-bot

Desenvolvimento

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest -q                       # fixtures reais do TSE (2022) em fixtures/
python -m apuracao_mcp.server   # stdio

Publicação: tag vX.Y.Z → workflow publish-mcp.yml roda os testes, publica a imagem em ghcr.io/daniel-filius/apuracao-2026-mcp e registra no registro MCP oficial via GitHub OIDC (server.json).

Apoie

Projeto voluntário, sem fins políticos e sem anúncios. Se foi útil na noite da apuração, um Pix ajuda a manter em 2028:

Pix copia-e-cola (valor livre):

00020101021226530014br.gov.bcb.pix0131danielfilho.workspace@gmail.com5204000053039865802BR5913DANIEL FILIUS6009SAO PAULO62160512APURACAO20266304CC54

Fonte e limites

  • Dados: divulgação oficial do TSE (https://resultados.tse.jus.br/oficial/…). Este projeto não é vinculado ao TSE. Números "parciais" podem mudar até a totalização final.

  • Cache: 45 s por arquivo de resultado, 5 min para o config, 1 h para a lista de municípios; sem varredura de todas as UFs a cada chamada.

  • User-Agent identifica o projeto.

Licença MIT.

Available Tools

4 tools
listar_eleicoesListar eleiçõesA

Lista as eleições ordinárias presentes no config oficial do TSE (ciclo, código, data, turno e cargos por abrangência) e o histórico disponível. Use antes de resultado se não souber qual pleito está no ar.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden. It discloses the data source (official TSE config), scope (ordinary elections and available history), and returned fields, while the verb 'Lista' implies a read-only operation. However, it does not explicitly state absence of side effects, permissions, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the tool's purpose and then the usage condition. Every sentence adds distinct value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be fully explained. With no parameters and no annotations, the description still gives enough context: what is listed, which data source is used, and when to call it instead of `resultado`.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so there is no parameter semantics to add. Per the baseline for zero-parameter tools, a 4 is appropriate; the description does not need to explain parameters and correctly focuses on output scope and usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Lista') and resource ('eleições ordinárias'), and names the fields returned (ciclo, código, data, turno, cargos). It also distinguishes itself from the sibling tool `resultado` by stating it should be used first when the active election is unknown.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says when to use the tool: before `resultado` if the user does not know which election is currently active. The alternative tool is named and the selecting condition is clear, leaving little to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

municipioResultado por municípioC

Resultado parcial oficial de um cargo em um município. municipio: nome exato, código IBGE (7 dígitos) ou código TSE. Ex.: municipio('SP', 'São Paulo', 'governador').

ParametersJSON Schema
NameRequiredDescriptionDefault
ufYes
anoNo
cargoYes
turnoNo
limiteNo
municipioYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It adds the useful qualifier 'parcial oficial' (partial, official tally) but says nothing about pagination (limite default 20), turno/year defaults, or whether results change over time as the count is finalized.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences plus a concrete example, front-loaded with the purpose. Efficient, though the example only reinforces what the first sentence already implies.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no explanation. However, for a 6-parameter, 3-required query tool with zero annotation and zero schema coverage, the description leaves most parameters and all usage guidance undocumented.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across 6 parameters, so the description must compensate. It documents seulement 'municipio' (exact name, 7-digit IBGE code, or TSE code), leaving uf, cargo, ano, turno and limite completely unexplained in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource: it returns the official partial result for a cargo within a municipality. It is clear what the tool does, but it does not distinguish itself from the sibling 'resultado' (also a result tool) or explain how it differs from 'resumo_brasil' / 'listar_eleicoes'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no indication of when to use this tool versus 'resultado', 'resumo_brasil' or 'listar_eleicoes'. The example invocation shows syntax but not the selection condition, so the agent must infer scope from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resultadoResultado por UFB

Resultado parcial oficial de um cargo em uma UF (ou BR para presidente). cargo: presidente, governador, senador, deputado_federal, deputado_estadual, deputado_distrital, prefeito, vereador. turno 1 ou 2. ano opcional (padrão: eleição ordinária mais próxima de hoje; 2022 para histórico).

ParametersJSON Schema
NameRequiredDescriptionDefault
ufYes
anoNo
cargoYes
turnoNo
limiteNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose a meaningful behavioral trait – results are 'parcial' (partial) and 'oficial' – and defines the ano defaulting rule. It says nothing about pagination, data freshness, or rate/auth constraints, so the disclosure is partial rather than complete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense, front-loaded, and telegraphic – the core purpose comes first, followed by the parameter notes. Slightly run-on due to stacked parentheticals, but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be described. Still, for a 5-parameter tool with 0% schema coverage, the omission of limite semantics and the lack of any sibling-routing guidance leaves gaps an agent would have to guess at.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate and it largely does: cargo values are fully enumerated, turno is bounded to 1/2, ano's default behavior is explained, and uf gets a hint ('BR' for president). The fifth parameter, limite (default 20), is never mentioned, leaving pagination semantics undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource: retrieve the official partial result for a given office (cargo) in a given state (UF), with the BR special case for president. This is clearly distinguishable from siblings like municipio (city-level) and resumo_brasil (national summary), though the sibling contrast is left implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It enumerates valid cargo values, restricts turno to 1 or 2, and explains the ano default, which is useful operational guidance. However, it never states when to prefer this tool over municipio or resumo_brasil, so the routing decision is only implied by the UF scope.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resumo_brasilResumo Brasil (presidente)B

Resultado parcial oficial para presidente, total nacional. turno 1 ou 2; ano opcional.

ParametersJSON Schema
NameRequiredDescriptionDefault
anoNo
turnoNo
limiteNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden. It discloses that results are 'parcial oficial' and national, but says nothing about read-only safety, authentication, rate limits, data freshness, or what 'limite' controls. Output schema exists, so return values need not be described, but safety and pagination context are absent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two telegraphic fragments with no wasted words; purpose is front-loaded before parameter hints. The brevity suits a simple lookup tool, and nothing extraneous is included.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so return format is covered. However, with zero schema descriptions and no annotations, the description leaves gaps: 'limite' is unexplained, usage versus sibling tools is only implied, and behavioral traits like pagination or authentication are absent. Adequate for basic invocation, but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds a meaningful constraint for 'turno' (1 or 2) and notes that 'ano' is optional, but completely omits 'limite', leaving one of three parameters undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States the resource precisely: official partial result for president, national total. Distinguishes from generic 'resultado' and 'municipio' siblings by specifying president/national scope. Lacks an explicit action verb but the title and noun phrase make the operation unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use statement. The scope ('para presidente, total nacional') implies the appropriate context and differentiates from sibling tools, but no alternatives or exclusions are named. Parameter constraints (turno, ano) are not usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedlistar_eleicoes
    • First observedmunicipio
    • First observedresultado
    • First observedresumo_brasil

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation4/5

Tools are mostly distinct by geographic scope: listar_eleicoes (election metadata), resultado (state-level results), resumo_brasil (national presidential summary), municipio (municipal results). However, resumo_brasil overlaps with resultado when cargo=presidente and UF=BR, which could cause confusion.

Naming Consistency3/5

One tool follows a verb_noun pattern (listar_eleicoes), while the others are nouns (resultado, resumo_brasil, municipio). The mix is readable but not a consistent convention.

Tool Count5/5

Four tools are well-scoped for a focused election results server: one for metadata, three for results at different geographic levels. Each tool earns its place without redundancy.

Completeness4/5

The surface covers listing elections, state-level results, national presidential summaries, and municipal results, with support for cargo, turno, and year. Minor gaps exist, such as candidate- or party-level drilldowns, but core retrieval workflows are covered.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server for querying Peruvian electoral data (ONPE) including mesa results, candidate votes, and regional statistics. Enables natural language queries about the 2026 presidential election with local SQLite cache and live API fallback.
    -
  • A
    license
    A
    quality
    D
    maintenance
    MCP Server for accessing 36 Brazilian public data sources and 1 agent, enabling AI agents to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.
    6
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables querying and retrieving Brazilian electoral clearance certificates (Certidão de Quitação Eleitoral) from the TSE using CPF, name, voter ID, birth date, and filiation. It provides a single read-only tool via MCP for integration with AI assistants.
    MIT