Skip to main content
Glama
uju777

mcp-server-naver-search

search_naver

Search Naver for Korean shopping prices, real-time news, blog reviews, cafe posts, and local business info by category.

Instructions

네이버 검색 API를 사용하여 한국 현지 정보를 검색합니다.

Args:
    query (str): 검색어 (예: "맥북프로 M4 최저가", "삼성전자 주가 뉴스")
    category (str): 검색 카테고리
        - "shop": 쇼핑 최저가 검색 (★인기 기능)
        - "cafe": 네이버 카페 글 검색 (★찐 후기)
        - "news": 실시간 뉴스 기사
        - "blog": 블로그 리뷰
        - "local": 맛집, 장소 전화번호
    display (int): 가져올 결과 개수 (기본 5개)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
categoryNoblog
displayNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:15-16 (registration)
    MCP server instance creation and @mcp.tool() decorator registers 'search_naver' as a tool on the FastMCP server named 'Naver Search'.
    mcp = FastMCP("Naver Search")
  • Main handler function 'search_naver' that accepts query, category (shop/cafe/news/blog/local), and display count. Calls the Naver Open API search endpoint with the given parameters, formats results based on category (showing price for shop, cafe name for cafe, address for local, description for others), and returns a formatted string.
    @mcp.tool()
    async def search_naver(query: str, category: str = "blog", display: int = 5) -> str:
        """
        네이버 검색 API를 사용하여 한국 현지 정보를 검색합니다.
    
        Args:
            query (str): 검색어 (예: "맥북프로 M4 최저가", "삼성전자 주가 뉴스")
            category (str): 검색 카테고리
                - "shop": 쇼핑 최저가 검색 (★인기 기능)
                - "cafe": 네이버 카페 글 검색 (★찐 후기)
                - "news": 실시간 뉴스 기사
                - "blog": 블로그 리뷰
                - "local": 맛집, 장소 전화번호
            display (int): 가져올 결과 개수 (기본 5개)
        """
    
        base_url = "https://openapi.naver.com/v1/search"
        endpoints = {
            "shop": f"{base_url}/shop.json",
            "cafe": f"{base_url}/cafearticle.json",
            "news": f"{base_url}/news.json",
            "blog": f"{base_url}/blog.json",
            "local": f"{base_url}/local.json"
        }
    
        url = endpoints.get(category, endpoints["blog"])
    
        headers = {
            "X-Naver-Client-Id": NAVER_CLIENT_ID,
            "X-Naver-Client-Secret": NAVER_CLIENT_SECRET
        }
    
        params = {
            "query": query,
            "display": display,
            "sort": "sim"
        }
    
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params)
                response.raise_for_status()
                data = response.json()
                items = data.get('items', [])
    
                if not items:
                    return "검색 결과가 없습니다."
    
                formatted_results = []
    
                for idx, item in enumerate(items, 1):
                    title = item.get('title', '').replace('<b>', '').replace('</b>', '')
    
                    if category == "shop":
                        # 쇼핑: 가격과 브랜드 정보 강조
                        lprice = item.get('lprice', '0')
                        mall = item.get('mallName', '')
                        brand = item.get('brand', '')
                        link = item.get('link', '')
                        formatted_results.append(
                            f"### {idx}. {title}\n"
                            f"- **가격**: {int(lprice):,}원\n"
                            f"- **판매처**: {mall}\n"
                            f"- **브랜드**: {brand}\n"
                            f"- **링크**: {link}\n"
                        )
                    elif category == "cafe":
                        # 카페: 카페 이름과 글 내용 강조
                        desc = item.get('description', '').replace('<b>', '').replace('</b>', '')
                        cafename = item.get('cafename', '')
                        link = item.get('link', '')
                        formatted_results.append(
                            f"### {idx}. {title}\n"
                            f"- **출처**: {cafename} (네이버 카페)\n"
                            f"- **요약**: {desc}\n"
                            f"- **링크**: {link}\n"
                        )
                    else:
                        # 뉴스/블로그/지역
                        desc = item.get('description', '').replace('<b>', '').replace('</b>', '')
                        link = item.get('link', '')
                        if category == "local":
                            addr = item.get('roadAddress', '')
                            formatted_results.append(f"### {idx}. {title}\n- 주소: {addr}\n- 링크: {link}")
                        else:
                            formatted_results.append(f"### {idx}. {title}\n- 내용: {desc}\n- 링크: {link}")
    
                return "\n".join(formatted_results)
    
            except Exception as e:
                return f"오류 발생: {str(e)}"
  • Mapping of category names to Naver Open API JSON endpoints (shop, cafearticle, news, blog, local).
    base_url = "https://openapi.naver.com/v1/search"
    endpoints = {
        "shop": f"{base_url}/shop.json",
        "cafe": f"{base_url}/cafearticle.json",
        "news": f"{base_url}/news.json",
        "blog": f"{base_url}/blog.json",
        "local": f"{base_url}/local.json"
    }
  • Environment variable loading for NAVER_CLIENT_ID and NAVER_CLIENT_SECRET needed for API authentication.
    NAVER_CLIENT_ID = os.getenv("NAVER_CLIENT_ID")
    NAVER_CLIENT_SECRET = os.getenv("NAVER_CLIENT_SECRET")
    
    if not NAVER_CLIENT_ID or not NAVER_CLIENT_SECRET:
        raise ValueError("Error: .env 파일에 NAVER_CLIENT_ID와 NAVER_CLIENT_SECRET을 설정해주세요.")
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It correctly implies a read-only search operation but does not explicitly state that it is non-destructive, mention authentication requirements, or describe rate limits. These omissions are minor for a straightforward search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening sentence and a labeled 'Args' section. While slightly verbose with emojis and examples, every sentence adds value. It is front-loaded with the core purpose. Could be more concise by removing redundant phrasing, but overall efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (3 parameters, output schema present), the description provides adequate context. It covers all parameters and use cases. The presence of an output schema alleviates the need to explain return values. Missing details like error handling or pagination are not critical for this simple search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description entirely compensates by providing detailed parameter semantics. It explains the 'query' parameter with an example, lists all 'category' options with emojis and usage tips (e.g., '★인기 기능'), and specifies the default for 'display'. This adds significant meaning beyond the schema's type definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it searches Naver API for Korean local information, with a specific verb ('search') and resource ('Naver search API'). It lists five distinct categories (shop, cafe, news, blog, local), making the purpose unambiguous even without sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit context for when to use the tool (for searching Korean local information via Naver). It details each category with practical examples, helping the agent choose appropriately. However, it does not provide exclusions or mention alternatives since no sibling tools exist.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/uju777/mcp-server-naver-search'

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