HimiTrace MCP Server

HimiTrace MCP Server

A Model Context Protocol (MCP) server connecting AI agents to the Polygon blockchain for product origin verification and supply chain timeline auditing

Category
访问服务器

README

HimiTrace MCP Server — Blockchain Product Traceability for AI Agents

Polygon Mainnet FastMCP Python 3.10+

HimiTrace is a Model Context Protocol (MCP) server that connects AI agents directly to the Polygon Mainnet blockchain to check product authenticity, verify origins, and inspect supply chain event lineages. Developed by HimiTek (himitek.com), it bridges immutable on-chain trust data with natural language queries for AI agents.

This allows any MCP-compatible AI agent (such as Claude Desktop, Cursor, Windsurf, or ChatGPT) to seamlessly query, track, and audit physical goods (such as Vietnamese agricultural exports, seafood, and components) on-chain in plain language.


Key Features

  • On-Chain Verification: Verify if a product or batch ID is registered on the Polygon blockchain (tamper-proof, immutable).
  • Supply Chain Timeline (GS1 EPCIS compatible): Retrieve the full chronological event log of a product (harvesting, processing, packaging, shipping) directly from Polygon.
  • Certificate Verification: Access quality certificates (USDA Organic, VietGAP, Fair Trade, etc.) stored on IPFS with their hashes anchored on-chain.
  • BOM (Bill of Materials) Lineage: Trace parent-child merge/split relationships of raw material batches.
  • Zero Gas Cost: All read operations from the smart contract are 100% free and do not require any crypto tokens (POL) to be spent by the AI agent.

Technical Specifications

  • Contract Address: 0xFF7A3429427aFda56b2994B2F3eeF4464b851EE0
  • Network: Polygon Mainnet (Chain ID: 137)
  • Framework: built on Anthropic's Model Context Protocol (MCP) using Python FastMCP.

Installation & Setup

1. Prerequisites

  • Python 3.10 or higher
  • Access to a Polygon RPC node (default public RPCs are configured, or you can specify your own).

2. Install Dependencies

Clone the repository and install the required packages:

pip install -r requirements.txt

3. Test Connection

Ensure that the server can connect to the Polygon contract and query tools locally:

python test_local.py

If you see ALL TESTS PASSED, your environment is configured correctly.


Connecting to AI Clients

1. Claude Desktop

Add HimiTrace MCP to your Claude Desktop configuration file.

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Add the following to the mcpServers object:

{
  "mcpServers": {
    "himitrace": {
      "command": "python",
      "args": [
        "C:/path/to/your/himitrace/mcp_server/server.py"
      ]
    }
  }
}

Note: Make sure to replace C:/path/to/your/himitrace/mcp_server/server.py with the actual absolute path to your server.py.

2. Cursor or Windsurf IDE

In Cursor settings:

  1. Go to Settings > Features > MCP.
  2. Click + Add New MCP Server.
  3. Fill in the fields:
    • Name: HimiTrace
    • Type: command
    • Command: python "C:/path/to/your/himitrace/mcp_server/server.py"

Available Tools

AI agents can execute the following tools:

1. verify_product

Checks if a product exists on-chain and retrieves its registration parameters.

  • Argument: product_id (string, e.g., LOT-20260315-A1B2C3)
  • Returns: JSON containing verification status, name, origin, owner, registration date, and explorer links.

2. get_trace_history

Retrieves the complete supply chain history (timeline) of a product.

  • Argument: product_id (string)
  • Returns: Chronological array of events, including event types, timestamps, custom payload data (GS1 EPCIS standard), and the recorder's blockchain wallet address.

3. get_certificates

Retrieves certificates attached to a product.

  • Argument: product_id (string)
  • Returns: Lists certificate types, issuers, dates of issue/expiration, and secure IPFS gateway links.

4. get_batch_lineage

Traces the Bill of Materials (BOM) lineage (splits and merges of batches).

  • Argument: batch_id (string)
  • Returns: Parent-child relationships, quantities, and units of raw material inputs.

5. check_product_exists

Quick check for product presence.

  • Argument: product_id (string)
  • Returns: True/False status.

6. get_system_stats

Provides overall system statistics.

  • Returns: Registered products count, contract details, and wallet balance.

Available Resources

AI agents can reference the following static resources:

  • himitrace://info: General system documentation, compliant industries, and standards.
  • himitrace://contract: Blockchain metadata (chain_id, RPC node, contract code version).
  • himitrace://pricing: Pricing tiers for API limits (Free, Pro, Enterprise).

Production Deployment (HTTP / SSE mode)

To run HimiTrace MCP in Server-Sent Events (SSE) mode over HTTP for remote AI integrations:

fastmcp run server.py --transport sse --port 8900

This starts an SSE server on port 8900 which can be exposed securely via reverse proxy (e.g., Nginx with TLS) or tools like Ngrok/Cloudflare Tunnels.


License & Support

Developed and maintained by HimiTek Joint Stock Company.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选