npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tariff-mcp

v1.0.2

Published

MCP server for international trade and tariff information

Downloads

5

Readme

MCP Tariff Server

A Model Context Protocol (MCP) server that provides AI assistants with access to international trade and tariff information.

Features

  • findCommodity: Search for commodity codes by keyword and receive hierarchical harmonized system codes

Quick Start

Prerequisites

  • Node.js 18+ OR Bun 1.0+

Installation

With npm:

npm install

With Bun:

bun install

Configuration

Copy .env.example to .env and configure:

cp .env.example .env

Key environment variables:

  • TARIFF_API_URL: Base URL for the external tariff API
  • MCP_SERVER_NAME: Name of the MCP server (default: tariff-mcp)
  • MCP_SERVER_VERSION: Version of the MCP server

Running the Server

Development Mode

# With npm
npm run dev

# With Bun  
bun run dev

Production Mode

# With npm
npm run build
npm start

# With Bun
bun run build
bun start

MCP Mode (for MCP clients)

# With npm
npm run mcp

# With Bun
bun run mcp

Testing

Run the comprehensive test suite:

# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Run specific test file
bun test tests/CommodityService.test.ts

# Run with verbose output
bun test --verbose

The test suite includes:

  • Unit Tests: Core transformation logic
  • Integration Tests: End-to-end API transformation
  • Real-world Examples: Actual API response handling

MCP Tool: findCommodity

Search for commodity codes with hierarchical results.

Input Schema

{
  "searchText": "string (required)",
  "countryCode": "string (optional, defaults to 'TR')",
  "languageCode": "string (optional, defaults to 'TR')", 
  "measureType": "string (optional, 'import' or 'export', defaults to 'import')"
}

Example Usage

{
  "name": "findCommodity",
  "arguments": {
    "searchText": "gloves",
    "countryCode": "TR",
    "languageCode": "EN",
    "measureType": "import"
  }
}

Response Format

Returns a hierarchical structure of commodity codes with:

  • HS codes at different levels (4, 6, 8, 10 digit)
  • Parent-child relationships
  • Descriptions and categories
  • Leaf node indicators
  • Search suggestions

Integration with MCP Clients

Claude Desktop

Add to your MCP configuration:

With Node.js:

{
  "mcpServers": {
    "tariff": {
      "command": "npx",
      "args": ["tsx", "/path/to/tariff-mcp/src/index.ts"],
      "env": {
        "TARIFF_API_URL": "your-api-url"
      }
    }
  }
}

With Bun:

{
  "mcpServers": {
    "tariff": {
      "command": "bun",
      "args": ["/path/to/tariff-mcp/src/index.ts"],
      "env": {
        "TARIFF_API_URL": "your-api-url"
      }
    }
  }
}

Other MCP Clients

The server implements the standard MCP protocol and should work with any compliant MCP client.

Development

Project Structure

src/
├── server.ts          # MCP server implementation
├── index.ts           # Main entry point
├── tools/             # MCP tool implementations
│   └── CommodityLookupTool.ts
├── services/          # Business logic
│   ├── CommodityService.ts
│   └── TariffAPIClient.ts
└── types/             # TypeScript interfaces
    └── index.ts

Building

bun run build

Testing

The server can be tested manually by running it and sending MCP protocol messages via stdin/stdout.

License

ISC