Skip to main content
Glama
yelp-mcp-sdk

yelp-mcp-sdk

by miqui

yelp-mcp-sdk

基于 官方 MCP Python SDK 构建的 Yelp Fusion MCP 服务器。 功能上与 yelp-mcp-min (FastMCP) 完全相同,但直接使用了底层的 Server 类 —— 没有框架抽象。

先决条件

Related MCP server: yelp-mcp-min

安装

uv sync
cp .env.example .env
# Edit .env and set YELP_API_KEY

运行

# stdio transport (for use with Claude Desktop or an MCP client)
uv run python -m server.main

# Docker
docker build -t yelp-mcp-sdk .
docker buildx build -t yelp-mcp-sdk .
docker run --env-file .env yelp-mcp-sdk

环境变量

变量

必需

默认值

描述

YELP_API_KEY

是

—

Yelp Fusion API 持有者令牌

YELP_BASE_URL

否

https://api.yelp.com/v3

API 基础 URL

HTTP_TIMEOUT

否

10.0

请求超时时间(秒)

HTTP_MAX_RETRIES

否

3

429/5xx 错误时的最大重试次数

HTTP_RETRY_WAIT_MIN

否

1.0

最小退避等待时间(秒)

HTTP_RETRY_WAIT_MAX

否

10.0

最大退避等待时间(秒)

LOG_LEVEL

否

INFO

structlog 日志级别

JSON_LOGS

否

false

输出 JSON 格式日志

工具

工具

Yelp 端点

描述

search_businesses

GET /v3/businesses/search

支持分页的全文 + 地理位置搜索

find_business_by_phone

GET /v3/businesses/search/phone

通过 E.164 电话号码查找商家

match_business

GET /v3/businesses/matches

将结构化的名称+地址与 Yelp 列表进行匹配

get_business

GET /v3/businesses/{id}

通过 Yelp ID 或别名获取完整的商家资料

get_business_reviews

GET /v3/businesses/{id}/reviews

支持分页的客户评论

资源

yelp://business/{id} — 完整的 Yelp 商家资料,格式为 application/json。 通过 list_resource_templates 声明;通过 read_resource 获取。

项目结构

yelp-mcp-sdk/
  server/
    main.py              # Server("yelp-mcp", lifespan=...) + stdio run
    core/
      config.py          # pydantic-settings
      logging.py         # structlog → stderr
      client.py          # async httpx + tenacity retry
      models.py          # Pydantic output models
    handlers/
      params.py          # Pydantic input models (also generate inputSchema)
      tools.py           # list_tools() + call_tool() dispatcher
      resources.py       # list_resource_templates() + read_resource()
  tests/
    conftest.py
    test_client.py
    test_models.py
    test_handlers.py
  Dockerfile
  pyproject.toml
  .env.example

运行测试

uv run pytest -v

与 yelp-mcp-min (FastMCP) 的比较

方面

yelp-mcp-min (FastMCP)

yelp-mcp-sdk (官方 SDK)

工具注册

@mcp.tool() 装饰器

list_tools + call_tool 分发器

输入模式

从函数签名自动生成

显式使用 model.model_json_schema()

输出类型

直接返回 Pydantic 模型

带有 JSON 字符串的 list[TextContent]

资源

@mcp.resource("uri://...") 装饰器

list_resource_templates + read_resource 对

依赖注入

无(通过闭包捕获)

lifespan 上下文 → request_context

传输

mcp.run()

asyncio.run() + stdio_server()

服务器代码行数

~350

~450

Available Tools

5 tools
find_business_by_phoneA
Read-onlyIdempotent

Look up Yelp businesses that match a phone number. Use when you have a phone number and need to identify the business. Phone must be in E.164 format (+14155551234). Returns up to a handful of candidates; empty list means not found.

Inputs: phone (required).

get_businessA
Read-onlyIdempotent

Fetch the full Yelp profile for a specific business by its ID or alias. Use when you already have a Yelp business ID and need complete details: hours, all photos, full address, price tier, categories, and URL. Raises an error if the business ID does not exist on Yelp.

Inputs: business_id (required), locale.

get_business_reviewsA
Read-onlyIdempotent

Retrieve user reviews for a specific Yelp business. Use when the user wants to read customer opinions: ratings, comments, and reviewer info. Returns up to 50 reviews per call. Use offset to paginate; total field shows how many reviews exist.

Inputs: business_id (required), locale, sort_by, limit, +1 more.

match_businessA
Read-onlyIdempotent

Match a business by name and address to its canonical Yelp listing. Use when you have structured address data and need to verify or enrich it with Yelp data such as ID, rating, hours, and URL. name + address1 + city + state + country are required. Adding zip_code and phone significantly improves match precision.

Inputs: name (required), address1 (required), city (required), state (required), +4 more.

search_businessesA
Read-only

Search Yelp for businesses matching a term, location, or both. Use when the user wants to discover restaurants, services, or shops. Supports free-text search, geo coordinates, category filters, price tiers, open-now filtering, and pagination via limit/offset. Supply at least one of: location, or both latitude + longitude.

Inputs: term, location, latitude, longitude, +7 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: phone lookup, get full business details, get reviews, match by name/address, and general search. No overlapping functionality, making selection unambiguous.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern (e.g., find_business_by_phone, get_business, search_businesses), with clear modifiers where needed. No mixing of conventions.

    Tool Count5/5

    Five tools is well-scoped for a Yelp API wrapper: covering search, matching, detailed lookup, reviews, and phone lookup. It's neither overly sparse nor bloated.

    Completeness5/5

    The tool set covers the core Yelp use cases—discovery, matching, detailed info, and reviews. There are no obvious gaps for read-only access, as mutations are not part of Yelp's public API.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides access to Yelp's business database for searching local businesses, retrieving detailed ratings and reviews, and performing market research through business counts. It enables users to look up businesses by location, category, or phone number using the Yelp Fusion API.
      1
      -
    • F
      license
      A
      quality
      D
      maintenance
      Minimal MCP server for the Yelp Fusion API v3, enabling business search, phone lookup, match, details, and reviews via FastMCP.
      5
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for Yelp integration, enabling AI agents to search for local businesses, read reviews, view photos, check hours, find deals, and discover trending spots.
      12
      41 npm
      MIT