Skip to main content
Glama
cpfhub

CPFHub MCP Server

Official
by cpfhub

cpfhub-mcp: Official MCP Server for CPFHub.io

🇺🇸 English | 🇧🇷 Português

Official Model Context Protocol (MCP) server for CPFHub.io — Brazilian CPF Lookup API for AI agents.

npm version License: MIT


What is CPFHub.io?

CPFHub.io is a REST API that returns identity data — full name, gender, and date of birth — from any Brazilian CPF number, in ~300ms, with 99.9% uptime and full LGPD compliance.

10M+ CPFs queried · 1,300+ active companies · 99.9% uptime


Related MCP server: mcp-brasil

Tools

This MCP server exposes the following tools:

Tool

Description

get_person_by_cpf

Retrieve identity data (full name, gender, date of birth) from a Brazilian CPF number

get_quota_information

Retrieve remaining API credits and current plan status

Tool Definition

{
  "name": "get_person_by_cpf",
  "description": "Retrieve identity data from a Brazilian CPF number",
  "parameters": {
    "type": "object",
    "properties": {
      "cpf": {
        "type": "string",
        "description": "Brazilian CPF number (digits only or formatted as XXX.XXX.XXX-XX)"
      }
    },
    "required": ["cpf"]
  }
}

Quick Start

# Set your API key
export CPFHUB_API_KEY=your_api_key_here

# Run the MCP server directly with npx (no install needed)
npx @cpfhub/mcp

Get your free API key at app.cpfhub.io — no credit card required.


curl Example

curl -X GET "https://api.cpfhub.io/cpf/12345678909" \
  -H "x-api-key: YOUR_API_KEY"

Response:

{
  "success": true,
  "data": {
    "cpf": "12345678909",
    "name": "Fulano de Tal",
    "nameUpper": "FULANO DE TAL",
    "gender": "M",
    "birthDate": "15/06/1990",
    "day": 15,
    "month": 6,
    "year": 1990
  }
}

Configuration

Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "cpfhub": {
      "command": "npx",
      "args": ["-y", "@cpfhub/mcp"],
      "env": {
        "CPFHUB_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Cursor

  1. Go to Settings > Features > MCP.

  2. Click + Add New MCP Server.

  3. Name: CPFHub

  4. Type: command

  5. Command: export CPFHUB_API_KEY=YOUR_API_KEY_HERE && npx -y @cpfhub/mcp

Windsurf

Add to your MCP configuration file:

{
  "mcpServers": {
    "cpfhub": {
      "command": "npx",
      "args": ["-y", "@cpfhub/mcp"],
      "env": {
        "CPFHUB_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

OpenAI Function Calling Example

import os
import json
import requests
from openai import OpenAI

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
CPFHUB_API_KEY = os.environ["CPFHUB_API_KEY"]

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_person_by_cpf",
            "description": "Retrieve identity data from a Brazilian CPF number",
            "parameters": {
                "type": "object",
                "properties": {
                    "cpf": {"type": "string", "description": "Brazilian CPF number"}
                },
                "required": ["cpf"],
            },
        },
    }
]

def get_person_by_cpf(cpf: str) -> dict:
    response = requests.get(
        f"https://api.cpfhub.io/cpf/{cpf.replace('.', '').replace('-', '')}",
        headers={"x-api-key": CPFHUB_API_KEY},
    )
    return response.json()

messages = [{"role": "user", "content": "Who is the person with CPF 123.456.789-09?"}]
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
message = response.choices[0].message

if message.tool_calls:
    args = json.loads(message.tool_calls[0].function.arguments)
    result = get_person_by_cpf(args["cpf"])
    print(result)

LangChain Example

See examples/langchain_example.py for a full LangChain agent integration example.


Requirements



License

MIT © CPFHub.io


Português

🇺🇸 English | 🇧🇷 Português

Servidor Model Context Protocol (MCP) oficial para CPFHub.io — API de Consulta de CPF Brasileiro para agentes de IA.


O que é o CPFHub.io?

O CPFHub.io é uma API REST que retorna dados de identidade — nome completo, gênero e data de nascimento — de qualquer CPF brasileiro, em ~300ms, com 99,9% de uptime e total conformidade com a LGPD.

10M+ CPFs consultados · 1.300+ empresas ativas · 99,9% uptime


Ferramentas (Tools)

Este servidor MCP expõe as seguintes ferramentas:

Ferramenta

Descrição

get_person_by_cpf

Recupera dados de identidade (nome completo, gênero, data de nascimento) a partir de um CPF brasileiro

get_quota_information

Recupera os créditos de API restantes e o status do plano atual

Definição da Ferramenta

{
  "name": "get_person_by_cpf",
  "description": "Retrieve identity data from a Brazilian CPF number",
  "parameters": {
    "type": "object",
    "properties": {
      "cpf": {
        "type": "string",
        "description": "Brazilian CPF number (digits only or formatted as XXX.XXX.XXX-XX)"
      }
    },
    "required": ["cpf"]
  }
}

Início Rápido

# Configure sua chave de API
export CPFHUB_API_KEY=sua_chave_de_api_aqui

# Execute o servidor MCP diretamente com npx (sem instalação)
npx @cpfhub/mcp

Obtenha sua chave de API gratuita em app.cpfhub.io — sem cartão de crédito.


Exemplo curl

curl -X GET "https://api.cpfhub.io/cpf/12345678909" \
  -H "x-api-key: SUA_CHAVE_DE_API"

Resposta:

{
  "success": true,
  "data": {
    "cpf": "12345678909",
    "name": "Fulano de Tal",
    "nameUpper": "FULANO DE TAL",
    "gender": "M",
    "birthDate": "15/06/1990",
    "day": 15,
    "month": 6,
    "year": 1990
  }
}

Configuração

Claude Desktop

Adicione o seguinte ao seu claude_desktop_config.json:

{
  "mcpServers": {
    "cpfhub": {
      "command": "npx",
      "args": ["-y", "@cpfhub/mcp"],
      "env": {
        "CPFHUB_API_KEY": "SUA_CHAVE_DE_API_AQUI"
      }
    }
  }
}

Cursor

  1. Acesse Settings > Features > MCP.

  2. Clique em + Add New MCP Server.

  3. Nome: CPFHub

  4. Tipo: command

  5. Comando: export CPFHUB_API_KEY=SUA_CHAVE_DE_API_AQUI && npx -y @cpfhub/mcp

Windsurf

Adicione ao seu arquivo de configuração MCP:

{
  "mcpServers": {
    "cpfhub": {
      "command": "npx",
      "args": ["-y", "@cpfhub/mcp"],
      "env": {
        "CPFHUB_API_KEY": "SUA_CHAVE_DE_API_AQUI"
      }
    }
  }
}

Exemplo com OpenAI Function Calling

import os
import json
import requests
from openai import OpenAI

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
CPFHUB_API_KEY = os.environ["CPFHUB_API_KEY"]

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_person_by_cpf",
            "description": "Retrieve identity data from a Brazilian CPF number",
            "parameters": {
                "type": "object",
                "properties": {
                    "cpf": {"type": "string", "description": "Brazilian CPF number"}
                },
                "required": ["cpf"],
            },
        },
    }
]

