mcpField
F
FastAPI NCM Attributes Tool

FastAPI NCM Attributes Tool

Local
github.com/TulioCMPDeveloper Tools0Updated 79w ago

About FastAPI NCM Attributes Tool

A FastAPI application for searching NCM codes and retrieving their associated attributes. It serves developers and AI integrations through REST endpoints and an MCP tool, backed by PostgreSQL.

Key features

  1. 01Search NCM codes by code or description
  2. 02Retrieve attributes and possible values
  3. 03REST API with documented endpoints
  4. 04PostgreSQL-backed data access

Use cases

  1. 01Find NCM codes from a code or description
  2. 02Retrieve attributes for a specific NCM code
  3. 03Use NCM attribute lookup in AI interactions

MCP support

It provides the `get_ncm_attributes_tool` MCP tool to retrieve attributes for an NCM code.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

FastAPI NCM Attributes Tool

This application provides a FastAPI-based API for retrieving information about NCM (Nomenclatura Comum do Mercosul) codes and their associated attributes.

Features

  • Search for NCM codes by code or description
  • Retrieve all attributes for a specific NCM code with their possible values
  • RESTful API endpoints with proper documentation
  • MCP server integration for AI interaction

Database Structure

The application uses a PostgreSQL database with the following main tables:

  • ncm: Contains NCM codes and descriptions
  • ncm_attributes: Contains attributes associated with NCM codes
  • attribute: Contains attribute definitions

API Endpoints

NCM Attributes
  • GET /ncm/{ncm_code}/attributes: Get all attributes for a specific NCM code
  • GET /ncm/search?query={search_term}: Search for NCM codes by code or description
MCP Tools
  • get_ncm_attributes_tool: MCP tool to get attributes for an NCM code

Example Usage

import requests

# Search for NCM codes
response = requests.get("http://localhost:8000/ncm/search?query=1234")
results = response.json()

# Get attributes for a specific NCM code
response = requests.get("http://localhost:8000/ncm/1234.56.78/attributes")
attributes = response.json()

Architecture

The application follows a clean architecture with:

  • Models: SQLAlchemy models representing database tables
  • Repositories: Handle database operations
  • Services: Implement business logic
  • Schemas: Pydantic models for request/response validation
  • API Routes: FastAPI endpoints for HTTP interaction

Running the Application

# Run the application
uvicorn main:app --reload --host 0.0.0.0 --port 8000

# Access the API documentation
# Open in browser: http://localhost:8000/docs
``` # fastapi-mcp-server
# fastapi-mcp-server

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.