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

@dearmrzhang/customs-mcp-server

v0.1.2

Published

MCP server for customs declaration, tariff query and shipment tracking — wraps your backend Agent APIs as standard MCP tools.

Downloads

226

Readme

@dearmrzhang/customs-mcp-server

MCP server for customs declaration, tariff query and shipment tracking.

将关务系统的报关单查询、税则查询、进出口流转追踪等能力封装为标准 MCP 工具,供 Claude Desktop、Cursor 等 AI 客户端直接调用。

npm version license node


Features / 功能

  • Declaration Status — Query declaration status by entry ID or sequence number / 按报关单号或统一编号查询申报状态
  • Declaration List — Search declarations by import/export flag, bill number, date range / 按进出口标志、提运单号、时间范围查询报关单列表
  • Declaration Detail — Get full declaration details / 获取报关单全量详情
  • Import/Export Status — Track import/export flow status / 查询进出口流转状态
  • Tariff Info — Look up tariff by HS code or product name / 按 HS 编码或商品名称查询税则
  • Full Process Tracking — End-to-end customs clearance tracking / 海关全流程流转轨迹追踪

Quick Start / 快速开始

Use with npx (no install needed)

Add the following to your MCP client configuration (e.g. claude_desktop_config.json):

将以下配置添加到 MCP 客户端配置文件中:

{
  "mcpServers": {
    "customs": {
      "command": "npx",
      "args": ["-y", "@dearmrzhang/customs-mcp-server", "--transport", "stdio"],
      "env": {
        "CUSTOMS_API_BASE_URL": "http://your-backend-host:port",
        "CUSTOMS_API_PREFIX": "/open-api/agent",
        "CUSTOMS_ACCESS_KEY": "your-access-key",
        "CUSTOMS_SECRET_KEY": "your-secret-key"
      }
    }
  }
}

Global install

npm install -g @dearmrzhang/customs-mcp-server
customs-mcp-server --transport stdio

Environment Variables / 环境变量

| Variable | Required | Default | Description | | --- | --- | --- | --- | | CUSTOMS_API_BASE_URL | Yes | — | Backend API root URL / 后端 API 根地址 | | CUSTOMS_API_PREFIX | No | /open-api/agent | API path prefix / 接口路径前缀 | | CUSTOMS_ACCESS_KEY | Yes | — | Access key for API auth / 接口鉴权 accessKey | | CUSTOMS_SECRET_KEY | Yes | — | Secret key for signing / 签名密钥 secretKey | | CUSTOMS_SIGN_ALGORITHM | No | MD5 | Signature algorithm / 签名算法 | | CUSTOMS_TIMEOUT_MS | No | 15000 | Request timeout in ms / 请求超时(毫秒) | | CUSTOMS_TIMESTAMP_TIMEZONE | No | Asia/Shanghai | Timezone for timestamp / 时间戳时区 | | MCP_HTTP_HOST | No | 0.0.0.0 | HTTP transport bind host | | MCP_HTTP_PORT | No | 8787 | HTTP transport port | | MCP_HTTP_PATH | No | /mcp | HTTP transport endpoint path | | MCP_HTTP_JSON_RESPONSE | No | false | Return JSON instead of SSE |


Available Tools / 可用工具

customs_get_declaration_status

Query declaration status / 查询申报状态

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | entryId | string | No* | Entry ID / 报关单号 | | seqNo | string | No* | Sequence number / 统一编号 |

* At least one of entryId or seqNo is required / 至少提供一个

customs_query_declaration_list

Search declaration list / 查询报关单列表

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | ieFlag | "I" | "E" | No | Import/Export flag / 进出口标志 | | entryId | string | No* | Entry ID or sequence number / 报关单号或统一编号 | | billNo | string | No* | Bill of lading number / 提运单号 | | beginTime | string | No* | Start date (yyyy-MM-dd) / 开始日期 | | endTime | string | No* | End date (yyyy-MM-dd) / 结束日期 |

* At least one of entryId, billNo, beginTime, endTime is required

customs_get_declaration_detail

Get full declaration details / 获取报关单全量详情

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | cusCiqNo | string | Yes | Entry ID or sequence number / 报关单号或统一编号 |

customs_get_import_export_status

Query import/export flow status / 查询进出口流转状态

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | ieFlag | "I" | "E" | No | Import/Export flag (auto-fallback: I → E) / 进出口标志 | | entryId | string | No* | Entry ID / 报关单号 | | billNo | string | No* | Bill of lading number / 提运单号 |

* At least one of entryId or billNo is required

customs_query_tariff_info

Look up tariff information / 查询税则信息

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | hscode | string | No* | HS code / HS 编码 | | hsname | string | No* | Product name / 商品名称 |

* At least one of hscode or hsname is required

customs_get_full_process_tracking

End-to-end customs tracking / 海关全流程流转轨迹

| Parameter | Type | Required | Description | | --- | --- | --- | --- | | ieFlag | "I" | "E" | No | Import/Export flag (auto-fallback: I → E) / 进出口标志 | | billNo | string | No* | Bill of lading number / 提运单号 | | customsNo | string | No* | Customs declaration number / 报关单号 |

* At least one of billNo or customsNo is required


Transport Modes / 传输模式

stdio (default)

Standard I/O transport — for local MCP clients like Claude Desktop.

customs-mcp-server --transport stdio

HTTP (Streamable HTTP)

HTTP transport — for remote deployment scenarios.

customs-mcp-server --transport http

Endpoints:

| Method | Path | Description | | --- | --- | --- | | POST | /mcp | MCP message endpoint | | GET | /mcp | SSE connection | | DELETE | /mcp | Close session | | GET | /health | Health check |


Docker Deployment / Docker 部署

  1. Create runtime config from the example / 基于示例创建运行时配置:
cp .env.compose.example .env.compose
# Edit .env.compose with your actual values
  1. Start the container / 启动容器:
docker compose up -d --build
  1. Verify / 验证:
curl http://127.0.0.1:8787/health

Auth Protocol / 签名协议

Requests to the backend API are signed with the following headers:

| Header | Description | | --- | --- | | accessKey | Your access key | | timestamp | Current timestamp (in configured timezone) | | nonce | Random UUID per request | | sign | MD5(accessKey + timestamp + nonce + secretKey) |

The algorithm must match your backend service_lic configuration.

签名算法需与后端 service_lic 中配置的算法保持一致。


License

MIT © ZHANGCHAO