内容
# 车辆图像 MCP 服务器
[](https://www.npmjs.com/package/vehicleimagery-mcp)
[](./LICENSE)
一个 [模型上下文协议](https://modelcontextprotocol.io) 服务器,用于 [车辆图像 API](https://api.vehicleimagery.com)。它允许诸如 Claude 之类的 AI 助手浏览车辆目录并解析 studio 级别的汽车图像为签名 CDN URL,包含喷漆颜色、相机视角、阴影、透明背景等。
基于官方 [vehicleimagery](https://www.npmjs.com/package/vehicleimagery) SDK 构建。
## 功能
询问您的助手:
- 显示 2023 款宝马 X5 从前面看的 Alpine White 效果
- 特斯拉 Model 3 有哪些颜色可供选择?
- 获取 Audi Q5 的透明后视图,WebP 格式,1200 像素宽
助手遍历目录,解析签名图像 URL,并可以直接嵌入。
## 要求
- Node.js 18 或更新版本
- 车辆图像 API 密钥
## 安装
[](https://cursor.com/en/install-mcp?name=vehicleimagery&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInZlaGljbGVpbWFnZXJ5LW1jcCJdLCJlbnYiOnsiVklfQVBJX0tFWSI6IllPVUJfQVBJX0tFWSJ9fQ%3D%3D)
[](https://insiders.vscode.dev/redirect/mcp/install?name=vehicleimagery&inputs=%5B%7B%22id%22%3A%22vi_api_key%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Vehicle+Imagery+API+key%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A5B%22-y%22%2C%22vehicleimagery-mcp%22%5D%2C%22env%22%3A%7B%22VI_API_KEY%22%3A%22%24%7Binput%3Avi_api_key%7D%22%7D%7D)
[](#claude-code)
[](#claude-desktop)
[](#openai-codex)
[](#google-antigravity)
[](#windsurf)
[](#gemini-cli)
Cursor 和 VS Code 按钮直接安装。其他工具没有标准的安装链接,因此它们的按钮跳转到匹配的设置部分。安装后,请用您的密钥替换 `YOUR_API_KEY`。
## 设置
### Claude Desktop
将以下内容添加到您的 `claude_desktop_config.json`:
```json
{
"mcpServers": {
"vehicleimagery": {
"command": "npx",
"args": ["-y", "vehicleimagery-mcp"],
"env": {
"VI_API_KEY": "your_api_key"
}
}
}
}
```
### Claude Code
```bash
claude mcp add vehicleimagery --env VI_API_KEY=your_api_key -- npx -y vehicleimagery-mcp
```
### Cursor
使用上面的安装按钮,或将以下内容添加到您的项目中的 `.cursor/mcp.json`(或全局的 `~/.cursor/mcp.json`):
```json
{
"mcpServers": {
"vehicleimagery": {
"command": "npx",
"args": ["-y", "vehicleimagery-mcp"],
"env": {
"VI_API_KEY": "your_api_key"
}
}
}
}
```
### VS Code
使用上面的安装按钮,或将以下内容添加到工作区中的 `.vscode/mcp.json`:
```json
{
"servers": {
"vehicleimagery": {
"command": "npx",
"args": ["-y", "vehicleimagery-mcp"],
"env": {
"VI_API_KEY": "your_api_key"
}
}
}
}
```
### OpenAI Codex
```bash
codex mcp add vehicleimagery --env VI_API_KEY=your_api_key -- npx -y vehicleimagery-mcp
```
或将以下内容添加到 `~/.codex/config.toml`:
```toml
[mcp_servers.vehicleimagery]
command = "npx"
args = ["-y", "vehicleimagery-mcp"]
env = { "VI_API_KEY" = "your_api_key" }
```
### Google Antigravity
打开代理面板中的 MCP 服务器设置,选择编辑原始配置并添加:
```json
{
"mcpServers": {
"vehicleimagery": {
"command": "npx",
"args": ["-y", "vehicleimagery-mcp"],
"env": {
"VI_API_KEY": "your_api_key"
}
}
}
}
```
### Windsurf
将上述相同的 `mcpServers` 块添加到 `~/.codeium/windsurf/mcp_config.json`。
### Gemini CLI
将上述相同的 `mcpServers` 块添加到 `~/.gemini/settings.json`。
### 任意其他 MCP 客户端
服务器使用标准_stdio传输。启动命令:`npx -y vehicleimagery-mcp`,并设置 `VI_API_KEY` 环境变量。或者,传递密钥作为参数:`npx -y vehicleimagery-mcp --api-key your_api_key`。
## 工具
| 工具 | 用途 |
| ---- | ------- |
| `search_vehicles` | 模糊搜索品牌和型号 |
| `list_brands` | 列出所有可用品牌 |
| `list_models` | 列出品牌的型号 |
| `list_years` | 列出品牌和型号的年份 |
| `list_variants` | 列出品牌、型号和年份的变体 |
| `list_trims` | 列出配置的饰面 |
| `get_vehicle_config` | 一次调用查看、喷漆颜色和配置的特征 |
| `get_vehicle_image` | 解析带有转换选项的签名图像 URL |
| `list_reference_views` | 服务已知的相机视角名称 |
| `list_reference_colors` | 服务已知的喷漆颜色名称 |
| `get_account_info` | 配置的 API 密钥允许执行什么操作 |
目录是层次结构:品牌、型号、年份、变体、饰面、视角。工具描述自动引导助手完成此操作。
## 图像选项
`get_vehicle_image` 支持:`format`(png、webp、jpeg、avif、auto)、`resolution` 预设、`ratio` 填充、显式 `width`、`height` 和 `quality`、喷漆 `color` 按名称、`shadow`、`transparency`、`ground` 和 `mirroring`。返回的 `image_url` 是签名 CDN URL,有效期约为 7 天,可以直接嵌入。
## 环境变量
| 变量 | 用途 |
| -------- | ------- |
| `VI_API_KEY` | 您的 Vehicle Imagery API 密钥(必填) |
| `VI_BASE_URL` | 可选覆盖 API 基本 URL |
## 开发
```bash
git clone https://github.com/vehicleimagery/vehicleimagery-mcp.git
cd vehicleimagery-mcp
npm install
npm run typecheck
npm test
npm run build
```
在本地运行已构建的服务器:
```bash
VI_API_KEY=your_key node dist/cli.js
```
您也可以以编程方式使用服务器:
```ts
import { createServer } from "vehicleimagery-mcp";
import { VehicleImagery } from "vehicleimagery";
const server = createServer(new VehicleImagery({ apiKey: "your_key" }));
```
## 相关
- [vehicleimagery](https://github.com/vehicleimagery/vehicleimagery-sdk):此服务器构建的 TypeScript 和 JavaScript SDK
- [API 文档](https://website-dta.pages.dev/documentation/)
- [OpenAPI 规范](https://api.vehicleimagery.com/api/openapi.json)
## 许可证
[MIT](./LICENSE),Vehicle Imagery。