def get_person_by_cpf(cpf: str) -> dict:
    response = requests.get(
        f"https://api.cpfhub.io/cpf/{cpf.replace('.', '').replace('-', '')}",
        headers={"x-api-key": CPFHUB_API_KEY},
    )
    return response.json()

messages = [{"role": "user", "content": "Quem é a pessoa com CPF 123.456.789-09?"}]
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)
message = response.choices[0].message

if message.tool_calls:
    args = json.loads(message.tool_calls[0].function.arguments)
    result = get_person_by_cpf(args["cpf"])
    print(result)

Exemplo com LangChain

Veja examples/langchain_example.py para um exemplo completo de integração com agente LangChain.


Requisitos

  • Node.js 18 ou superior

  • Uma chave de API válida de app.cpfhub.io



Licença

MIT © CPFHub.io

Available Tools

2 tools
get_person_by_cpfA

Retrieve identity data (full name, gender, and date of birth) from a Brazilian CPF number.

ParametersJSON Schema
NameRequiredDescriptionDefault
cpfYesBrazilian CPF number (digits only or formatted as XXX.XXX.XXX-XX)

TDQS

A3.5/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 only states 'retrieve' implying read-only, but does not disclose error handling, authentication needs, rate limits, or behavior on invalid CPFs. This is insufficient transparency.

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?

A single sentence with no wasted words, front-loading the key action and result. Very concise and efficient.

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?

For a simple lookup tool with one parameter and no output schema, the description is mostly adequate. However, it does not mention error scenarios or return behavior for invalid CPFs, leaving some gaps.

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 100% as the CPF parameter has a description. The tool description does not add extra meaning beyond what the schema already provides. Baseline 3 is appropriate.

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 clearly states the tool's purpose: retrieving identity data (full name, gender, date of birth) from a Brazilian CPF number. It uses a specific verb and resource, and the sibling tool 'get_quota_information' is unrelated, so differentiation is 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?

The description implies the tool is for looking up a person by CPF, but does not provide explicit guidance on when to use it vs alternatives, no prerequisites, and no exclusions. It is adequate but lacks explicit context.

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

get_quota_informationA

Retrieve the remaining API credits and current plan status for the authenticated account.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

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

No annotations provided, so the description carries the full burden. It correctly indicates a read operation but does not disclose rate limits, authentication specifics beyond 'authenticated account', or behavior when no credits remain.

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 a single, clear sentence with no extraneous information, earning its place.

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

Completeness4/5

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

Given no parameters, output schema, or annotations, the description is sufficiently complete for a simple retrieval tool. It could mention format or limits, but is adequate.

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?

No parameters exist, and schema coverage is 100% (empty). The description adds value by specifying return values (remaining credits and plan status), exceeding the baseline of 3.

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 clearly states the tool retrieves remaining API credits and current plan status, using a specific verb+resource. It is easily distinguishable from the sibling tool get_person_by_cpf which deals with person data.

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

Usage Guidelines4/5

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

The description implies usage for the authenticated account, providing clear context. However, it does not explicitly state when not to use this tool vs alternatives, though the sibling tool is unrelated.

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. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.1
    • First observedget_person_by_cpf
    • First observedget_quota_information

TDQS

A3.8/5.0
Disambiguation5/5

The two tools serve completely different purposes: one retrieves personal data from a CPF, the other checks API quota. There is no overlap or ambiguity.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern using snake_case (get_person_by_cpf, get_quota_information). The naming is clear and predictable.

Tool Count3/5

With only 2 tools, the server feels thin for a service called 'CPFHub', which implies a broader range of CPF-related operations. However, the tools are focused and may be sufficient for a narrow use case.

Completeness3/5

The server provides only one data retrieval tool for CPF lookup and a quota tool. Missing operations like CPF validation or list/update functions are notable gaps for a CPF-focused server, but the core lookup is covered.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    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.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server that connects AI agents to 28 Brazilian public APIs, providing tools to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables querying basic Brazilian CPF registration data (name, status, birth date) via a hosted MCP server with a single read-only tool, usable from any MCP client.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables querying the Brazilian Federal Revenue registration status of an individual using CPF and birth date, with a read-only MCP tool accessible from various AI clients.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cpfhub/cpfhub-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server