Labsco
ruicarvalho1 logo

MCP NIF.PT

from ruicarvalho1

Query and analyze Portuguese companies using the NIF.PT public API. Supports search by NIF, company name, and city.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

MCP NIF.PT

This project implements an intelligent server based on FastMCP, allowing you to query and analyze information about Portuguese companies using the NIF.PT public API. It supports multiple useful tools such as search by NIF, company name or city, checking company status, and identifying accounting-related businesses.


Features

  • Retrieve complete company data by NIF
  • Check if a company is active or closed
  • Identify if a company is related to accounting
  • Search companies by name and city
  • Get the NIF based on the exact company name
  • Access external links (Google Maps, Racius, Portugalio)

Project Structure

.
β”œβ”€β”€ main.py                   
β”œβ”€β”€ models.py                
β”œβ”€β”€ nif_client.py             
β”œβ”€β”€ utils.py                
β”œβ”€β”€ requirements.txt          
β”œβ”€β”€ Dockerfile              
β”œβ”€β”€ package.json             
└── .smithery.profile.json    

Technologies Used

  • FastMCP
  • FastAPI
  • httpx
  • Pydantic
  • Docker
  • Python 3.10+

How to Run

Locally

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python main.py

The application uses transport="stdio" by default, making it compatible with Claude Desktop or terminal-based environments.


Output Format

The responses include details such as:

  • Nome, cidade, atividade e estado
  • Morada com link para Google Maps
  • Contactos (telefone, email, website)
  • CAE (CΓ³digo de Atividade EconΓ³mica)
  • LigaΓ§Γ΅es externas (Racius, Portugalio)

Claude Desktop Integration

To integrate this MCP with Claude Desktop:

  1. Install Claude Desktop
    Download and install from: https://claude.ai/download

  2. Open Configuration
    Go to File > Settings > Developer and click Edit Configuration

  3. Add the MCP server configuration
    In the claude_desktop_config.json, insert the following configuration:

{
  "mcpServers": {
    "nif-pt-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/YOUR/PROJECT/FOLDER",
        "run",
        "main.py"
      ]
    }
  }
}

Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT/FOLDER with the actual absolute path where your main.py file is located.

  1. Restart Claude Desktop
    After saving the configuration, restart Claude Desktop. Your nif-pt-server MCP should now be available in the Claude Desktop interface.

Author

Developed by Rui Carvalho.