Skip to main content
Glama
joakes90

vin-decode-mcp

by joakes90

vin-decode-mcp

从精选的 NHTSA vPIC 数据库中解码 VIN 并查询车辆数据 — 由 Model Context Protocol 驱动。

一个独立的、支持离线的 MCP 服务器,供 LLM 解码车辆识别码(VIN)并查询品牌、车型和车辆规格,数据来源于 [NHTSA 的 vPIC](https://vpic.nhtsa.dot.gov/)。

pip install vin-decode-mcp
vin-decode-mcp  # Start the MCP server

为什么?

  • 离线:无需互联网即可使用。精选的 SQLite 数据库(约 4.5 MB)完全自包含。

  • 无速率限制:与直接调用 vPIC API 不同,本地查询不受限制。

  • 快速:针对 SQLite 数据库的模式匹配只需微秒级时间。

  • LLM 原生:工具带有丰富的文档字符串、schema 资源和结构化 JSON 输出。

  • 开放数据:NHTSA vPIC 是美国政府开放数据 — 免费,无需 API 密钥。

Related MCP server: VIN MCP

数据覆盖

  • 美国市场车辆,车型年份 1981 年及以后

  • 534 个品牌9,175 个车型88,140 个 VIN 模式

  • 乘用车、卡车、多用途车(MPV)、摩托车、越野车

  • 不包括:客车、拖车、低速车辆、非完整车辆

仅限规格信息 — 此数据库不包含所有权、事故、里程表 或被盗记录(这些需要 NMVTIS/商业数据源)。

快速开始

安装

pip install vin-decode-mcp

或者从源码安装:

git clone https://github.com/<org>/vin-decode-mcp.git
cd vin-decode-mcp
pip install -e .

运行

# Default: stdio transport (for Claude Desktop, Cursor, etc.)
vin-decode-mcp

# HTTP transport
vin-decode-mcp --transport http --port 8765

与 Claude Desktop 配合使用

将以下内容添加到 ~/.config/claude-desktop/config.json(在 macOS 上为 ~/Library/Application Support/claude-desktop/config.json):

{
  "mcpServers": {
    "vin-decode": {
      "command": "vin-decode-mcp"
    }
  }
}

重新启动 Claude Desktop。现在,模型可以在对话中使用 VIN 解码工具了。

可用工具

工具

描述

decode_vin(vin, model_year?)

解码一个 VIN → 品牌、车型、年份、车辆类型

decode_partial_vin(pattern, limit?)

使用 * 通配符匹配部分 VIN

get_all_makes()

列出所有车辆品牌

get_models_for_make(make, vehicle_type?)

列出某个品牌下的车型

get_model_years(make, model)

获取生产年份范围

get_wmi_info(wmi)

解码 WMI → 制造商信息

get_vehicle_types()

列出可用的车辆类型

get_make_vehicle_types(make)

列出某个品牌的车辆类型

示例

>>> decode_vin("1HGCM82633A004352")
{
  "vin": "1HGCM82633A004352",
  "make": "Honda",
  "model": "Accord",
  "year": 2003,
  "vehicle_type": "Passenger Car",
  "wmi": "1HG",
  "confidence": "full"
}

>>> get_model_years("Porsche", "911")
{"year_from": 1981, "year_to": null}

>>> decode_partial_vin("5UXWX7C5*BA")
[{"make": "BMW", "model": "X5", "year": 2011, "confidence": "partial_match"}]

数据库

下载

编译好的数据库托管在 Hugging Face 上:

数据集<https://hugingface.co/datasets/vin-decode-mcp/vpic-database> 直接下载<https://hugingface.co/datasets/vin-decode-mcp/vpic-database/resolve/main/vpic_decode.db>

自定义数据库路径

# Set via environment variable
export VIN_MCP_DB_PATH=/path/to/vpic_decode.db
vin-decode-mcp

# Or via CLI flag
vin-decode-mcp --db-path /path/to/vpic_decode.db

重新构建

该数据库大约每 6-12 个月根据 NHTSA 的独立 PostgreSQL 数据库重新构建一次:

# Requires PostgreSQL installed (pg_restore, psql)
bash tools/rebuild.sh

# Or step by step:
# 1. Download NHTSA data: https://vpic.nhtsa.dot.gov/Downloads/
# 2. Convert to SQLite
python3 tools/convert_to_sqlite.py --input dump.sql --output vpic_lite.db
# 3. Build curated database
python3 tools/build_db.py --source vpic_lite.db --output vpic_decode.db

有关 Hugging Face 设置说明,请参阅 docs/hf-setup.md

数据来源与署名

车辆数据来源于 NHTSA 的 vPIC — 美国国家公路交通安全管理局(National Highway Traffic Safety Administration)的车辆产品信息目录与车辆列表。NHTSA 是美国政府机构。

  • 数据许可:美国政府作品(公共领域)

  • API:无需密钥或注册

  • 刷新频率:约 6-12 个月

  • 报告错误:联系 NHTSA 制造商帮助台:manufacturerinfo@dot.gov 或 1-888-399-3277

架构

User / LLM Agent
       │
       ▼  MCP (stdio / HTTP)
┌──────────────────┐
│  vin-decode-mcp  │  pip install vin-decode-mcp
│  (FastMCP server)│  env: VIN_MCP_DB_PATH=/path/to/vpic_decode.db
└────────┬─────────┘
         │  sqlite3 (mode=ro)
         ▼
┌──────────────────┐
│ vpic_decode.db     │  ~4.5 MB, curated
│  (Hugging Face)  │  makes + models + WMI + VIN patterns
└──────────────────┘
         ▲
         │  rebuilds from
┌──────────────────┐
│ NHTSA vPIC PG DB │  69 MB, official
│ (NHTSA website)  │  refreshed 2x/year
└──────────────────┘

项目结构

vin-decode-mcp/
├── src/vin_decode_mcp/
│   ├── __init__.py              # Package init
│   ├── server.py                # FastMCP server with all tools
│   ├── database.py              # SQLite layer + VIN decoder
│   └── cli.py                   # CLI entry point
├── tools/
│   ├── build_db.py              # Pipeline orchestrator
│   ├── convert_to_sqlite.py     # PG → SQLite converter
│   ├── rebuild.sh               # Full rebuild script
│   ├── build_db.py              # Curated DB builder (orchestrator for the pipeline)
│   ├── curation.json            # Make/model curation rules
│   ├── overlay.json             # Grey-import classic additions
│   └── README.md                # Rebuild instructions
├── tests/
│   ├── conftest.py              # Test fixtures
│   ├── test_decode.py           # VIN decode canary tests
│   ├── test_server.py           # Bulk lookup tests
│   └── fixtures/
│       ├── build_test_db.py     # Test database builder
│       └── test_vpic.db         # Minimal test database
├── .github/workflows/
│   ├── ci.yml                   # CI: test + lint
│   └── rebuild-db.yml           # Scheduled DB rebuild
├── docs/
│   └── hf-setup.md              # Hugging Face setup guide
├── pyproject.toml
├── LICENSE
├── README.md
└── vpic_pare_down.py            # Pare-down pipeline (original)

开发

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Lint
python -m ruff check src/ tests/

# Format
python -m ruff format src/ tests/

与其他方案的比较

vin-decode-mcp

NHTSA vPIC API

vin-mcp (NLMA)

传输方式

本地 SQLite

HTTP REST

HTTP REST

离线

速率受限

数据大小

约 4.5 MB

N/A

N/A

VIN 字段

品牌 + 车型 + 年份

约 130 个字段

约 130 个字段

品牌/车型

✅ 534/9,175

✅ 完整目录

✅ 完整目录

安装

pip install

pip install

许可证

MIT 许可证 — 代码采用 MIT 许可证。数据属于美国政府公共领域。

详见 LICENSE

贡献

欢迎贡献!请:

  1. Fork 并创建功能分支

  2. 为新功能添加测试

  3. 确保 CI 通过

  4. 提交拉取请求

对于重大更改,请先创建 issue 讨论方案。

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    C
    quality
    D
    maintenance
    Enables access to comprehensive vehicle information including VIN decoding, license plate OCR, vehicle history checks (theft, title, salvage records), market valuations, specifications, and warranty data for vehicles across North America and Europe.
    6
    61
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive vehicle reports by aggregating data from multiple public sources to decode VINs, check recalls, and view safety ratings. It enables users to validate VINs locally and retrieve technical specifications, fuel economy, and vehicle photos without requiring API keys.
    18
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Exposes a connected-vehicle OBD-II/telematics platform to AI agents, enabling vehicle health scoring, live data queries, DTC decoding, maintenance prediction, and gated remote commands via a pluggable data layer.
    9

View all related MCP servers

Related MCP Connectors

  • Machine-readable utilities and datasets for AI agents.

  • Neutral freight reference + validation layer for AI agents: ADR, HS, UN/LOCODE, freight math

  • 500+ deterministic tools for AI agents: math, conversion, validation, hashing, encoding, date/time.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/joakes90/vin-decode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server