Brandfetch MCP Server

Brandfetch MCP Server

site icon
2025.04.04 0
Python品牌数据服务API 集成开发效率
Brandfetch MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,它为大型语言模型 (LLM) 应用与 Brandfetch API 之间提供了桥梁。该服务允许 AI 助手搜索品牌并获取全面的品牌信息,包括徽标、颜色、字体和公司详情等。通过实现 MCP,该服务器能够将 Brandfetch 的品牌数据能力无缝集成到基于 LLM 的应用中。
View on GitHub

Overview

基本能力

产品定位

Brandfetch MCP Server 是一个为 AI 助手提供品牌数据查询服务的中间件,旨在通过 MCP 协议将 Brandfetch API 的功能集成到 LLM 应用中。

核心功能

  • 品牌搜索:通过名称搜索品牌并获取基本信息
  • 详细品牌信息:检索包括徽标、颜色、字体和公司详情在内的全面品牌数据
  • 字段过滤:仅请求特定信息以优化响应大小和处理
  • 交互式提示:内置提示指导用户正确使用 API
  • 类型安全实现:完全类型化的 Python 代码库,支持现代异步
  • 健壮的错误处理:全面的错误处理和日志记录

适用场景

  • AI 助手需要查询品牌信息的应用
  • 需要集成 Brandfetch API 功能的 LLM 应用
  • 需要过滤品牌数据字段以优化性能的场景

工具列表

  1. search_brands:使用 Brandfetch Search API 按名称搜索品牌
  2. 参数:name(公司名称)、client_id(可选)
  3. get_brand_info:通过标识符使用 Brandfetch Brand API 获取详细的品牌信息
  4. 参数:identifier(品牌标识符)、fields(可选字段列表)

常见问题解答

  • 如何获取 Brandfetch API 凭证? 在 Brandfetch 上创建账户并导航到 API 部分获取。
  • 如何测试服务器功能? 使用 pytest 运行测试套件。

使用教程

使用依赖

  • Python 3.9 或更高版本
  • Brandfetch API 凭证(API 密钥和客户端 ID)

安装教程

使用 uv(推荐)

# 创建并导航到新项目目录
uv init brandfetch-mcp
cd brandfetch-mcp

# 克隆此仓库
git clone https://github.com/VincentSolconBraze/brandfetch-mcp.git .

# 添加依赖
uv add "mcp[cli]" httpx python-dotenv

# 开发环境
uv add --dev pytest pytest-asyncio pytest-cov ruff pyright pre-commit

使用 pip

# 克隆此仓库
git clone https://github.com/VincentSolconBraze/brandfetch-mcp.git
cd brandfetch-mcp

# 安装依赖
pip install "mcp[cli]" httpx python-dotenv

# 开发环境
pip install pytest pytest-asyncio pytest-cov ruff pyright pre-commit

配置

  1. 基于示例创建 .env 文件:
cp .env.example .env
  1. 将 Brandfetch API 凭证添加到 .env 文件:
BRANDFETCH_API_KEY=your_api_key
BRANDFETCH_CLIENT_ID=your_client_id

调试方式

与 Claude Desktop 一起运行

mcp install brandfetch_server.py

使用 MCP Inspector 测试

mcp dev brandfetch_server.py

直接执行

python brandfetch_server.py

运行测试

pytest

# 覆盖率报告
pytest --cov=./ --cov-report=term

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。